TROWinHttpServer - share same port / allow multiple URLs


(Anachronox) #1

Hello.

As we need to use multiple instances (URLs) of our service on the same port, we’ve created our own classes like this (to use it as RO component replacement):

TAbWinHttpServer = class(TROBaseHTTPServer)
instead of TROWinHttpServer = class(TROBaseHTTPServer)

TAbWinHttpWorker = class(TInterfacedObject, IROThreadPoolCallback, IROTransport,
IROTCPTransport, IROHTTPTransport, IROHTTPTransportEx)
instead of TROWinHttpWorker = class(TInterfacedObject, IROThreadPoolCallback, IROTransport,
IROTCPTransport, IROHTTPTransport, IROHTTPTransportEx)

to implement such functionality.

For example, this is our GetLocation implementation:

function TAbWinHttpWorker.GetLocation: String;
begin
if fOwner.Path <> ‘’ then
Result := fContext.Request.Location + ‘/’ + fOwner.Path
else
Result := fContext.Request.Location;
if fOwner.Secured then
Result := StringReplace(Result, id_http, id_https, [rfIgnoreCase]);
end;

But it is real pain to maintain such unit after each RO upgrade/update.

I’d love to see the RO will include our “hacks” to the standard code.

I can send our complete unit to inspection.

Thank you in advance!


(EvgenyK) #3

you can drop your changes to support@ . we will review them