comparison src/http/ngx_http_request.c @ 8406:66feab03d9b7 quic

HTTP/3: restricted symbols in header names. As per HTTP/3 draft 27, a request or response containing uppercase header field names MUST be treated as malformed. Also, existing rules applied when parsing HTTP/1 header names are also applied to HTTP/3 header names: - null character is not allowed - underscore character may or may not be treated as invalid depending on the value of "underscores_in_headers" - all non-alphanumeric characters with the exception of '-' are treated as invalid Also, the r->locase_header field is now filled while parsing an HTTP/3 header. Error logging for invalid headers is fixed as well.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 19 May 2020 15:34:00 +0300
parents d2759e4cc437
children d6feece1288a
comparison
equal deleted inserted replaced
8405:d2759e4cc437 8406:66feab03d9b7
1509 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 1509 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
1510 1510
1511 switch (r->http_version) { 1511 switch (r->http_version) {
1512 #if (NGX_HTTP_V3) 1512 #if (NGX_HTTP_V3)
1513 case NGX_HTTP_VERSION_30: 1513 case NGX_HTTP_VERSION_30:
1514 rc = ngx_http_v3_parse_header(r, r->header_in); 1514 rc = ngx_http_v3_parse_header(r, r->header_in,
1515 cscf->underscores_in_headers);
1515 break; 1516 break;
1516 #endif 1517 #endif
1517 1518
1518 default: /* HTTP/1.x */ 1519 default: /* HTTP/1.x */
1519 rc = ngx_http_parse_header_line(r, r->header_in, 1520 rc = ngx_http_parse_header_line(r, r->header_in,
1528 if (r->invalid_header && cscf->ignore_invalid_headers) { 1529 if (r->invalid_header && cscf->ignore_invalid_headers) {
1529 1530
1530 /* there was error while a header line parsing */ 1531 /* there was error while a header line parsing */
1531 1532
1532 ngx_log_error(NGX_LOG_INFO, c->log, 0, 1533 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1533 "client sent invalid header line: \"%*s\"", 1534 "client sent invalid header line: \"%*s: %*s\"",
1534 r->header_end - r->header_name_start, 1535 r->header_name_end - r->header_name_start,
1535 r->header_name_start); 1536 r->header_name_start,
1537 r->header_end - r->header_start, r->header_start);
1536 continue; 1538 continue;
1537 } 1539 }
1538 1540
1539 /* a header line has been parsed successfully */ 1541 /* a header line has been parsed successfully */
1540 1542