pythonhttpprotocolsnetwork-protocolshttp-protocols

Verifying that send data is in HTTP (1.0 and 1.1) protocol


I'm trying to write a server in python 2.7 which receives and verifies that the client uses HTTP protocol (either 1.1 or 1.0 but a support has to be given for both).

How can I verify that the client is sending "a correct" protocol (either 1.0 or 1.1) and not trying to inject code to my server?


Solution

  • Read and implement rfc-2616 carefully. This is the reference for HTTP-1.1. If you don't use eval or call any external programs, to probability, that someone can inject code is very low.