Mercurial > hg > nginx-ranges
comparison src/http/modules/ngx_http_proxy_module.c @ 627:bb20316269e4 NGINX_0_9_5
nginx 0.9.5
*) Change: now nginx uses a default listen backlog value -1 on
Linux.
Thanks to Andrei Nigmatulin.
*) Feature: the "utf8" parameter of "geoip_country" and "geoip_city"
directives.
Thanks to Denis F. Latypoff.
*) Bugfix: in a default "proxy_redirect" directive if "proxy_pass"
directive has no URI part.
Thanks to Maxim Dounin.
*) Bugfix: an "error_page" directive did not work with nonstandard
error codes; the bug had appeared in 0.8.53.
Thanks to Maxim Dounin.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 21 Feb 2011 00:00:00 +0300 |
parents | 09d5f308901f |
children |
comparison
equal
deleted
inserted
replaced
626:eaf85af608b8 | 627:bb20316269e4 |
---|---|
1715 ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | 1715 ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |
1716 { | 1716 { |
1717 ngx_http_proxy_loc_conf_t *prev = parent; | 1717 ngx_http_proxy_loc_conf_t *prev = parent; |
1718 ngx_http_proxy_loc_conf_t *conf = child; | 1718 ngx_http_proxy_loc_conf_t *conf = child; |
1719 | 1719 |
1720 u_char *p; | |
1720 size_t size; | 1721 size_t size; |
1721 ngx_keyval_t *s; | 1722 ngx_keyval_t *s; |
1722 ngx_hash_init_t hash; | 1723 ngx_hash_init_t hash; |
1723 ngx_http_core_loc_conf_t *clcf; | 1724 ngx_http_core_loc_conf_t *clcf; |
1724 ngx_http_proxy_redirect_t *pr; | 1725 ngx_http_proxy_redirect_t *pr; |
1973 if (pr == NULL) { | 1974 if (pr == NULL) { |
1974 return NGX_CONF_ERROR; | 1975 return NGX_CONF_ERROR; |
1975 } | 1976 } |
1976 | 1977 |
1977 pr->handler = ngx_http_proxy_rewrite_redirect_text; | 1978 pr->handler = ngx_http_proxy_rewrite_redirect_text; |
1978 pr->redirect = conf->url; | |
1979 | 1979 |
1980 if (conf->vars.uri.len) { | 1980 if (conf->vars.uri.len) { |
1981 pr->redirect = conf->url; | |
1981 pr->replacement.text = conf->location; | 1982 pr->replacement.text = conf->location; |
1982 | 1983 |
1983 } else { | 1984 } else { |
1984 ngx_str_null(&pr->replacement.text); | 1985 pr->redirect.len = conf->url.len + sizeof("/") - 1; |
1986 | |
1987 p = ngx_pnalloc(cf->pool, pr->redirect.len); | |
1988 if (p == NULL) { | |
1989 return NGX_CONF_ERROR; | |
1990 } | |
1991 | |
1992 pr->redirect.data = p; | |
1993 | |
1994 p = ngx_cpymem(p, conf->url.data, conf->url.len); | |
1995 *p = '/'; | |
1996 | |
1997 ngx_str_set(&pr->replacement.text, "/"); | |
1985 } | 1998 } |
1986 } | 1999 } |
1987 } | 2000 } |
1988 | 2001 |
1989 #if (NGX_HTTP_SSL) | 2002 #if (NGX_HTTP_SSL) |
2454 static char * | 2467 static char * |
2455 ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 2468 ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
2456 { | 2469 { |
2457 ngx_http_proxy_loc_conf_t *plcf = conf; | 2470 ngx_http_proxy_loc_conf_t *plcf = conf; |
2458 | 2471 |
2472 u_char *p; | |
2459 ngx_str_t *value; | 2473 ngx_str_t *value; |
2460 ngx_array_t *vars_lengths, *vars_values; | 2474 ngx_array_t *vars_lengths, *vars_values; |
2461 ngx_http_script_compile_t sc; | 2475 ngx_http_script_compile_t sc; |
2462 ngx_http_proxy_redirect_t *pr; | 2476 ngx_http_proxy_redirect_t *pr; |
2463 | 2477 |
2516 "after the \"proxy_pass\" directive"); | 2530 "after the \"proxy_pass\" directive"); |
2517 return NGX_CONF_ERROR; | 2531 return NGX_CONF_ERROR; |
2518 } | 2532 } |
2519 | 2533 |
2520 pr->handler = ngx_http_proxy_rewrite_redirect_text; | 2534 pr->handler = ngx_http_proxy_rewrite_redirect_text; |
2521 pr->redirect = plcf->url; | |
2522 | 2535 |
2523 if (plcf->vars.uri.len) { | 2536 if (plcf->vars.uri.len) { |
2537 pr->redirect = plcf->url; | |
2524 pr->replacement.text = plcf->location; | 2538 pr->replacement.text = plcf->location; |
2525 | 2539 |
2526 } else { | 2540 } else { |
2527 ngx_str_null(&pr->replacement.text); | 2541 pr->redirect.len = plcf->url.len + sizeof("/") - 1; |
2542 | |
2543 p = ngx_pnalloc(cf->pool, pr->redirect.len); | |
2544 if (p == NULL) { | |
2545 return NGX_CONF_ERROR; | |
2546 } | |
2547 | |
2548 pr->redirect.data = p; | |
2549 | |
2550 p = ngx_cpymem(p, plcf->url.data, plcf->url.len); | |
2551 *p = '/'; | |
2552 | |
2553 ngx_str_set(&pr->replacement.text, "/"); | |
2528 } | 2554 } |
2529 | 2555 |
2530 return NGX_CONF_OK; | 2556 return NGX_CONF_OK; |
2531 } | 2557 } |
2532 | 2558 |