Browse Source

[mod_deflate] quicker check for Content-Encoding

The response is not a candidate for mod_deflate if
Content-Encoding was already set by something else.
master
Glenn Strauss 11 months ago
parent
commit
4b755d2b03
  1. 5
      src/mod_deflate.c

5
src/mod_deflate.c

@ -1385,6 +1385,7 @@ REQUEST_FUNC(mod_deflate_handle_response_start) {
if (!r->resp_body_finished) return HANDLER_GO_ON;
if (r->http_method == HTTP_METHOD_HEAD) return HANDLER_GO_ON;
if (r->resp_htags & HTTP_HEADER_TRANSFER_ENCODING) return HANDLER_GO_ON;
if (r->resp_htags & HTTP_HEADER_CONTENT_ENCODING) return HANDLER_GO_ON;
/* disable compression for some http status types. */
switch(r->http_status) {
@ -1413,10 +1414,6 @@ REQUEST_FUNC(mod_deflate_handle_response_start) {
return HANDLER_GO_ON;
}
/* Check if response has a Content-Encoding. */
vbro = http_header_response_get(r, HTTP_HEADER_CONTENT_ENCODING, CONST_STR_LEN("Content-Encoding"));
if (NULL != vbro) return HANDLER_GO_ON;
/* Check Accept-Encoding for supported encoding. */
vbro = http_header_request_get(r, HTTP_HEADER_ACCEPT_ENCODING, CONST_STR_LEN("Accept-Encoding"));
if (NULL == vbro) return HANDLER_GO_ON;

Loading…
Cancel
Save