summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_request.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2019-02-27 17:25:07 +0300
committerValentin Bartenev <vbart@nginx.com>2019-02-27 17:25:07 +0300
commite929d08201aae949db25ae8c1051a91e96ba3011 (patch)
tree76af15b49cb67547dbd1942466a6bb360459fc6b /src/nxt_http_request.c
parenta881c31abdb9fda2ba0d2e05c45c2ce890a6cfab (diff)
downloadunit-e929d08201aae949db25ae8c1051a91e96ba3011.tar.gz
unit-e929d08201aae949db25ae8c1051a91e96ba3011.tar.bz2
Fixed processing of SERVER_NAME after 77aad2c142a0.
Previously, the nxt_router_prepare_msg() function expected server host among other headers unmodified. It's not true anymore since normalization of the Host header has been introduced in 77aad2c142a0. The nxt_unit_split_host() function was removed. It didn't work correctly with IPv6 literals. Anyway, after 77aad2c142a0 the port splitting is done in router while Host header processing.
Diffstat (limited to '')
-rw-r--r--src/nxt_http_request.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index f6c14df9..724b0808 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -367,6 +367,13 @@ nxt_http_request_application(nxt_task_t *task, nxt_http_request_t *r,
ar->r.header.method = *r->method;
}
+ if (r->host.length != 0) {
+ ar->r.header.server_name = r->host;
+
+ } else {
+ nxt_str_set(&ar->r.header.server_name, "localhost");
+ }
+
ar->r.header.target = r->target;
if (r->path != NULL) {
@@ -377,8 +384,6 @@ nxt_http_request_application(nxt_task_t *task, nxt_http_request_t *r,
ar->r.header.query = *r->args;
}
- ar->r.header.host = r->host;
-
if (r->content_type != NULL) {
ar->r.header.content_type.length = r->content_type->value_length;
ar->r.header.content_type.start = r->content_type->value;