Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 1510:2abedb6c0f29 stable-0.5
r1404 merge:
auto redirect lost arguments
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 22 Sep 2007 19:10:53 +0000 |
parents | 1a1fe29fdb17 |
children | 9b10ba85b249 |
comparison
equal
deleted
inserted
replaced
1509:d450e57ea5a4 | 1510:2abedb6c0f29 |
---|---|
618 | 618 |
619 ngx_int_t | 619 ngx_int_t |
620 ngx_http_core_find_config_phase(ngx_http_request_t *r, | 620 ngx_http_core_find_config_phase(ngx_http_request_t *r, |
621 ngx_http_phase_handler_t *ph) | 621 ngx_http_phase_handler_t *ph) |
622 { | 622 { |
623 u_char *p; | |
624 size_t len; | |
623 ngx_int_t rc; | 625 ngx_int_t rc; |
624 ngx_http_core_loc_conf_t *clcf; | 626 ngx_http_core_loc_conf_t *clcf; |
625 ngx_http_core_srv_conf_t *cscf; | 627 ngx_http_core_srv_conf_t *cscf; |
626 | 628 |
627 r->content_handler = NULL; | 629 r->content_handler = NULL; |
678 /* | 680 /* |
679 * we do not need to set the r->headers_out.location->hash and | 681 * we do not need to set the r->headers_out.location->hash and |
680 * r->headers_out.location->key fields | 682 * r->headers_out.location->key fields |
681 */ | 683 */ |
682 | 684 |
683 r->headers_out.location->value = clcf->name; | 685 if (r->args.len == 0) { |
686 r->headers_out.location->value = clcf->name; | |
687 | |
688 } else { | |
689 len = clcf->name.len + 1 + r->args.len; | |
690 p = ngx_palloc(r->pool, len); | |
691 | |
692 if (p == NULL) { | |
693 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
694 return NGX_OK; | |
695 } | |
696 | |
697 r->headers_out.location->value.len = len; | |
698 r->headers_out.location->value.data = p; | |
699 | |
700 p = ngx_cpymem(p, clcf->name.data, clcf->name.len); | |
701 *p++ = '?'; | |
702 ngx_memcpy(p, r->args.data, r->args.len); | |
703 } | |
684 | 704 |
685 ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY); | 705 ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY); |
686 return NGX_OK; | 706 return NGX_OK; |
687 } | 707 } |
688 | 708 |