I'm trying to implement an embedded HTTP server using TFPHTTPServer from fcl-web library.
First, I compiled the example project which comes from fpc.
simplehttpserver.pas
C:\lazarus\fpc\3.0.4\source\packages\fcl-web\examples\httpserver
https://github.com/alrieckert/freepascal/blob/master/packages/fcl-web/examples/httpserver/simplehttpserver.pasFor testing, I accessed to the server using normal browser. After a short period of time, I get a lots of
[Debugger Exception Notification]
Project *** raised exception class 'EHTTPServer' with message:
Missing HTTP protocol version in request
At first, I had no idea why. I thought this was browser's problem and I was trying to figure out why the browser is not sending HTTP protocol version in the request.
But it turns out ... it's just client browsers disconnected.
http://lists.freepascal.org/pipermail/fpc-pascal/2014-April/041720.htmlSo, looks like it's NOT about the HTTP protocol version.
unit fphttpserver;
resourcestring
SErrMissingProtocol = 'Missing HTTP protocol version in request';
maybe something like
SErrDisconnectedByClient = 'Disconnected by client';
And I looked for "IgnoreLostConnections" property but in vain. Try to "try .. catch" without directly editing the TFPHTTPServer ... failed.
I think TFPHTTPConnection needs OnDisconnectByClient or something.. But am not really familiar with socket networking... I mean I just started lazarus a few month ago...
What should I do?
Also, related, the example simplehttpserver.pas gives me
simplehttpserver.pas(10,49) Fatal: Cannot find wmecho used by simplehttpserver of the Project Inspector.
Removing the wmecho from using fixed problem.
I'm using
Lazarus 1.8.2 r57369 FPC 3.0.4 x86_64-win64-win32/win64