WebServer: Use fallible version of StringBuilder::to_byte_buffer
This commit is contained in:
parent
fc4d37eea5
commit
7d412983a8
Notes:
sideshowbarker
2024-07-16 23:08:49 +09:00
Author: https://github.com/karolba Commit: https://github.com/SerenityOS/serenity/commit/7d412983a8 Pull-request: https://github.com/SerenityOS/serenity/pull/17746 Reviewed-by: https://github.com/kleinesfilmroellchen ✅ Reviewed-by: https://github.com/linusg
1 changed files with 4 additions and 4 deletions
|
@ -191,7 +191,7 @@ ErrorOr<void> Client::send_response(Stream& response, HTTP::HttpRequest const& r
|
|||
builder.appendff("Content-Length: {}\r\n", content_info.length);
|
||||
builder.append("\r\n"sv);
|
||||
|
||||
auto builder_contents = builder.to_byte_buffer();
|
||||
auto builder_contents = TRY(builder.try_to_byte_buffer());
|
||||
TRY(m_socket->write(builder_contents));
|
||||
log_response(200, request);
|
||||
|
||||
|
@ -233,7 +233,7 @@ ErrorOr<void> Client::send_redirect(StringView redirect_path, HTTP::HttpRequest
|
|||
builder.append("\r\n"sv);
|
||||
builder.append("\r\n"sv);
|
||||
|
||||
auto builder_contents = builder.to_byte_buffer();
|
||||
auto builder_contents = TRY(builder.try_to_byte_buffer());
|
||||
TRY(m_socket->write(builder_contents));
|
||||
|
||||
log_response(301, request);
|
||||
|
@ -363,8 +363,8 @@ ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const
|
|||
header_builder.append("Content-Type: text/html; charset=UTF-8\r\n"sv);
|
||||
header_builder.appendff("Content-Length: {}\r\n", content_builder.length());
|
||||
header_builder.append("\r\n"sv);
|
||||
TRY(m_socket->write(header_builder.to_byte_buffer()));
|
||||
TRY(m_socket->write(content_builder.to_byte_buffer()));
|
||||
TRY(m_socket->write(TRY(header_builder.try_to_byte_buffer())));
|
||||
TRY(m_socket->write(TRY(content_builder.try_to_byte_buffer())));
|
||||
|
||||
log_response(code, request);
|
||||
return {};
|
||||
|
|
Loading…
Add table
Reference in a new issue