Fr0sT.Brutal 900 Posted July 23, 2019 (edited) Method `OverbyteIcsHttpSrv.THttpConnection.ConnectionDataAvailable` contains following line: { We use line mode. We will receive complete lines } FRcvdLine := ReceiveStr; And below it is supposed that server have received HTTP-complete (ending with CRLF) line. But { Receive as much data as possible into a string } { You should avoid this function and use Receive. Using string will be } { much slower because data will be copied several times. } { ReceiveStr will *NOT* wait for a line to be received. It just read } { already received characters and return them as a string. } function TCustomWSocket.ReceiveStr : String; so a situation is possible when a chunk of header could be processed incorrectly or ignored. I suppose some kind of buffered line reader should be used. Edited July 24, 2019 by Sherlock Slight title correction Share this post Link to post
Angus Robertson 574 Posted July 23, 2019 No, header lines will not be ignored or lost since they all end with CRLF, and a double CRLF at the end of the header. Headers are small, and need to parsed as strings. To receive a POST body, that function calls an event where you can accept data using Receive and write it to a stream if expecting a large upload or just process some Json or whatever. Angus Share this post Link to post
Fr0sT.Brutal 900 Posted July 23, 2019 Yep, false alert, sorry. I was misleaded by that comment above TCustomWSocket.ReceiveStr and didn't notice that TCustomLineWSocket does all the necessary stuff incl. size check. Share this post Link to post
Sherlock 663 Posted July 24, 2019 I'll edit the title to fit this new situation and to not mislead future generations who might dig this up. Share this post Link to post
Fr0sT.Brutal 900 Posted July 24, 2019 Sherlock, feel free to delete the topic completely 😉 Share this post Link to post
Sherlock 663 Posted July 24, 2019 Nah... that's a bit over the top. And we could not say "Ah, there's the guy that cried Wolf to often" when we see you 😛 Share this post Link to post
Fr0sT.Brutal 900 Posted July 24, 2019 I'll try to not make false alarms 1 Share this post Link to post