Implementing an HTTP Server

Hi,

Is there a guide for creating an RO http server with a different framework other than those you already have implemented? I was looking uIPAsyncHttpServer.pas and uROIndyHTTPServer.pas and it’s a bit confusing what must be implemented. I know my new class must inherit from TROBaseHTTPServer. Which of the two is better to follow when I have a custom finished http server that is also multi-threaded and a thread pool is not actually needed.

Thank you,
Chris

Hi,

You can use Indy based version as a guide because it is more simple
in general, you should create creating a descendant of TROBaseHTTPServer and assign event handler to native server component like

fIndyServer.OnCommandGet := InternalServerCommandGet;

in this event you should call ProcessRequest and later assign some properties back.

Hi,
thank you for your reply.

So just to be clear, I need to create an equivalent TIndyHTTPTransport class?
And when ProcessRequest returns the properties you refer to that must be assigned
are
ResponseInfo.ContentType
ResponseInfo.ResponseNo
ResponseInfo.ResponseText
ResponseInfo.CustomHeaders.Values[lName]
ResponseInfo.ContentStream
for the equivalent TIdHTTPResponseInfo of the framework I’m using?

Chris

Hi,

You are right. You should create a some kind of wrapper that allow to read & write properties of request & response via known RO interfaces

Hi,

thank you for your reply.
I have already finished it and it works fine :slight_smile: .

Thank you again for your help.
Chris

1 Like

Cool!