diff src/http/ngx_http_core_module.c @ 554:5c576ea5dbd9 NGINX_0_8_29

nginx 0.8.29 *) Change: now the "009" status code is written to an access log for proxied HTTP/0.9 responses. *) Feature: the "addition_types", "charset_types", "gzip_types", "ssi_types", "sub_filter_types", and "xslt_types" directives support an "*" parameter. *) Feature: GCC 4.1+ built-in atomic operations usage. Thanks to W-Mark Kubacki. *) Feature: the --with-libatomic[=DIR] option in the configure. Thanks to W-Mark Kubacki. *) Bugfix: listen unix domain socket had limited access rights. *) Bugfix: cached HTTP/0.9 responses were handled incorrectly. *) Bugfix: regular expression named captures given by "?P<...>" did not work in a "server_name" directive. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Nov 2009 00:00:00 +0300
parents ab7d265273ed
children 25255878df91
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1572,6 +1572,10 @@ ngx_http_test_content_type(ngx_http_requ
     size_t      len;
     ngx_uint_t  i, hash;
 
+    if (types_hash->size == 0) {
+        return (void *) 4;
+    }
+
     if (r->headers_out.content_type.len == 0) {
         return NULL;
     }
@@ -3507,16 +3511,16 @@ ngx_http_core_server_name(ngx_conf_t *cf
         sn->server = cscf;
         sn->name = value[i];
 
-        ngx_strlow(sn->name.data, sn->name.data, sn->name.len);
-
         if (value[i].data[0] != '~') {
+            ngx_strlow(sn->name.data, sn->name.data, sn->name.len);
             continue;
         }
 
 #if (NGX_PCRE)
         {
-        ngx_regex_compile_t  rc;
-        u_char               errstr[NGX_MAX_CONF_ERRSTR];
+        u_char               *p;
+        ngx_regex_compile_t   rc;
+        u_char                errstr[NGX_MAX_CONF_ERRSTR];
 
         if (value[i].len == 1) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -3533,6 +3537,13 @@ ngx_http_core_server_name(ngx_conf_t *cf
         rc.err.len = NGX_MAX_CONF_ERRSTR;
         rc.err.data = errstr;
 
+        for (p = value[i].data; p < value[i].data + value[i].len; p++) {
+            if (*p >= 'A' && *p <= 'Z') {
+                rc.options = NGX_REGEX_CASELESS;
+                break;
+            }
+        }
+
         sn->regex = ngx_http_regex_compile(cf, &rc);
         if (sn->regex == NULL) {
             return NGX_CONF_ERROR;