Latest update - 7296
This commit is contained in:
+32
-15
@@ -2629,18 +2629,13 @@ 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;
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
r->schema_end = r->schema_start + 4;
|
||||
r->schema.data = ngx_pstrdup(pool, &parent->request->schema);
|
||||
if (r->schema.data == NULL) {
|
||||
goto close;
|
||||
}
|
||||
|
||||
r->schema.len = parent->request->schema.len;
|
||||
|
||||
value.data = ngx_pstrdup(pool, path);
|
||||
if (value.data == NULL) {
|
||||
goto close;
|
||||
@@ -3487,7 +3482,10 @@ ngx_http_v2_parse_method(ngx_http_request_t *r, ngx_str_t *value)
|
||||
static ngx_int_t
|
||||
ngx_http_v2_parse_scheme(ngx_http_request_t *r, ngx_str_t *value)
|
||||
{
|
||||
if (r->schema_start) {
|
||||
u_char c, ch;
|
||||
ngx_uint_t i;
|
||||
|
||||
if (r->schema.len) {
|
||||
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
||||
"client sent duplicate :scheme header");
|
||||
|
||||
@@ -3501,8 +3499,27 @@ 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;
|
||||
for (i = 0; i < value->len; i++) {
|
||||
ch = value->data[i];
|
||||
|
||||
c = (u_char) (ch | 0x20);
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((ch >= '0' && ch <= '9') || ch == '+' || ch == '-' || ch == '.')
|
||||
&& i > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
||||
"client sent invalid :scheme header: \"%V\"", value);
|
||||
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
r->schema = *value;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
@@ -3565,14 +3582,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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user