aboutsummaryrefslogtreecommitdiff
path: root/src/http/v2/ngx_http_v2.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2018-06-07 20:01:41 +0300
committerRuslan Ermilov <ru@nginx.com>2018-06-07 20:01:41 +0300
commitf11a9cbdd0f5806131e4308d2ce98a2a97ca4007 (patch)
tree47bbe8b8fc937f6ebf68c5cc3b2cecaeb4f80169 /src/http/v2/ngx_http_v2.c
parent70b6e7a299e6488c2f59f1768c600921bd08a2d7 (diff)
downloadnginx-f11a9cbdd0f5806131e4308d2ce98a2a97ca4007.tar.gz
nginx-f11a9cbdd0f5806131e4308d2ce98a2a97ca4007.zip
Added r->schema.
For HTTP/1, it keeps scheme from the absolute form of URI. For HTTP/2, the :scheme request pseudo-header field value.
Diffstat (limited to 'src/http/v2/ngx_http_v2.c')
-rw-r--r--src/http/v2/ngx_http_v2.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index a35140cf6..d3fdf05e3 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -2616,16 +2616,14 @@ ngx_http_v2_push_stream(ngx_http_v2_stream_t *parent, ngx_str_t *path)
r->method_name = ngx_http_core_get_method;
r->method = NGX_HTTP_GET;
- r->schema_start = (u_char *) "https";
-
#if (NGX_HTTP_SSL)
if (fc->ssl) {
- r->schema_end = r->schema_start + 5;
+ ngx_str_set(&r->schema, "https");
} else
#endif
{
- r->schema_end = r->schema_start + 4;
+ ngx_str_set(&r->schema, "http");
}
value.data = ngx_pstrdup(pool, path);
@@ -3477,7 +3475,7 @@ ngx_http_v2_parse_scheme(ngx_http_request_t *r, ngx_str_t *value)
u_char c, ch;
ngx_uint_t i;
- if (r->schema_start) {
+ if (r->schema.len) {
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
"client sent duplicate :scheme header");
@@ -3511,8 +3509,7 @@ ngx_http_v2_parse_scheme(ngx_http_request_t *r, ngx_str_t *value)
return NGX_DECLINED;
}
- r->schema_start = value->data;
- r->schema_end = value->data + value->len;
+ r->schema = *value;
return NGX_OK;
}
@@ -3575,14 +3572,14 @@ ngx_http_v2_construct_request_line(ngx_http_request_t *r)
static const u_char ending[] = " HTTP/2.0";
if (r->method_name.len == 0
- || r->schema_start == NULL
+ || r->schema.len == 0
|| r->unparsed_uri.len == 0)
{
if (r->method_name.len == 0) {
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
"client sent no :method header");
- } else if (r->schema_start == NULL) {
+ } else if (r->schema.len == 0) {
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
"client sent no :scheme header");