Skip to content

fabientownsend/http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

HTTP Server

┌─────────┐                                          ┌─────────┐
│         │          ┌────────────────────┐          │         │
│         │──────────┤   GET / HTTP/1.1   ├─────────▶│         │
│         │          └────────────────────┘          │  Http   │
│ Client  │                                          │ Server  │
│         │          ┌────────────────────┐          │         │
│         │◀─────────┤  HTTP/1.1 200 OK   ├──────────│         │
│         │          └────────────────────┘          │         │
└─────────┘                                          └─────────┘

This aim of the project was to understand how a Http Server work. The aim of the project is to help an individual understand of how a Http Server work. It was driven by 23 acceptance tests which expected to have features like:

  • Post/Put/Get/Option/Head/Delete integration
  • Public file listings/links
  • Basic Auth
  • File provider
  • Partial file provider

Here is the basic flow of the Http server:

Byequest          Request                                                    Web
Client            Server             provider            parser              Framework

│                   │                   │                   │                   │    
├────────Http ─────▶│                   │                   │                   │    
│      request      ├───Read socket ───▶│                   │                   │    
│                   │                   │                   │                   │    
│                   │◀──Http request ───┤                   │                   │    
│                   │                   │                   │                   │    
│                   │                   │                   │                   │    
│                   ├──────────Parse http request ─────────▶│                   │    
│                   │                   │                   │                   │    
│                   │◀─────────Parsed http request──────────│                   │    
│                   │                   │                   │                   │    
│                   │                   │                   │                   │    
│                   │───────────────────┼───Get response────┼──────────────────▶│    
│                   │                   │                   │                   │    
│                   │◀──────────────────┼─────Response──────┼───────────────────┤    
│◀────────Http ─────┤                   │                   │                   │    
│       response    │                   │                   │                   │    

You can run the server this way:

Run the server

  gradle jar
  java -jar build/libs/server.jar -p 5000 -d /your/public/directory

You can connect to the server with netcat this way:

  nc localhost 5000

Test

Run unit tests

  gradle test

Run acceptence tests

  gradle jar
  cd cob_spec
  mvn package
  java -jar fitnesse.jar -p 9090

You can then going on the fitnesse test page which by default is: default test page

What's next?

I want to implement a cache system with the Optimal Replacement Policy algorithm.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published