Hi all,
I have a simple server (included) that has stopped working due to some
changes to fphttpserver or the sockets code.
The problem, as far as my limited knowledge goes, seems to stem
from FSocket.RemoteEndpoint.First.Address in fphttpserver.pp
Replacing the FSocket.RemoteEndpoint.First.Address
with HostAddrToStr(Data.RemoteAddress.sin_addr) - the old code - fixes the
issue.
Printing out FSocket.RemoteEndpoint.First.Address displays nothing.
To test the included program, run it and "curl -d some=data
http://127.0.0.1:8889"
FPC 3.3.1 (latest) Linux x86_64 (Debian 13.5)
Keep up the great work,
Regards,
David
{$mode objfpc}
program server;
uses
sysutils,
strutils,
opensslsockets,
classes,
fphttpserver;
type
meHTTPServer = class( TFPHTTPServer )
procedure handleRequest( var aRequest: TFPHTTPConnectionRequest; var aResponse : TFPHTTPConnectionResponse ); override;
end;
var
serv : meHTTPServer;
procedure meHTTPServer.handleRequest( var aRequest: TFPHTTPConnectionRequest; var aResponse: TFPHTTPConnectionResponse );
begin
writeln( 'Incoming request' );
if( aRequest.contentLength > 0 ) then
begin
writeln( 'I HAVE CONTENT' );
writeln( aRequest.content );
end;
aResponse.content := 'OK';
end;
begin
writeln( 'Starting...' );
serv := meHTTPServer.create( nil );
serv.port := 8889;
try
writeln( 'READY' );
serv.active := true;
except
on e : exception do
begin
writeln( e.message );
halt( 0 );
end;
end;
end._______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel