Mercurial > hg > nginx-ranges
comparison src/http/ngx_http_core_module.c @ 403:9d81578d04bb NGINX_0_7_11
nginx 0.7.11
*) Change: now ngx_http_charset_module does not work by default with
text/css MIME type.
*) Feature: now nginx returns the 405 status code for POST method
requesting a static file only if the file exists.
*) Feature: the "proxy_ssl_session_reuse" directive.
*) Bugfix: a "proxy_pass" directive without URI part might use original
request after the "X-Accel-Redirect" redirection was used;
*) Bugfix: if a directory has search only rights and the first index
file was absent, then nginx returned the 500 status code.
*) Bugfix: in inclusive locations; the bugs had appeared in 0.7.1.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 18 Aug 2008 00:00:00 +0400 |
parents | 34fb3a573548 |
children | 6ebbca3d5ed7 |
comparison
equal
deleted
inserted
replaced
401:47d42325b5fd | 403:9d81578d04bb |
---|---|
787 r->content_handler = NULL; | 787 r->content_handler = NULL; |
788 r->uri_changed = 0; | 788 r->uri_changed = 0; |
789 | 789 |
790 rc = ngx_http_core_find_location(r); | 790 rc = ngx_http_core_find_location(r); |
791 | 791 |
792 if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) { | 792 if (rc == NGX_ERROR) { |
793 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 793 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
794 return NGX_OK; | 794 return NGX_OK; |
795 } | 795 } |
796 | 796 |
797 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 797 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
1115 r->content_handler = clcf->handler; | 1115 r->content_handler = clcf->handler; |
1116 } | 1116 } |
1117 } | 1117 } |
1118 | 1118 |
1119 | 1119 |
1120 /* | |
1121 * NGX_OK - exact or regex match | |
1122 * NGX_DONE - auto redirect | |
1123 * NGX_AGAIN - inclusive match | |
1124 * NGX_ERROR - regex error | |
1125 * NGX_DECLINED - no match | |
1126 */ | |
1127 | |
1120 static ngx_int_t | 1128 static ngx_int_t |
1121 ngx_http_core_find_location(ngx_http_request_t *r) | 1129 ngx_http_core_find_location(ngx_http_request_t *r) |
1122 { | 1130 { |
1123 ngx_int_t rc; | 1131 ngx_int_t rc; |
1124 ngx_http_core_loc_conf_t *pclcf; | 1132 ngx_http_core_loc_conf_t *pclcf; |
1133 #if (NGX_PCRE) | |
1134 ngx_int_t n; | |
1135 ngx_uint_t noregex; | |
1136 ngx_http_core_loc_conf_t *clcf, **clcfp; | |
1137 | |
1138 noregex = 0; | |
1139 #endif | |
1125 | 1140 |
1126 pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 1141 pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
1127 | 1142 |
1128 rc = ngx_http_core_find_static_location(r, pclcf->static_locations); | 1143 rc = ngx_http_core_find_static_location(r, pclcf->static_locations); |
1129 | 1144 |
1130 if (rc == NGX_AGAIN) { | 1145 if (rc == NGX_AGAIN) { |
1146 | |
1147 #if (NGX_PCRE) | |
1148 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1149 | |
1150 noregex = clcf->noregex; | |
1151 #endif | |
1152 | |
1131 /* look up nested locations */ | 1153 /* look up nested locations */ |
1154 | |
1132 rc = ngx_http_core_find_location(r); | 1155 rc = ngx_http_core_find_location(r); |
1133 } | 1156 } |
1134 | 1157 |
1135 if (rc == NGX_OK || rc == NGX_DONE) { | 1158 if (rc == NGX_OK || rc == NGX_DONE) { |
1136 return rc; | 1159 return rc; |
1137 } | 1160 } |
1138 | 1161 |
1139 /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */ | 1162 /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */ |
1140 | 1163 |
1141 #if (NGX_PCRE) | 1164 #if (NGX_PCRE) |
1142 { | 1165 |
1143 ngx_int_t n; | 1166 if (noregex == 0 && pclcf->regex_locations) { |
1144 ngx_http_core_loc_conf_t *clcf, **clcfp; | |
1145 | |
1146 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1147 | |
1148 if (clcf->noregex == 0 && pclcf->regex_locations) { | |
1149 | 1167 |
1150 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { | 1168 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { |
1151 | 1169 |
1152 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1170 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1153 "test location: ~ \"%V\"", &(*clcfp)->name); | 1171 "test location: ~ \"%V\"", &(*clcfp)->name); |
1161 if (n < 0) { | 1179 if (n < 0) { |
1162 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | 1180 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, |
1163 ngx_regex_exec_n | 1181 ngx_regex_exec_n |
1164 " failed: %d on \"%V\" using \"%V\"", | 1182 " failed: %d on \"%V\" using \"%V\"", |
1165 n, &r->uri, &(*clcfp)->name); | 1183 n, &r->uri, &(*clcfp)->name); |
1166 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 1184 return NGX_ERROR; |
1167 } | 1185 } |
1168 | 1186 |
1169 /* match */ | 1187 /* match */ |
1170 | 1188 |
1171 r->loc_conf = (*clcfp)->loc_conf; | 1189 r->loc_conf = (*clcfp)->loc_conf; |
1172 | 1190 |
1173 /* look up nested locations */ | 1191 /* look up nested locations */ |
1174 | 1192 |
1175 return ngx_http_core_find_location(r); | 1193 rc = ngx_http_core_find_location(r); |
1176 } | 1194 |
1177 } | 1195 return (rc == NGX_ERROR) ? rc : NGX_OK; |
1196 } | |
1178 } | 1197 } |
1179 #endif | 1198 #endif |
1180 | 1199 |
1181 return rc; | 1200 return rc; |
1182 } | 1201 } |