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 · ·