Skip to content

dakota-byte/http-server

Repository files navigation

http-server

A simple multi-threaded HTTP server written in python. This was originally written following along CodeCrafters "Build your own HTTP server" challenge.

Testing

This repo is running automated tests with github workflow (assuming port 4221). You can view those logs, or you can test it out yourself!

To test it out, try running the following:

python server.py --direction ./store/

and in another terminal

curl -si POST http://localhost:4221/files/test -H "Content-Length: 5" -H "Content-Type: application/octet-stream" -d 'hello'

this demonstrates a POST request to a HTTP server!

Features from the challenge:

  • /echo/ endpoint
  • /user-agent endpoint
  • GET /files/
  • POST /files/
  • gzip compression

Other features I've added as per RFC 2616 Hypertext Transfer Protocol -- HTTP/1.1:

  • automated tests (not in the RFC but I think it's cool)
  • Case insensitivity
  • HEAD method
  • "406 Not Acceptable" status code, for unrecognized compression

About

A multi-threaded HTTP Server written in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages