mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +00:00
WebContent: Support sending large responses to the WebDriver client
Some endpoints, like /session/{id}/screenshot, will require sending large data to the client. We won't be able to write all of the data in one shot, so loop over the data until we've sent it all (or fail).
This commit is contained in:
parent
63c459b6c1
commit
819598aecf
Notes:
sideshowbarker
2024-07-17 22:01:16 +09:00
Author: https://github.com/trflynn89
Commit: 819598aecf
Pull-request: https://github.com/SerenityOS/serenity/pull/15890
Reviewed-by: https://github.com/linusg
1 changed files with 6 additions and 1 deletions
|
@ -197,7 +197,12 @@ ErrorOr<void> Client::send_response(StringView content, HTTP::HttpRequest const&
|
|||
|
||||
auto builder_contents = builder.to_byte_buffer();
|
||||
TRY(m_socket->write(builder_contents));
|
||||
TRY(m_socket->write(content.bytes()));
|
||||
|
||||
while (!content.is_empty()) {
|
||||
auto bytes_sent = TRY(m_socket->write(content.bytes()));
|
||||
content = content.substring_view(bytes_sent);
|
||||
}
|
||||
|
||||
log_response(200, request);
|
||||
|
||||
auto keep_alive = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue