Hi,
This is a continuation of THttpServer serve big binary files (bigger than RAM) on the fly (or CGI?) - ROOT - ROOT Forum (which is closed and cannot be replied to).
With handling a HTTP request withTHttpCallArg
(for example by overriding MissedRequest
) can we set a response binary content with SetBinaryContent (std::string), send it to client, but then don’t close the request. Then we should be able to do another SetBinaryContent
to send another chunk, etc.
This would allow lots of streamed applications.
How complex would it be to allow this? Would this require a lot of modifications in THttpServer or just a few lines to authorize this?
Maybe just one small function that would do the flush()
(i.e. send the current response body to client but don’t close connection), which is surely alreay available in CivetWeb? If so, could we expose this function public in THttpServer?
Maybe @linev knows about this?
I am very interested as it would be useful for a current work-in-progress.
Have a good day!
PS: pseudo code:
void MyServer::MissedRequest(THttpCallArg \*arg) {
// set Transfer-Encoding: chunked or https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Transfer-Encoding#directives ) or any other mean
arg->SetBinaryContent(part1);
arg->Flush_Send_Response(); // the data is sent to client but the connection is not closed,
arg->SetBinaryContent(chunk2);
arg->Flush_Send_Response();
...
}