comparison src/http/ngx_http_core_module.c @ 3313:118169a8ec92

refactor gzip_vary handling
author Igor Sysoev <igor@sysoev.ru>
date Thu, 12 Nov 2009 13:41:56 +0000
parents e9c0fae6be1e
children 48402deff89a
comparison
equal deleted inserted replaced
3312:dddca6f42e7b 3313:118169a8ec92
810 if (r->unparsed_uri.len) { 810 if (r->unparsed_uri.len) {
811 r->valid_unparsed_uri = 1; 811 r->valid_unparsed_uri = 1;
812 } 812 }
813 813
814 r->valid_location = 1; 814 r->valid_location = 1;
815 r->gzip = 0; 815 #if (NGX_HTTP_GZIP)
816 r->gzip_tested = 0;
817 r->gzip_ok = 0;
818 r->gzip_vary = 0;
819 #endif
816 820
817 r->write_event_handler = ngx_http_core_run_phases; 821 r->write_event_handler = ngx_http_core_run_phases;
818 ngx_http_core_run_phases(r); 822 ngx_http_core_run_phases(r);
819 } 823 }
820 824
1889 ngx_uint_t p; 1893 ngx_uint_t p;
1890 ngx_array_t *cc; 1894 ngx_array_t *cc;
1891 ngx_table_elt_t *e, *d; 1895 ngx_table_elt_t *e, *d;
1892 ngx_http_core_loc_conf_t *clcf; 1896 ngx_http_core_loc_conf_t *clcf;
1893 1897
1894 if (r->gzip == 1) { 1898 r->gzip_tested = 1;
1895 return NGX_OK;
1896 }
1897
1898 if (r->gzip == 2) {
1899 return NGX_DECLINED;
1900 }
1901
1902 r->gzip = 2;
1903 1899
1904 if (r != r->main 1900 if (r != r->main
1905 || r->headers_in.accept_encoding == NULL 1901 || r->headers_in.accept_encoding == NULL
1906 || ngx_strcasestrn(r->headers_in.accept_encoding->value.data, 1902 || ngx_strcasestrn(r->headers_in.accept_encoding->value.data,
1907 "gzip", 4 - 1) 1903 "gzip", 4 - 1)
2032 } 2028 }
2033 } 2029 }
2034 2030
2035 #endif 2031 #endif
2036 2032
2037 r->gzip = 1; 2033 r->gzip_ok = 1;
2038 2034
2039 return NGX_OK; 2035 return NGX_OK;
2040 } 2036 }
2041 2037
2042 #endif 2038 #endif