Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 8813:6674a50cbb6c quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 15 Jul 2021 16:28:21 +0300 |
parents | d514f88053e5 e0fdd75871e4 |
children | fac88e160653 |
comparison
equal
deleted
inserted
replaced
8812:e7a2d3914877 | 8813:6674a50cbb6c |
---|---|
1271 } | 1271 } |
1272 | 1272 |
1273 r->unparsed_uri.len = r->uri_end - r->uri_start; | 1273 r->unparsed_uri.len = r->uri_end - r->uri_start; |
1274 r->unparsed_uri.data = r->uri_start; | 1274 r->unparsed_uri.data = r->uri_start; |
1275 | 1275 |
1276 r->valid_unparsed_uri = (r->space_in_uri || r->empty_path_in_uri) ? 0 : 1; | 1276 r->valid_unparsed_uri = r->empty_path_in_uri ? 0 : 1; |
1277 | 1277 |
1278 if (r->uri_ext) { | 1278 if (r->uri_ext) { |
1279 if (r->args_start) { | 1279 if (r->args_start) { |
1280 r->exten.len = r->args_start - 1 - r->uri_ext; | 1280 r->exten.len = r->args_start - 1 - r->uri_ext; |
1281 } else { | 1281 } else { |
1529 } | 1529 } |
1530 | 1530 |
1531 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */ | 1531 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */ |
1532 | 1532 |
1533 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 1533 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1534 "client sent invalid header line"); | 1534 "client sent invalid header line: \"%*s\\x%02xd...\"", |
1535 r->header_end - r->header_name_start, | |
1536 r->header_name_start, *r->header_end); | |
1535 | 1537 |
1536 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | 1538 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
1537 break; | 1539 break; |
1538 } | 1540 } |
1539 | 1541 |
1987 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | 1989 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
1988 return NGX_ERROR; | 1990 return NGX_ERROR; |
1989 } | 1991 } |
1990 } | 1992 } |
1991 | 1993 |
1992 if (r->method == NGX_HTTP_TRACE) { | |
1993 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | |
1994 "client sent TRACE method"); | |
1995 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); | |
1996 return NGX_ERROR; | |
1997 } | |
1998 | |
1999 if (r->headers_in.transfer_encoding) { | 1994 if (r->headers_in.transfer_encoding) { |
2000 if (r->headers_in.transfer_encoding->value.len == 7 | 1995 if (r->headers_in.transfer_encoding->value.len == 7 |
2001 && ngx_strncasecmp(r->headers_in.transfer_encoding->value.data, | 1996 && ngx_strncasecmp(r->headers_in.transfer_encoding->value.data, |
2002 (u_char *) "chunked", 7) == 0) | 1997 (u_char *) "chunked", 7) == 0) |
2003 { | 1998 { |
2004 r->headers_in.content_length = NULL; | 1999 if (r->headers_in.content_length) { |
2005 r->headers_in.content_length_n = -1; | 2000 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
2001 "client sent \"Content-Length\" and " | |
2002 "\"Transfer-Encoding\" headers " | |
2003 "at the same time"); | |
2004 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | |
2005 return NGX_ERROR; | |
2006 } | |
2007 | |
2006 r->headers_in.chunked = 1; | 2008 r->headers_in.chunked = 1; |
2007 | 2009 |
2008 } else { | 2010 } else { |
2009 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 2011 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
2010 "client sent unknown \"Transfer-Encoding\": \"%V\"", | 2012 "client sent unknown \"Transfer-Encoding\": \"%V\"", |
2020 ngx_atotm(r->headers_in.keep_alive->value.data, | 2022 ngx_atotm(r->headers_in.keep_alive->value.data, |
2021 r->headers_in.keep_alive->value.len); | 2023 r->headers_in.keep_alive->value.len); |
2022 } | 2024 } |
2023 } | 2025 } |
2024 | 2026 |
2027 if (r->method == NGX_HTTP_CONNECT) { | |
2028 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | |
2029 "client sent CONNECT method"); | |
2030 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); | |
2031 return NGX_ERROR; | |
2032 } | |
2033 | |
2034 if (r->method == NGX_HTTP_TRACE) { | |
2035 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | |
2036 "client sent TRACE method"); | |
2037 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); | |
2038 return NGX_ERROR; | |
2039 } | |
2040 | |
2025 return NGX_OK; | 2041 return NGX_OK; |
2026 } | 2042 } |
2027 | 2043 |
2028 | 2044 |
2029 void | 2045 void |
2167 host_len = i + 1; | 2183 host_len = i + 1; |
2168 state = sw_rest; | 2184 state = sw_rest; |
2169 } | 2185 } |
2170 break; | 2186 break; |
2171 | 2187 |
2172 case '\0': | |
2173 return NGX_DECLINED; | |
2174 | |
2175 default: | 2188 default: |
2176 | 2189 |
2177 if (ngx_path_separator(ch)) { | 2190 if (ngx_path_separator(ch)) { |
2191 return NGX_DECLINED; | |
2192 } | |
2193 | |
2194 if (ch <= 0x20 || ch == 0x7f) { | |
2178 return NGX_DECLINED; | 2195 return NGX_DECLINED; |
2179 } | 2196 } |
2180 | 2197 |
2181 if (ch >= 'A' && ch <= 'Z') { | 2198 if (ch >= 'A' && ch <= 'Z') { |
2182 alloc = 1; | 2199 alloc = 1; |
3427 | 3444 |
3428 #if (NGX_HTTP_SSL) | 3445 #if (NGX_HTTP_SSL) |
3429 if (c->ssl) { | 3446 if (c->ssl) { |
3430 ngx_int_t rc; | 3447 ngx_int_t rc; |
3431 | 3448 |
3449 c->ssl->shutdown_without_free = 1; | |
3450 | |
3432 rc = ngx_ssl_shutdown(c); | 3451 rc = ngx_ssl_shutdown(c); |
3433 | 3452 |
3434 if (rc == NGX_ERROR) { | 3453 if (rc == NGX_ERROR) { |
3435 ngx_http_close_request(r, 0); | 3454 ngx_http_close_request(r, 0); |
3436 return; | 3455 return; |