Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

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

Josh CodeJosh Code Posts: 675Member
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:
[code]
POST / HTTP/1.0
Host: socr.uwindsor.ca:3456

var1=bla+bla&var2=yo
[/code]

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?




Sign In or Register to comment.