Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 3441:b0fbe6ab9ebe stable-0.7
merge r3309, r3314, r3315, r3380:
gzip headers related fixes:
*) remove "Content-Encoding: gzip" in 304 response
sent by ngx_http_gzip_static_module
*) refactor gzip_vary handling
*) test r->header_only last, since it's not actually
frequent here: 304 and HEAD responses are not set it before the filter
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 01 Feb 2010 15:54:02 +0000 |
parents | 9ecd253fcc90 |
children | 5d9ff79eab6f |
comparison
equal
deleted
inserted
replaced
3440:88741ec7731a | 3441:b0fbe6ab9ebe |
---|---|
771 if (r->unparsed_uri.len) { | 771 if (r->unparsed_uri.len) { |
772 r->valid_unparsed_uri = 1; | 772 r->valid_unparsed_uri = 1; |
773 } | 773 } |
774 | 774 |
775 r->valid_location = 1; | 775 r->valid_location = 1; |
776 r->gzip = 0; | 776 #if (NGX_HTTP_GZIP) |
777 r->gzip_tested = 0; | |
778 r->gzip_ok = 0; | |
779 r->gzip_vary = 0; | |
780 #endif | |
777 | 781 |
778 r->write_event_handler = ngx_http_core_run_phases; | 782 r->write_event_handler = ngx_http_core_run_phases; |
779 ngx_http_core_run_phases(r); | 783 ngx_http_core_run_phases(r); |
780 } | 784 } |
781 | 785 |
1858 ngx_uint_t p; | 1862 ngx_uint_t p; |
1859 ngx_array_t *cc; | 1863 ngx_array_t *cc; |
1860 ngx_table_elt_t *e, *d; | 1864 ngx_table_elt_t *e, *d; |
1861 ngx_http_core_loc_conf_t *clcf; | 1865 ngx_http_core_loc_conf_t *clcf; |
1862 | 1866 |
1863 if (r->gzip == 1) { | 1867 r->gzip_tested = 1; |
1864 return NGX_OK; | |
1865 } | |
1866 | |
1867 if (r->gzip == 2) { | |
1868 return NGX_DECLINED; | |
1869 } | |
1870 | |
1871 r->gzip = 2; | |
1872 | 1868 |
1873 if (r != r->main | 1869 if (r != r->main |
1874 || r->headers_in.accept_encoding == NULL | 1870 || r->headers_in.accept_encoding == NULL |
1875 || ngx_strcasestrn(r->headers_in.accept_encoding->value.data, | 1871 || ngx_strcasestrn(r->headers_in.accept_encoding->value.data, |
1876 "gzip", 4 - 1) | 1872 "gzip", 4 - 1) |
2001 } | 1997 } |
2002 } | 1998 } |
2003 | 1999 |
2004 #endif | 2000 #endif |
2005 | 2001 |
2006 r->gzip = 1; | 2002 r->gzip_ok = 1; |
2007 | 2003 |
2008 return NGX_OK; | 2004 return NGX_OK; |
2009 } | 2005 } |
2010 | 2006 |
2011 #endif | 2007 #endif |