Hi,

if something writes to an already closed socket, it triggers a SIGPIPE in the default settings, which kills the program.

On Linux, the MSG_NOSIGNAL flag needs to be set on each write and then the SIGPIPE is not triggered. Synapse seems to set that flag on every write, so HTTP has always worked well for me. And its default setting uses HTTP1.0, where Synapse closes the connection immediately before the server can close it.

However, OpenSSL does not seem to set the flag for write, so HTTPS 1.1 crashes whenever the server closes the connection.

For example, this program crashes:

uses sysutils,httpsend,ssl_openssl,ssl_openssl_lib;
var
  h: THTTPSend;
begin
  h := THTTPSend.Create;
  h.Protocol:='1.1';
  writeln('a');
  h.HTTPMethod('GET', 'https://www.voebb.de');
  writeln('b');
  Sleep(6*60*1000);
  writeln('c');
  h.HTTPMethod('GET', 'https://www.voebb.de');
  writeln('d');

end.


How can this be fixed without a global signal handler?



Cheers,
Benito


_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to