diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-09 12:41:21 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-09 14:15:55 +0100 |
commit | 80703ef7d91708e5f6220986f7a2a8197a1afba3 (patch) | |
tree | 58140c2e60b84354f699e8aa403f538a40b8e068 /Servers/WebServer | |
parent | efb694ecad3ee83d013794f3de66eae625c49f88 (diff) | |
download | serenity-80703ef7d91708e5f6220986f7a2a8197a1afba3.zip |
WebServer: Send the HTTP response headers in a single packet
This makes it easier to observe the protocol in packet logs.
Diffstat (limited to 'Servers/WebServer')
-rw-r--r-- | Servers/WebServer/Client.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Servers/WebServer/Client.cpp b/Servers/WebServer/Client.cpp index 90f9eeeb6d..149a12dce8 100644 --- a/Servers/WebServer/Client.cpp +++ b/Servers/WebServer/Client.cpp @@ -68,11 +68,13 @@ void Client::handle_request(ByteBuffer raw_request) return; } - m_socket->write("HTTP/1.0 200 OK\r\n"); - m_socket->write("Server: WebServer (SerenityOS)\r\n"); - m_socket->write("Content-Type: text/html\r\n"); - m_socket->write("\r\n"); + StringBuilder builder; + builder.append("HTTP/1.0 200 OK\r\n"); + builder.append("Server: WebServer (SerenityOS)\r\n"); + builder.append("Content-Type: text/html\r\n"); + builder.append("\r\n"); + m_socket->write(builder.to_string()); m_socket->write(file->read_all()); log_response(200, request); |