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:


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.

Howdy, Stranger!

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