Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 2284:c3035feb6638
fix case proxy_pass URL is evaluted to http://host?args
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 24 Oct 2008 19:34:24 +0000 |
parents | 33556140681a |
children | c77f4710595c |
comparison
equal
deleted
inserted
replaced
2283:231b52f8adc0 | 2284:c3035feb6638 |
---|---|
534 | 534 |
535 static ngx_int_t | 535 static ngx_int_t |
536 ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx, | 536 ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx, |
537 ngx_http_proxy_loc_conf_t *plcf) | 537 ngx_http_proxy_loc_conf_t *plcf) |
538 { | 538 { |
539 size_t add; | 539 u_char *p; |
540 u_short port; | 540 size_t add; |
541 ngx_str_t proxy; | 541 u_short port; |
542 ngx_url_t u; | 542 ngx_str_t proxy; |
543 ngx_url_t u; | |
543 | 544 |
544 if (ngx_http_script_run(r, &proxy, plcf->proxy_lengths->elts, 0, | 545 if (ngx_http_script_run(r, &proxy, plcf->proxy_lengths->elts, 0, |
545 plcf->proxy_values->elts) | 546 plcf->proxy_values->elts) |
546 == NULL) | 547 == NULL) |
547 { | 548 { |
585 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 586 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
586 "%s in upstream \"%V\"", u.err, &u.url); | 587 "%s in upstream \"%V\"", u.err, &u.url); |
587 } | 588 } |
588 | 589 |
589 return NGX_ERROR; | 590 return NGX_ERROR; |
591 } | |
592 | |
593 if (u.uri.len && u.uri.data[0] == '?') { | |
594 p = ngx_pnalloc(r->pool, u.uri.len + 1); | |
595 if (p == NULL) { | |
596 return NGX_ERROR; | |
597 } | |
598 | |
599 *p++ = '/'; | |
600 ngx_memcpy(p, u.uri.data, u.uri.len); | |
601 | |
602 u.uri.len++; | |
603 u.uri.data = p - 1; | |
590 } | 604 } |
591 | 605 |
592 if (ngx_http_proxy_set_vars(r->pool, &u, &ctx->vars) != NGX_OK) { | 606 if (ngx_http_proxy_set_vars(r->pool, &u, &ctx->vars) != NGX_OK) { |
593 return NGX_ERROR; | 607 return NGX_ERROR; |
594 } | 608 } |