Merge branch 'ticket28100_squashed'

This commit is contained in:
Nick Mathewson 2018-11-02 13:19:24 -04:00
commit 865514e66e
2 changed files with 7 additions and 10 deletions

3
changes/ticket28100 Normal file
View File

@ -0,0 +1,3 @@
o Minor features (HTTP standards compliance):
- Don't send Content-Type: application/octet-stream for transparently
compressed documents, which confused browsers. Closes ticket 28100.

View File

@ -166,22 +166,16 @@ write_http_response_header_impl(dir_connection_t *conn, ssize_t length,
buf_free(buf); buf_free(buf);
} }
/** As write_http_response_header_impl, but sets encoding and content-typed /** As write_http_response_header_impl, but translates method into
* based on whether the response will be <b>compressed</b> or not. */ * encoding */
static void static void
write_http_response_headers(dir_connection_t *conn, ssize_t length, write_http_response_headers(dir_connection_t *conn, ssize_t length,
compress_method_t method, compress_method_t method,
const char *extra_headers, long cache_lifetime) const char *extra_headers, long cache_lifetime)
{ {
const char *methodname = compression_method_get_name(method);
const char *doctype;
if (method == NO_METHOD)
doctype = "text/plain";
else
doctype = "application/octet-stream";
write_http_response_header_impl(conn, length, write_http_response_header_impl(conn, length,
doctype, "text/plain",
methodname, compression_method_get_name(method),
extra_headers, extra_headers,
cache_lifetime); cache_lifetime);
} }