mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
LibProtocol+Userland: Support unbuffered protocol requests
LibWeb will need to use unbuffered requests to support server-sent events. Connection for such events remain open and the remote end sends data as HTTP bodies at its leisure. The browser needs to be able to handle this data as it arrives, as the request essentially never finishes. To support this, this make Protocol::Request operate in one of two modes: buffered or unbuffered. The existing mechanism for setting up a buffered request was a bit awkward; you had to set specific callbacks, but be sure not to set some others, and then set a flag. The new mechanism is to set the mode and the callbacks that the mode needs in one API.
This commit is contained in:
committed by
Andreas Kling
parent
086ddd481d
commit
168d28c15f
@@ -97,6 +97,17 @@ RequestManagerQt::Request::Request(QNetworkReply& reply)
|
||||
|
||||
RequestManagerQt::Request::~Request() = default;
|
||||
|
||||
void RequestManagerQt::Request::set_buffered_request_finished_callback(Protocol::Request::BufferedRequestFinished on_buffered_request_finished)
|
||||
{
|
||||
this->on_buffered_request_finish = move(on_buffered_request_finished);
|
||||
}
|
||||
|
||||
void RequestManagerQt::Request::set_unbuffered_request_callbacks(Protocol::Request::HeadersReceived, Protocol::Request::DataReceived, Protocol::Request::RequestFinished on_request_finished)
|
||||
{
|
||||
dbgln("Unbuffered requests are not yet supported with Qt networking");
|
||||
on_request_finished(false, 0);
|
||||
}
|
||||
|
||||
void RequestManagerQt::Request::did_finish()
|
||||
{
|
||||
auto buffer = m_reply.readAll();
|
||||
|
||||
Reference in New Issue
Block a user