Post by Remy Lebeau (TeamB)Post by Philip von MelleThis happens even before I get a shot at the HTTP servers
OnConnect event handler to set the PassThrough property.
This is because PassThrough is set before in DoConnect()
That should be considered a bug then. DoConnect() should not be
forcing SSL on all connections unconditionally, for exactly this
scenerio where a single server uses both SSL and non-SSL ports
together.
It does, depending on the class of AContext.Connection.IOHandler:
procedure TIdCustomHTTPServer.DoConnect(AContext: TIdContext);
begin
if AContext.Connection.IOHandler is TIdSSLIOHandlerSocketBase then
begin
TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThrough:
=false;
end;
inherited DoConnect(AContext);
end;
Post by Remy Lebeau (TeamB)Post by Philip von MelleSo, any way to get thos to work?
Until an official fix can be implemented, you can derive a new
component from TIdHTTPServer and override DoConnect() to not set
PassThrough to False for connections on your non-SSL port.
Deriving a class is difficult here because I would have to break
inheritance. Of course I can derive a class and override DoConnect() and
choose not to call inherited DoConnect(AContext), but then in order to be
able to use the OnConnect() event handler I would have to re-implement
if Assigned(OnConnect) then begin
OnConnect(AContext);
end;
For now, I have chosen to modify Indys source in order to not set
PassThrough unconditionally but set it depending on AContext.Binding.Port
(either 80 or 443) in OnConnect. This works fine and my server now
handles non-SSL and SSL connections equally well. I hope though, an
official fix will be available some time in the future.
BTW, when using SSL in the server I get a memory leak: 2 strings and 1
TIdSSLContext after the first SSL connection. But it does not increase
with more SSL connections luckily.
Regards, Philip