Mercurial > hg > nginx-quic
comparison src/http/ngx_http_core_module.c @ 2404:dca164c4a868
fix segfault if no named location are defined, but are used
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 11 Dec 2008 17:32:52 +0000 |
parents | 2c2b79633ded |
children | 16d1236bc298 |
comparison
equal
deleted
inserted
replaced
2403:5e5caa72f61e | 2404:dca164c4a868 |
---|---|
2015 ngx_http_core_loc_conf_t **clcfp; | 2015 ngx_http_core_loc_conf_t **clcfp; |
2016 ngx_http_core_main_conf_t *cmcf; | 2016 ngx_http_core_main_conf_t *cmcf; |
2017 | 2017 |
2018 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | 2018 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2019 | 2019 |
2020 for (clcfp = cscf->named_locations; *clcfp; clcfp++) { | 2020 if (cscf->named_locations) { |
2021 | 2021 |
2022 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2022 for (clcfp = cscf->named_locations; *clcfp; clcfp++) { |
2023 "test location: \"%V\"", &(*clcfp)->name); | 2023 |
2024 | 2024 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2025 if (name->len != (*clcfp)->name.len | 2025 "test location: \"%V\"", &(*clcfp)->name); |
2026 || ngx_strncmp(name->data, (*clcfp)->name.data, name->len) != 0) | 2026 |
2027 { | 2027 if (name->len != (*clcfp)->name.len |
2028 continue; | 2028 || ngx_strncmp(name->data, (*clcfp)->name.data, name->len) != 0) |
2029 } | 2029 { |
2030 | 2030 continue; |
2031 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2031 } |
2032 "using location: %V \"%V?%V\"", name, &r->uri, &r->args); | 2032 |
2033 | 2033 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2034 r->internal = 1; | 2034 "using location: %V \"%V?%V\"", |
2035 r->content_handler = NULL; | 2035 name, &r->uri, &r->args); |
2036 r->loc_conf = (*clcfp)->loc_conf; | 2036 |
2037 | 2037 r->internal = 1; |
2038 ngx_http_update_location_config(r); | 2038 r->content_handler = NULL; |
2039 | 2039 r->loc_conf = (*clcfp)->loc_conf; |
2040 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); | 2040 |
2041 | 2041 ngx_http_update_location_config(r); |
2042 r->phase_handler = cmcf->phase_engine.location_rewrite_index; | 2042 |
2043 | 2043 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
2044 ngx_http_core_run_phases(r); | 2044 |
2045 | 2045 r->phase_handler = cmcf->phase_engine.location_rewrite_index; |
2046 return NGX_DONE; | 2046 |
2047 ngx_http_core_run_phases(r); | |
2048 | |
2049 return NGX_DONE; | |
2050 } | |
2047 } | 2051 } |
2048 | 2052 |
2049 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 2053 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
2050 "could not find named location \"%V\"", name); | 2054 "could not find named location \"%V\"", name); |
2051 | 2055 |