comparison src/http/ngx_http_request.c @ 8226:268f4389130d quic

Refactored HTTP/3 parser.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 18 Mar 2020 13:46:35 +0300
parents 1307308c3cf1
children 1e45c02f6376
comparison
equal deleted inserted replaced
8225:714a19dba6af 8226:268f4389130d
1161 } 1161 }
1162 1162
1163 switch (r->http_version) { 1163 switch (r->http_version) {
1164 #if (NGX_HTTP_V3) 1164 #if (NGX_HTTP_V3)
1165 case NGX_HTTP_VERSION_30: 1165 case NGX_HTTP_VERSION_30:
1166 rc = ngx_http_v3_parse_header(r, r->header_in, 1); 1166 rc = ngx_http_v3_parse_header(r, r->header_in);
1167 break; 1167 break;
1168 #endif 1168 #endif
1169 1169
1170 default: /* HTTP/1.x */ 1170 default: /* HTTP/1.x */
1171 rc = ngx_http_parse_request_line(r, r->header_in); 1171 rc = ngx_http_parse_request_line(r, r->header_in);
1508 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 1508 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
1509 1509
1510 switch (r->http_version) { 1510 switch (r->http_version) {
1511 #if (NGX_HTTP_V3) 1511 #if (NGX_HTTP_V3)
1512 case NGX_HTTP_VERSION_30: 1512 case NGX_HTTP_VERSION_30:
1513 rc = ngx_http_v3_parse_header(r, r->header_in, 0); 1513 rc = ngx_http_v3_parse_header(r, r->header_in);
1514 break; 1514 break;
1515 #endif 1515 #endif
1516 1516
1517 default: /* HTTP/1.x */ 1517 default: /* HTTP/1.x */
1518 rc = ngx_http_parse_header_line(r, r->header_in, 1518 rc = ngx_http_parse_header_line(r, r->header_in,
1545 1545
1546 h->hash = r->header_hash; 1546 h->hash = r->header_hash;
1547 1547
1548 h->key.len = r->header_name_end - r->header_name_start; 1548 h->key.len = r->header_name_end - r->header_name_start;
1549 h->key.data = r->header_name_start; 1549 h->key.data = r->header_name_start;
1550 h->key.data[h->key.len] = '\0'; 1550
1551 if (h->key.data[h->key.len]) {
1552 h->key.data[h->key.len] = '\0';
1553 }
1551 1554
1552 h->value.len = r->header_end - r->header_start; 1555 h->value.len = r->header_end - r->header_start;
1553 h->value.data = r->header_start; 1556 h->value.data = r->header_start;
1554 h->value.data[h->value.len] = '\0'; 1557
1558 if (h->value.data[h->value.len]) {
1559 h->value.data[h->value.len] = '\0';
1560 }
1555 1561
1556 h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); 1562 h->lowcase_key = ngx_pnalloc(r->pool, h->key.len);
1557 if (h->lowcase_key == NULL) { 1563 if (h->lowcase_key == NULL) {
1558 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 1564 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1559 break; 1565 break;