Recent

Author Topic: is it possible for indy10 https to work on port not 443?  (Read 5377 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 15735
  • Censorship about opinions does not belong here.
Re: is it possible for indy10 https to work on port not 443?
« Reply #15 on: September 04, 2019, 08:51:18 am »
If you need the functionality you can use fcl-net and fcl-web from current trunk (note that new code will compile in 3.0.4 as well). That is not Indy, though...but is up to date since a couple of weeks.
« Last Edit: September 04, 2019, 08:54:52 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Michael Collier

  • Sr. Member
  • ****
  • Posts: 323
Re: is it possible for indy10 https to work on port not 443?
« Reply #16 on: September 04, 2019, 10:54:22 pm »
Ok my bad, I was confused by the fact that my raspberry pi works with indy10 SSL albeit only on port 443 and is showing "OpenSSL 1.1.0k  28 May 2019"

I guess the PI has some older libraries on it..

Thanks for help
Mike

Michael Collier

  • Sr. Member
  • ****
  • Posts: 323
Re: is it possible for indy10 https to work on port not 443?
« Reply #17 on: September 04, 2019, 10:55:47 pm »
If you need the functionality you can use fcl-net and fcl-web from current trunk (note that new code will compile in 3.0.4 as well). That is not Indy, though...but is up to date since a couple of weeks.

Thanks I'll give it a go later, I'm updating a WST application that has option to run under indy/synapse so I'm doing them first.

Cheers,
Mike

Sartaj

  • Newbie
  • Posts: 2
Re: is it possible for indy10 https to work on port not 443?
« Reply #18 on: August 12, 2024, 08:29:19 pm »
I faced same issue and found correct answer:- use OnQuerySSLPort handler to enable SSL on non standard port otherwise it will work as HTTP server on non standard port.
procedure TShttpsServer.HandleSslQuery(APort: TIdPort; var VUseSSL: Boolean);
begin
   VUseSSL := True;
   APort := 8080;
end;   

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1408
    • Lebeau Software
Re: is it possible for indy10 https to work on port not 443?
« Reply #19 on: August 12, 2024, 09:10:18 pm »
I faced same issue and found correct answer:- use OnQuerySSLPort handler to enable SSL on non standard port otherwise it will work as HTTP server on non standard port.

That is correct.  The OnQuerySSLPort event tells you which port a client has connected to, and then you return whether that port should use SSL/TLS or not.  TIdHTTPServer will use SSL/TLS on the standard HTTPS port 443 by default, but you need to use the OnQuerySSLPort event to activate SSL/TLS on any other non-standard port.

procedure TShttpsServer.HandleSslQuery(APort: TIdPort; var VUseSSL: Boolean);
begin
   VUseSSL := True;
   APort := 8080;
end;

You are telling the server to use SSL/TLS for all clients unconditionally, regardless of which port each client has connected to.  If you only have HTTPS ports, that's fine.  But if you need to listen on both HTTP and HTTPS ports then your handler needs to look more like this instead:

Code: [Select]
procedure TShttpsServer.HandleSslQuery(APort: TIdPort; var VUseSSL: Boolean);
begin
   VUseSSL := (APort = 8080); // whatever ports your HTTPS bindings are listening on
end;
« Last Edit: August 12, 2024, 09:13:58 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

 

TinyPortal © 2005-2018