summaryrefslogtreecommitdiffhomepage
path: root/src/http/v2
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/v2')
-rw-r--r--src/http/v2/ngx_http_v2.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 13856583f..fe9ee5a88 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3518,7 +3518,8 @@ ngx_http_v2_parse_scheme(ngx_http_request_t *r, ngx_str_t *value)
static ngx_int_t
ngx_http_v2_parse_authority(ngx_http_request_t *r, ngx_str_t *value)
{
- ngx_int_t rc;
+ u_char *p;
+ ngx_int_t rc;
if (r->host_start) {
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
@@ -3552,6 +3553,16 @@ ngx_http_v2_parse_authority(ngx_http_request_t *r, ngx_str_t *value)
r->headers_in.server = *value;
+ p = ngx_strlchr(r->host_start + value->len, r->host_end, ':');
+
+ if (p) {
+ rc = ngx_atoi(p + 1, r->host_end - p - 1);
+
+ if (rc > 0 && rc < 65536) {
+ r->port = rc;
+ }
+ }
+
return NGX_OK;
}