[fpc-pascal] CustHttpApp again, error: "Missing HTTP protocol version in request"
Michael Van Canneyt
michael at freepascal.org
Fri Apr 25 08:39:53 CEST 2014
On Thu, 24 Apr 2014, silvioprog wrote:
> Hello,
> I've tested the CustHttpApp unit in new released FPC 2.6.4 on Windows, and the error "Missing HTTP protocol version in request" still
> continues.
>
> I'll show detailed steps (including my tools) to reproduce it:
>
> 1. on Windows (I'm using 8), download and install the latest Lazarus/FPC version:
> "http://downloads.sourceforge.net/project/lazarus/Lazarus%20Windows%2032%20bits/Lazarus%201.2.2/lazarus-1.2.2-fpc-2.6.4-win32.exe";
> 2. download this source code (the project to reproduce the bug) from link "https://www.dropbox.com/s/rmfitgh7b58cf1g/es_bug.zip" or in
> attachment;
> 3. in "Tools | Options ..." menu, got to the "Debugger > Language Exceptions" page, and check the "Notify on Lazarus Exceptions"
> option;
> 4. run the project with F9 (notice that I left a breakpoint);
> 5. using the "Advanced REST client" Chrome plugin
> "https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo", fill the URL with
> "http://localhost:1025" and click in "Send" button;
> 6. push F9 until the Lazarus exits from breakpoint;
> 7. wait a few moments, that Lazarus will go to the breakpoint after some secounds;
>
>
> When Lazarus go to the breakpoint again, push F8 several times, and notice that in line 363, the "R" variable will receive the zero
> value:
>
> ...
> Procedure FillBuffer;
>
> Var
> R : Integer;
>
> begin
> SetLength(FBuffer,ReadBufLen);
> r:=FSocket.Read(FBuffer[1],ReadBufLen); <<< HERE!
> If r<0 then
> Raise EHTTPServer.Create(SErrReadingSocket);
> if (r<ReadBuflen) then
> SetLength(FBuffer,r);
> end;
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;
Michael.
More information about the fpc-pascal
mailing list