HTTPS: Handle the HTTP request
Request processing starts as soon as the headers of the request are received. Your code is notified about this via OnRequestHeadersReceived event. The handler of this event receives an instance of TElHTTPServerRequestParams class, which can be used to analyze incoming HTTP headers, the request URL, HTTP request method and other parameters.
If the HTTP method implies the data to be expected from the client (eg. POST or PUT request, and/or Content-Length header, sent by the client, contains a non-zero data length), you don't start responding to the request unless 'Expect: 100-Continue' header has been received (in which case you need to respond with "100 Continue" response and then wait for the data). The incoming data will be provided to your code via OnData event, block by block. You can store the data in memory or in a temporary cache. Once the data transfer is done, OnRequestBodyReceived event is fired. Then you definitely can start handling the request and sending a response.
You handle the request by analyzing the request headers and data, then creating response headers and (optionally) data, and sending them back to the client.
After anaylyzing the request you create and send the response.