mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +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
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