Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
HTTP protocol, request termination
I'm trying to make a simple HTTP server and running into problems with receiving HTTP POST requests.
The problem is that I don't know how to determine when to stop reading a POST request. Some requests don't specify Content-Length and the socket's input stream stays open after the whole message should have been read in.
Here is an example POST request:
POST / HTTP/1.0
If you look at the body of that request, you can quickly see the problem. When reading that in, how do I know there isn't another variable specified in the body that I should keep waiting for?
0 · ·