server: explain why Content-Length is needed

This commit is contained in:
Peter Cai 2021-04-06 08:29:16 +08:00
parent 7bc00c3da7
commit 079b05ce06
1 changed files with 1 additions and 0 deletions

View File

@ -104,6 +104,7 @@ impl Server {
err_response!(resp_headers
.append("Content-Type", resp_content_type)
.map_err(|_| "Could not create headers".to_string()));
// Content-Length is needed in case the DNS message itself contained end-of-string or end-of-line
err_response!(resp_headers
.append("Content-Length", &resp_body.len().to_string())
.map_err(|_| "Could not create headers".to_string()));