Skip to content

Prefork http server for technopark highload cource

Notifications You must be signed in to change notification settings

Kotyarich/http_server

Repository files navigation

Prefork http server for technopark highload cource

Task:

Implement a Web server in the programming language of your choice. Libraries for helping manage TCP socket connections may be used (libevent allowed). Libraries that implement any part of HTTP or multiprocessing model must not be used. Languages and platforms implementing hidden multithreading (Go, Node.js) are not allowed.

Requirements:

  • Respond to GET with status code in {200,404,403}
  • Respond to HEAD with status code in {200,404,403}
  • Respond to all other request methods with status code 405
  • Directory index file name index.html
  • Respond to requests for /.html with the contents of DOCUMENT_ROOT/.html
  • Requests for // should be interpreted as requests for DOCUMENT_ROOT//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 to GET and HEAD requests:
    • Content-Length
    • Content-Type
  • Respond with correct Content-Type for .html, .css, js, jpg, .jpeg, .png, .gif, .swf
  • Respond to percent-encoding URLs
  • Correctly serve a 2GB+ files
  • No security vulnerabilities

Testing environment

  • Put Dockerfile to web server repository root
  • Prepare docker container to run tests:
    • Read config file /etc/httpd.conf
    • Expose port 80

Config file spec:

cpu_limit 4       # maximum CPU count to use (for non-blocking servers)
thread_limit 256  # maximum simultaneous connections (for blocking servers)
document_root /var/www/html

Run tests:

git clone https://github.com/init/http-test-suite.git
cd http-test-suite

docker build -t bykov-httpd https://github.com/init/httpd.git
docker run -p 80:80 -v /etc/httpd.conf:/etc/httpd.conf:ro -v /var/www/html:/var/www/html:ro --name bykov-httpd -t bykov-httpd

./httptest.py

About

Prefork http server for technopark highload cource

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published