comparison src/http/ngx_http_core_module.c @ 460:bb941a2996a6 NGINX_0_7_42

nginx 0.7.42 *) Change: now the "Invalid argument" error returned by setsockopt(TCP_NODELAY) on Solaris, is ignored. *) Change: now if a file specified in a "auth_basic_user_file" directive is absent, then the 405 error is returned instead of the 500 one. *) Feature: the "auth_basic_user_file" directive supports variables. Thanks to Kirill A. Korinskiy. *) Feature: the "listen" directive supports the "ipv6only" parameter. Thanks to Zhang Hua. *) Bugfix: in an "alias" directive with references to captures of regular expressions; the bug had appeared in 0.7.40. *) Bugfix: compatibility with Tru64 UNIX. Thanks to Dustin Marquess. *) Bugfix: nginx could not be built without PCRE library; the bug had appeared in 0.7.41.
author Igor Sysoev <http://sysoev.ru>
date Mon, 16 Mar 2009 00:00:00 +0300
parents 2e2b57743e87
children dcb6b5f9d526
comparison
equal deleted inserted replaced
459:6ef558ffc0eb 460:bb941a2996a6
1120 code((ngx_http_script_engine_t *) &e); 1120 code((ngx_http_script_engine_t *) &e);
1121 } 1121 }
1122 1122
1123 path.len = e.pos - path.data; 1123 path.len = e.pos - path.data;
1124 1124
1125 *e.pos++ = '\0'; 1125 *e.pos = '\0';
1126 1126
1127 if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) { 1127 if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
1128 ngx_memcpy(name, name + alias, len - alias); 1128 ngx_memcpy(name, name + alias, len - alias);
1129 path.len -= alias; 1129 path.len -= alias;
1130 } 1130 }
1376 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { 1376 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) {
1377 1377
1378 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1378 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1379 "test location: ~ \"%V\"", &(*clcfp)->name); 1379 "test location: ~ \"%V\"", &(*clcfp)->name);
1380 1380
1381 if ((*clcfp)->captures && r->captures == NULL) { 1381 if ((*clcfp)->captures) {
1382 1382
1383 len = (NGX_HTTP_MAX_CAPTURES + 1) * 3; 1383 len = (NGX_HTTP_MAX_CAPTURES + 1) * 3;
1384 1384
1385 r->captures = ngx_palloc(r->pool, len * sizeof(int));
1386 if (r->captures == NULL) { 1385 if (r->captures == NULL) {
1387 return NGX_ERROR; 1386 r->captures = ngx_palloc(r->pool, len * sizeof(int));
1387 if (r->captures == NULL) {
1388 return NGX_ERROR;
1389 }
1388 } 1390 }
1389 } 1391 }
1390 1392
1391 n = ngx_regex_exec((*clcfp)->regex, &r->uri, r->captures, len); 1393 n = ngx_regex_exec((*clcfp)->regex, &r->uri, r->captures, len);
1392 1394
1670 "\"alias\" could not be used in location \"%V\" " 1672 "\"alias\" could not be used in location \"%V\" "
1671 "where URI was rewritten", &clcf->name); 1673 "where URI was rewritten", &clcf->name);
1672 return NULL; 1674 return NULL;
1673 } 1675 }
1674 1676
1675 reserved += r->uri.len - alias + 1;
1676
1677 if (clcf->root_lengths == NULL) { 1677 if (clcf->root_lengths == NULL) {
1678 1678
1679 *root_length = clcf->root.len; 1679 *root_length = clcf->root.len;
1680 1680
1681 path->len = clcf->root.len + reserved; 1681 path->len = clcf->root.len + reserved + r->uri.len - alias + 1;
1682 1682
1683 path->data = ngx_pnalloc(r->pool, path->len); 1683 path->data = ngx_pnalloc(r->pool, path->len);
1684 if (path->data == NULL) { 1684 if (path->data == NULL) {
1685 return NULL; 1685 return NULL;
1686 } 1686 }
1687 1687
1688 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); 1688 last = ngx_copy(path->data, clcf->root.data, clcf->root.len);
1689 1689
1690 } else { 1690 } else {
1691 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, 1691 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, ++reserved,
1692 clcf->root_values->elts) 1692 clcf->root_values->elts)
1693 == NULL) 1693 == NULL)
1694 { 1694 {
1695 return NULL; 1695 return NULL;
1696 } 1696 }
3330 "on this platform, ignored"); 3330 "on this platform, ignored");
3331 #endif 3331 #endif
3332 continue; 3332 continue;
3333 } 3333 }
3334 3334
3335 if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) {
3336 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
3337 struct sockaddr *sa;
3338
3339 sa = (struct sockaddr *) ls->sockaddr;
3340
3341 if (sa->sa_family == AF_INET6) {
3342
3343 if (ngx_strcmp(&value[n].data[10], "n") == 0) {
3344 ls->conf.ipv6only = 1;
3345
3346 } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) {
3347 ls->conf.ipv6only = 2;
3348
3349 } else {
3350 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3351 "invalid ipv6only flags \"%s\"",
3352 &value[n].data[9]);
3353 return NGX_CONF_ERROR;
3354 }
3355
3356 ls->conf.bind = 1;
3357
3358 } else {
3359 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3360 "ipv6only is not supported "
3361 "on addr \"%s\", ignored",
3362 ls->conf.addr);
3363 }
3364
3365 continue;
3366 #else
3367 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3368 "bind ipv6only is not supported "
3369 "on this platform");
3370 return NGX_CONF_ERROR;
3371 #endif
3372 }
3373
3335 if (ngx_strcmp(value[n].data, "ssl") == 0) { 3374 if (ngx_strcmp(value[n].data, "ssl") == 0) {
3336 #if (NGX_HTTP_SSL) 3375 #if (NGX_HTTP_SSL)
3337 ls->conf.ssl = 1; 3376 ls->conf.ssl = 1;
3338 continue; 3377 continue;
3339 #else 3378 #else