comparison src/http/ngx_http_core_module.c @ 2186:ecce31d90117

*) regex match must return NGX_OK to stop regex searching, this fixes inclusive regex location *) change NGX_HTTP_INTERNAL_SERVER_ERROR to NGX_ERROR
author Igor Sysoev <igor@sysoev.ru>
date Sun, 17 Aug 2008 18:02:55 +0000
parents e9420c1b6f25
children a953f73273ee
comparison
equal deleted inserted replaced
2185:e9420c1b6f25 2186:ecce31d90117
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;
1171 if (n < 0) { 1179 if (n < 0) {
1172 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 1180 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1173 ngx_regex_exec_n 1181 ngx_regex_exec_n
1174 " failed: %d on \"%V\" using \"%V\"", 1182 " failed: %d on \"%V\" using \"%V\"",
1175 n, &r->uri, &(*clcfp)->name); 1183 n, &r->uri, &(*clcfp)->name);
1176 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1184 return NGX_ERROR;
1177 } 1185 }
1178 1186
1179 /* match */ 1187 /* match */
1180 1188
1181 r->loc_conf = (*clcfp)->loc_conf; 1189 r->loc_conf = (*clcfp)->loc_conf;
1182 1190
1183 /* look up nested locations */ 1191 /* look up nested locations */
1184 1192
1185 return ngx_http_core_find_location(r); 1193 rc = ngx_http_core_find_location(r);
1194
1195 return (rc == NGX_ERROR) ? rc : NGX_OK;
1186 } 1196 }
1187 } 1197 }
1188 #endif 1198 #endif
1189 1199
1190 return rc; 1200 return rc;