Is it possible? Yes. However, TIdHTTPServer
in Indy 9 only parses HEAD
, GET
and POST
requests, and only if the OnCommandGet
event is assigned. If the OnCommandGet
event is not assigned, or a different request is received, TIdHTTPServer
DOES NOT parse the request at all (except for the first line to determine the request type), and triggers the OnCommandOther
event instead. As you noticed, there are no TIdHTTPRequestInfo
and TIdHTTPResponseInfo
parameters provided in that event, so you have to manually read and parse the entire request yourself, and send an appropriate reply yourself, using AThread.Connection
to perform socket I/O as needed. Read RFC 2616 for the HTTP specificiation.
This was changed in Indy 10, where TIdHTTPServer
DOES handle all of the parsing, replying, and socket I/O for you, and all of the OnCommand...
events have TIdHTTPRequestInfo
and TIdHTTPResponseInfo
parameters.
In a future release (most likely not until Indy 11), new OnCommand...
events will be added for individual requests (OnCommandPut
, OnCommandDelete
, etc) so they don't all have to funnel through OnCommandGet
or OnCommandOther
anymore.