Mercurial > hg > nginx-quic
diff src/http/ngx_http_core_module.c @ 210:00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 14 Dec 2003 20:10:27 +0000 |
parents | 0b67be7d4489 |
children | fd9fecc4193f |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -407,14 +407,17 @@ int ngx_http_find_location_config(ngx_ht clcfp = cscf->locations.elts; for (i = 0; i < cscf->locations.nelts; i++) { -#if 1 -ngx_log_debug(r->connection->log, "trans: %s: %d" _ - clcfp[i]->name.data _ clcfp[i]->exact_match); -#endif +#if (HAVE_PCRE) if (clcfp[i]->regex) { break; } +#endif + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "find location: %s\"%s\"", + clcfp[i]->exact_match ? "= " : "", + clcfp[i]->name.data); if (clcfp[i]->auto_redirect && r->uri.len == clcfp[i]->name.len - 1 @@ -449,20 +452,23 @@ ngx_log_debug(r->connection->log, "trans } } +#if (HAVE_PCRE) + if (!exact && !auto_redirect) { /* regex matches */ for (/* void */; i < cscf->locations.nelts; i++) { -#if 1 -ngx_log_debug(r->connection->log, "trans: %s: %d" _ - clcfp[i]->name.data _ clcfp[i]->exact_match); -#endif - if (!clcfp[i]->regex) { continue; } + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "find location: %s\"%s\"", + clcfp[i]->exact_match ? "= " : + clcfp[i]->regex ? "~ " : "", + clcfp[i]->name.data); + rc = ngx_regex_exec(clcfp[i]->regex, &r->uri); if (rc == NGX_DECLINED) { @@ -488,6 +494,8 @@ ngx_log_debug(r->connection->log, "trans } } +#endif /* HAVE_PCRE */ + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); if (!(ngx_io.flags & NGX_IO_SENDFILE) || !clcf->sendfile) { @@ -504,10 +512,6 @@ ngx_log_debug(r->connection->log, "trans return NGX_HTTP_INTERNAL_SERVER_ERROR; } -#if 0 - r->headers_out.location->key.len = 8; - r->headers_out.location->key.data = "Location"; -#endif r->headers_out.location->value = *auto_redirect; return NGX_HTTP_MOVED_PERMANENTLY; @@ -614,7 +618,8 @@ int ngx_http_internal_redirect(ngx_http_ { int i; - ngx_log_debug(r->connection->log, "internal redirect: '%s'" _ uri->data); + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "internal redirect: \"%s\"", uri->data); r->uri.len = uri->len; r->uri.data = uri->data; @@ -798,6 +803,8 @@ static int ngx_cmp_locations(const void ngx_int_t rc; +#if (HAVE_PCRE) + if (first->regex && !second->regex) { /* shift regex matches to the end */ return 1; @@ -808,6 +815,8 @@ static int ngx_cmp_locations(const void return 0; } +#endif + rc = ngx_strcmp(first->name.data, second->name.data); if (rc == 0 && second->exact_match) { @@ -876,6 +885,7 @@ static char *ngx_location_block(ngx_conf && value[1].data[0] == '~' && value[1].data[1] == '*')) { +#if (HAVE_PCRE) err.len = NGX_MAX_CONF_ERRSTR; err.data = errstr; @@ -890,6 +900,13 @@ static char *ngx_location_block(ngx_conf clcf->name.len = value[2].len; clcf->name.data = value[2].data; +#else + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "the using of the regex \"%s\" " + "requires PCRE library", + value[2].data); + return NGX_CONF_ERROR; +#endif } else { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,