comparison src/http/ngx_http_core_module.c @ 508:4b0d7f0bf22b NGINX_0_8_6

nginx 0.8.6 *) Feature: the ngx_http_geoip_module. *) Bugfix: XSLT filter may fail with message "not well formed XML document" for valid XML document. Thanks to Kuramoto Eiji. *) Bugfix: now in MacOSX, Cygwin, and nginx/Windows locations given by a regular expression are always tested in case insensitive mode; *) Bugfix: now nginx/Windows ignores trailing dots in URI. Thanks to Hugo Leisink. *) Bugfix: name of file specified in --conf-path was not honored during installation; the bug had appeared in 0.6.6. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 20 Jul 2009 00:00:00 +0400
parents f39b9e29530d
children 86dad910eeb6
comparison
equal deleted inserted replaced
507:0001f4fa0501 508:4b0d7f0bf22b
1226 1226
1227 p = ngx_copy(r->uri.data, clcf->name.data, alias); 1227 p = ngx_copy(r->uri.data, clcf->name.data, alias);
1228 ngx_memcpy(p, name, path.len); 1228 ngx_memcpy(p, name, path.len);
1229 } 1229 }
1230 1230
1231 if (ngx_http_set_exten(r) != NGX_OK) { 1231 ngx_http_set_exten(r);
1232 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1233 return NGX_OK;
1234 }
1235 1232
1236 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1233 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1237 "try file uri: \"%V\"", &r->uri); 1234 "try file uri: \"%V\"", &r->uri);
1238 1235
1239 r->phase_handler++; 1236 r->phase_handler++;
1639 1636
1640 return NGX_OK; 1637 return NGX_OK;
1641 } 1638 }
1642 1639
1643 1640
1644 ngx_int_t 1641 void
1645 ngx_http_set_exten(ngx_http_request_t *r) 1642 ngx_http_set_exten(ngx_http_request_t *r)
1646 { 1643 {
1647 ngx_int_t i; 1644 ngx_int_t i;
1648 1645
1649 r->exten.len = 0; 1646 r->exten.len = 0;
1653 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { 1650 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
1654 1651
1655 r->exten.len = r->uri.len - i - 1; 1652 r->exten.len = r->uri.len - i - 1;
1656 r->exten.data = &r->uri.data[i + 1]; 1653 r->exten.data = &r->uri.data[i + 1];
1657 1654
1658 break; 1655 return;
1659 1656
1660 } else if (r->uri.data[i] == '/') { 1657 } else if (r->uri.data[i] == '/') {
1661 break; 1658 return;
1662 } 1659 }
1663 } 1660 }
1664 1661
1665 return NGX_OK; 1662 return;
1666 } 1663 }
1667 1664
1668 1665
1669 ngx_int_t 1666 ngx_int_t
1670 ngx_http_send_header(ngx_http_request_t *r) 1667 ngx_http_send_header(ngx_http_request_t *r)
2085 2082
2086 sr->unparsed_uri = r->unparsed_uri; 2083 sr->unparsed_uri = r->unparsed_uri;
2087 sr->method_name = ngx_http_core_get_method; 2084 sr->method_name = ngx_http_core_get_method;
2088 sr->http_protocol = r->http_protocol; 2085 sr->http_protocol = r->http_protocol;
2089 2086
2090 if (ngx_http_set_exten(sr) != NGX_OK) { 2087 ngx_http_set_exten(sr);
2091 return NGX_ERROR;
2092 }
2093 2088
2094 sr->main = r->main; 2089 sr->main = r->main;
2095 sr->parent = r; 2090 sr->parent = r;
2096 sr->post_subrequest = ps; 2091 sr->post_subrequest = ps;
2097 sr->read_event_handler = ngx_http_request_empty_handler; 2092 sr->read_event_handler = ngx_http_request_empty_handler;
2166 } 2161 }
2167 2162
2168 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2163 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2169 "internal redirect: \"%V?%V\"", uri, &r->args); 2164 "internal redirect: \"%V?%V\"", uri, &r->args);
2170 2165
2171 if (ngx_http_set_exten(r) != NGX_OK) { 2166 ngx_http_set_exten(r);
2172 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
2173 return NGX_DONE;
2174 }
2175 2167
2176 /* clear the modules contexts */ 2168 /* clear the modules contexts */
2177 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); 2169 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
2178 2170
2179 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 2171 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
2571 ngx_str_t err; 2563 ngx_str_t err;
2572 u_char errstr[NGX_MAX_CONF_ERRSTR]; 2564 u_char errstr[NGX_MAX_CONF_ERRSTR];
2573 2565
2574 err.len = NGX_MAX_CONF_ERRSTR; 2566 err.len = NGX_MAX_CONF_ERRSTR;
2575 err.data = errstr; 2567 err.data = errstr;
2568
2569 #if (NGX_HAVE_CASELESS_FILESYSTEM)
2570 caseless = 1;
2571 #endif
2576 2572
2577 clcf->regex = ngx_regex_compile(regex, caseless ? NGX_REGEX_CASELESS: 0, 2573 clcf->regex = ngx_regex_compile(regex, caseless ? NGX_REGEX_CASELESS: 0,
2578 cf->pool, &err); 2574 cf->pool, &err);
2579 2575
2580 if (clcf->regex == NULL) { 2576 if (clcf->regex == NULL) {