diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2018-10-19 09:53:23 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-11-02 13:19:14 -0400 |
commit | 1b75de85b3cbc7706078a9899e483d18579a6fd1 (patch) | |
tree | d61e9d4ddf411bdf32a8b08f9aae60b3e1d51932 | |
parent | 52a82bc53c82c82f754c1267aaa68b48737ba07c (diff) | |
download | tor-1b75de85b3cbc7706078a9899e483d18579a6fd1.tar.gz tor-1b75de85b3cbc7706078a9899e483d18579a6fd1.zip |
Don't overwrite the Content-Type when compressing
-rw-r--r-- | changes/ticket28100 | 3 | ||||
-rw-r--r-- | src/feature/dircache/dircache.c | 14 |
2 files changed, 7 insertions, 10 deletions
diff --git a/changes/ticket28100 b/changes/ticket28100 new file mode 100644 index 0000000000..b8e3271013 --- /dev/null +++ b/changes/ticket28100 @@ -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. diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c index 872a88018f..dff4b85caa 100644 --- a/src/feature/dircache/dircache.c +++ b/src/feature/dircache/dircache.c @@ -166,22 +166,16 @@ write_http_response_header_impl(dir_connection_t *conn, ssize_t length, buf_free(buf); } -/** As write_http_response_header_impl, but sets encoding and content-typed - * based on whether the response will be <b>compressed</b> or not. */ +/** As write_http_response_header_impl, but translates method into + * encoding */ static void write_http_response_headers(dir_connection_t *conn, ssize_t length, compress_method_t method, 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, - doctype, - methodname, + "text/plain", + compression_method_get_name(method), extra_headers, cache_lifetime); } |