0

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?

8
  • what would be an example of "trying to inject code?" Commented Nov 5, 2014 at 16:50
  • ..are you sure you actually need to write a server? why are you doing that? Commented Nov 5, 2014 at 16:51
  • 1
    (btw, the first line of an HTTP request is something like GET / HTTP/1.0, that's how you determine the version the client is trying to use..) Commented Nov 5, 2014 at 16:52
  • The bare syntax of the HTTP protocol is fairly simple and uninteresting. It's the URL parameters and/or the payload, if any, which needs close examination. Commented Nov 5, 2014 at 16:58
  • 1
    DanisFischer see @Daniel answer, and read carefully that RFC -- this is the right path if you need to implement the protocol. (BTW, for the future, it's good practice to indicate in the answer that this is for some "homework".. :)) Commented Nov 6, 2014 at 14:47

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.