comparison src/http/ngx_http_core_module.c @ 2205:5398f47082f0

gzip_disable msie6
author Igor Sysoev <igor@sysoev.ru>
date Tue, 26 Aug 2008 15:09:28 +0000
parents 8e5bf1bc87e2
children 109849282793
comparison
equal deleted inserted replaced
2204:70a2bcc7e307 2205:5398f47082f0
1669 { 1669 {
1670 return NGX_DECLINED; 1670 return NGX_DECLINED;
1671 } 1671 }
1672 1672
1673 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1673 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1674
1675 if (r->headers_in.msie6 && clcf->gzip_disable_msie6) {
1676 return NGX_DECLINED;
1677 }
1674 1678
1675 if (r->http_version < clcf->gzip_http_version) { 1679 if (r->http_version < clcf->gzip_http_version) {
1676 return NGX_DECLINED; 1680 return NGX_DECLINED;
1677 } 1681 }
1678 1682
2675 #if (NGX_HTTP_GZIP) 2679 #if (NGX_HTTP_GZIP)
2676 lcf->gzip_vary = NGX_CONF_UNSET; 2680 lcf->gzip_vary = NGX_CONF_UNSET;
2677 lcf->gzip_http_version = NGX_CONF_UNSET_UINT; 2681 lcf->gzip_http_version = NGX_CONF_UNSET_UINT;
2678 #if (NGX_PCRE) 2682 #if (NGX_PCRE)
2679 lcf->gzip_disable = NGX_CONF_UNSET_PTR; 2683 lcf->gzip_disable = NGX_CONF_UNSET_PTR;
2684 lcf->gzip_disable_msie6 = 3;
2680 #endif 2685 #endif
2681 #endif 2686 #endif
2682 2687
2683 return lcf; 2688 return lcf;
2684 } 2689 }
2911 (NGX_CONF_BITMASK_SET|NGX_HTTP_GZIP_PROXIED_OFF)); 2916 (NGX_CONF_BITMASK_SET|NGX_HTTP_GZIP_PROXIED_OFF));
2912 2917
2913 #if (NGX_PCRE) 2918 #if (NGX_PCRE)
2914 ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL); 2919 ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL);
2915 #endif 2920 #endif
2921
2922 if (conf->gzip_disable_msie6 == 3) {
2923 conf->gzip_disable_msie6 =
2924 (prev->gzip_disable_msie6 == 3) ? 0 : prev->gzip_disable_msie6;
2925 }
2916 2926
2917 #endif 2927 #endif
2918 2928
2919 return NGX_CONF_OK; 2929 return NGX_CONF_OK;
2920 } 2930 }
3751 #if (NGX_HTTP_GZIP) 3761 #if (NGX_HTTP_GZIP)
3752 3762
3753 static char * 3763 static char *
3754 ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 3764 ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
3755 { 3765 {
3766 ngx_http_core_loc_conf_t *clcf = conf;
3767
3756 #if (NGX_PCRE) 3768 #if (NGX_PCRE)
3757 ngx_http_core_loc_conf_t *clcf = conf;
3758 3769
3759 ngx_str_t err, *value; 3770 ngx_str_t err, *value;
3760 ngx_uint_t i; 3771 ngx_uint_t i;
3761 ngx_regex_elt_t *re; 3772 ngx_regex_elt_t *re;
3762 u_char errstr[NGX_MAX_CONF_ERRSTR]; 3773 u_char errstr[NGX_MAX_CONF_ERRSTR];
3774 err.len = NGX_MAX_CONF_ERRSTR; 3785 err.len = NGX_MAX_CONF_ERRSTR;
3775 err.data = errstr; 3786 err.data = errstr;
3776 3787
3777 for (i = 1; i < cf->args->nelts; i++) { 3788 for (i = 1; i < cf->args->nelts; i++) {
3778 3789
3790 if (ngx_strcmp(value[1].data, "msie6") == 0) {
3791 clcf->gzip_disable_msie6 = 1;
3792 continue;
3793 }
3794
3779 re = ngx_array_push(clcf->gzip_disable); 3795 re = ngx_array_push(clcf->gzip_disable);
3780 if (re == NULL) { 3796 if (re == NULL) {
3781 return NGX_CONF_ERROR; 3797 return NGX_CONF_ERROR;
3782 } 3798 }
3783 3799
3793 } 3809 }
3794 3810
3795 return NGX_CONF_OK; 3811 return NGX_CONF_OK;
3796 3812
3797 #else 3813 #else
3814 ngx_str_t *value;
3815
3816 value = cf->args->elts;
3817
3818 if (cf->args->nelts == 2 && ngx_strcmp(value[1].data, "msie6") == 0) {
3819 clcf->gzip_disable_msie6 = 1;
3820 return NGX_CONF_OK;
3821 }
3822
3798 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3823 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3799 "\"gzip_disable\" requires PCRE library"); 3824 "without PCRE library \"gzip_disable\" supports "
3825 "builtin \"msie6\" mask only");
3800 3826
3801 return NGX_CONF_ERROR; 3827 return NGX_CONF_ERROR;
3802 #endif 3828 #endif
3803 } 3829 }
3804 3830