diff options
author | Valentin Bartenev <vbart@nginx.com> | 2019-02-27 17:25:07 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2019-02-27 17:25:07 +0300 |
commit | e929d08201aae949db25ae8c1051a91e96ba3011 (patch) | |
tree | 76af15b49cb67547dbd1942466a6bb360459fc6b /src/nxt_unit.c | |
parent | a881c31abdb9fda2ba0d2e05c45c2ce890a6cfab (diff) | |
download | unit-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 'src/nxt_unit.c')
-rw-r--r-- | src/nxt_unit.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/nxt_unit.c b/src/nxt_unit.c index fa1fb1d5..ec8ba641 100644 --- a/src/nxt_unit.c +++ b/src/nxt_unit.c @@ -890,59 +890,6 @@ nxt_unit_field_hash(const char *name, size_t name_length) void -nxt_unit_split_host(char *host, uint32_t host_length, - char **name, uint32_t *name_length, char **port, uint32_t *port_length) -{ - char *cpos; - - static char default_host[] = "localhost"; - static char default_port[] = "80"; - - if (nxt_slow_path(host == NULL || host_length == 0)) { - *name = default_host; - *name_length = nxt_length(default_host); - - *port = default_port; - *port_length = nxt_length(default_port); - - return; - } - - cpos = memchr(host, ':', host_length); - - if (nxt_slow_path(cpos == NULL)) { - *name = host; - *name_length = host_length; - - *port = default_port; - *port_length = nxt_length(default_port); - - return; - } - - if (nxt_slow_path(cpos == host)) { - *name = default_host; - *name_length = nxt_length(default_host); - - } else { - *name = host; - *name_length = cpos - host; - } - - cpos++; - - if (nxt_slow_path(host + host_length == cpos)) { - *port = default_port; - *port_length = nxt_length(default_port); - - } else { - *port = cpos; - *port_length = host_length - (cpos - host); - } -} - - -void nxt_unit_request_group_dup_fields(nxt_unit_request_info_t *req) { uint32_t i, j; @@ -957,10 +904,6 @@ nxt_unit_request_group_dup_fields(nxt_unit_request_info_t *req) for (i = 0; i < r->fields_count; i++) { switch (fields[i].hash) { - case NXT_UNIT_HASH_HOST: - r->host_field = i; - break; - case NXT_UNIT_HASH_CONTENT_LENGTH: r->content_length_field = i; break; |