Implement a Web server. Libraries for helping manage TCP socket connections may be used (if server is asynchronous epoll must be used). Libraries that implement any part of HTTP or multiprocessing model must not be used.
- Respond to
GET
with status code in{200,403,404}
- Respond to
HEAD
with status code in{200,404}
- Respond to all other request methods with status code
405
- Directory index file name
index.html
- Respond to requests for
/<file>.html
with the contents ofDOCUMENT_ROOT/<file>.html
- Requests for
/<directory>/
should be interpreted as requests forDOCUMENT_ROOT/<directory>/index.html
- Respond with the following header fields for all requests:
Server
Date
Connection
- Respond with the following additional header fields for all
200
responses toGET
andHEAD
requests:Content-Length
Content-Type
- Respond with correct
Content-Type
for.html, .css, js, jpg, .jpeg, .png, .gif, .swf
- Respond to percent-encoding URLs
- No security vulnerabilities!
- Bonus: init script for daemonization with commands: start, stop, restart, status
httptest
folder fromhttp-test-suite
repository should be copied intoDOCUMENT_ROOT
- Your HTTP server should listen
localhost:80
http://localhost/httptest/wikipedia_russia.html
must been shown correctly in browser- Lowest-latency response (tested using
ab
, ApacheBench) in the following fashion:ab -n 50000 -c 100 -r http://localhost:8080/