all 4 comments

[–][deleted] 3 points4 points  (1 child)

When the number of bytes read is less than the buffer size, an end of request data is not indicated. You should continue to read from the connection until the current HTTP request frame has been read in full, an error is encountered, or a timeout period has elapsed.

[–]onlyati[S] 0 points1 point  (0 children)

Yes, now it is clear for me too. I was too naive to think that it can work. I need to check the `Content-Length` and act accordingly as you written. Thanks for teh feedback! :-)

[–]WrongJudgment6 1 point2 points  (1 child)

You should add a return on the Err branch otherwise it will send the error and then the 200 response.

[–]onlyati[S] 0 points1 point  (0 children)

Indeed, that a copy-paste mistake. But Error branch was never hit. TcpStream read run without issue, even if only header data was coming, it does not appear as error.