From 7bc47ab93f39f3f061e4b3218e6d78455dd8cb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 2 Jul 2020 22:56:24 +0200 Subject: [PATCH] aquatic_http: microoptimize EstablishedConnection --- aquatic_http/src/lib/network/connection.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aquatic_http/src/lib/network/connection.rs b/aquatic_http/src/lib/network/connection.rs index 83a791a..13d9569 100644 --- a/aquatic_http/src/lib/network/connection.rs +++ b/aquatic_http/src/lib/network/connection.rs @@ -95,8 +95,7 @@ impl EstablishedConnection { pub fn send_response(&mut self, body: &[u8]) -> ::std::io::Result<()> { let mut response = Vec::new(); - response.extend_from_slice(b"HTTP/1.1 200 OK\r\n"); - response.extend_from_slice(b"Content-Length: "); + response.extend_from_slice(b"HTTP/1.1 200 OK\r\nContent-Length: "); response.extend_from_slice(format!("{}", body.len() + 2).as_bytes()); response.extend_from_slice(b"\r\n\r\n"); response.extend_from_slice(body);