fix HTTP response format and improve connection logging

Now curl helps debug invalid requests, hell yeah.
This commit is contained in:
raf 2025-02-05 03:53:18 +03:00
commit e63e463140
No known key found for this signature in database
GPG key ID: EED98D11B85A2819

View file

@ -77,7 +77,13 @@ async fn handle_connection(
}
};
stream.write_all(response.as_bytes()).await?;
let http_response = format!(
"HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n{}",
response.len(),
response
);
stream.write_all(http_response.as_bytes()).await?;
Ok(())
}