[fpc-pascal] CustHttpApp again, error: "Missing HTTP protocol version in request"

Michael Van Canneyt michael at freepascal.org
Fri Apr 25 15:25:07 CEST 2014



On Fri, 25 Apr 2014, silvioprog wrote:

> 2014-04-25 10:05 GMT-03:00 silvioprog <silvioprog at gmail.com>:
>       2014-04-25 3:39 GMT-03:00 Michael Van Canneyt <michael at freepascal.org>:
> [...] 
>       Damn windows returning 0 on read... Can you please test with the following change:
>
>          Procedure FillBuffer;
>
>          Var
>            R : Integer;
>
>          begin
>            SetLength(FBuffer,ReadBufLen);
>      Repeat
>        r:=FSocket.Read(FBuffer[1],ReadBufLen);
>        If r<0 then
>          Raise EHTTPServer.Create(SErrReadingSocket);
>        if R=0 then
>          Sleep(10);
>      Until (R<>0);
>      if (R<ReadBuflen) then
>        SetLength(FBuffer,r);
>    end;
> 
> 
> After apply this change, now when read returns 0, it freezes the app., because the "sleep(10)" command is infinitely called. :/
> 
> Damn windows!
> 
> 
> I have no much experience with sockets on Windows, but I saw two links:
> 
> http://stackoverflow.com/questions/10526382/recv-returns-0
> 
> http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable
> 
> Seems that error occurs when client disconnects from server. :/

See my other post...

Michael.


More information about the fpc-pascal mailing list