Question

I know this isn't a SO favored question, but I didn't get enough info I want through Googling. So basiclly I'm writing a HTTP server as a class project. I'm NOT asking how to do it. What I want to know is: what are the basic functionalities to add?

So far I've got:

  1. returning requested pages/resources
  2. adding Date,Content-Type,Server,Content-Length headers
  3. a simple cache machanism, adding requested page to memory so that next time it's requested I can get it from memory.

I'm using Python gevent to handle requests, basically it's an asynchronous lib. When I receive a request, I spawn a new greenlet to handle it.

Any information is appreciated.

Was it helpful?

Solution

Well, just a full implementation of HTTP 1.1 with proper error handling is non-trivial.

HTTP flowchart

The flowchart starts:

  • Is service available? Status 503 if not.
  • Is URI too long? Status 414 if it is.
  • Are headers too large? Status 431 if it is.
  • Does the request require any functionality that is unimplemented? Status 501 if there is.
  • etc…
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top