Mercurial > hg > nginx
annotate src/http/v3/ngx_http_v3_request.c @ 8837:8f0f6407ae23 quic
QUIC: Stateless Reset Token debug logging cleanup.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 24 Aug 2021 14:41:31 +0300 |
parents | d8d48c977b0f |
children | d6e191a583cc |
rev | line source |
---|---|
8215 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_http.h> | |
11 | |
12 | |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
13 static void ngx_http_v3_cleanup_request(void *data); |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
14 static void ngx_http_v3_process_request(ngx_event_t *rev); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
15 static ngx_int_t ngx_http_v3_process_header(ngx_http_request_t *r, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
16 ngx_str_t *name, ngx_str_t *value); |
8682
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
17 static ngx_int_t ngx_http_v3_validate_header(ngx_http_request_t *r, |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
18 ngx_str_t *name, ngx_str_t *value); |
8215 | 19 static ngx_int_t ngx_http_v3_process_pseudo_header(ngx_http_request_t *r, |
20 ngx_str_t *name, ngx_str_t *value); | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
21 static ngx_int_t ngx_http_v3_init_pseudo_headers(ngx_http_request_t *r); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
22 static ngx_int_t ngx_http_v3_process_request_header(ngx_http_request_t *r); |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
23 static void ngx_http_v3_read_client_request_body_handler(ngx_http_request_t *r); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
24 static ngx_int_t ngx_http_v3_do_read_client_request_body(ngx_http_request_t *r); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
25 static ngx_int_t ngx_http_v3_request_body_filter(ngx_http_request_t *r, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
26 ngx_chain_t *in); |
8215 | 27 |
28 | |
8665
96eb6915d244
HTTP/3: staticize ngx_http_v3_methods.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8653
diff
changeset
|
29 static const struct { |
8215 | 30 ngx_str_t name; |
31 ngx_uint_t method; | |
32 } ngx_http_v3_methods[] = { | |
33 | |
34 { ngx_string("GET"), NGX_HTTP_GET }, | |
35 { ngx_string("POST"), NGX_HTTP_POST }, | |
36 { ngx_string("HEAD"), NGX_HTTP_HEAD }, | |
37 { ngx_string("OPTIONS"), NGX_HTTP_OPTIONS }, | |
38 { ngx_string("PROPFIND"), NGX_HTTP_PROPFIND }, | |
39 { ngx_string("PUT"), NGX_HTTP_PUT }, | |
40 { ngx_string("MKCOL"), NGX_HTTP_MKCOL }, | |
41 { ngx_string("DELETE"), NGX_HTTP_DELETE }, | |
42 { ngx_string("COPY"), NGX_HTTP_COPY }, | |
43 { ngx_string("MOVE"), NGX_HTTP_MOVE }, | |
44 { ngx_string("PROPPATCH"), NGX_HTTP_PROPPATCH }, | |
45 { ngx_string("LOCK"), NGX_HTTP_LOCK }, | |
46 { ngx_string("UNLOCK"), NGX_HTTP_UNLOCK }, | |
47 { ngx_string("PATCH"), NGX_HTTP_PATCH }, | |
48 { ngx_string("TRACE"), NGX_HTTP_TRACE } | |
49 }; | |
50 | |
51 | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
52 void |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
53 ngx_http_v3_init(ngx_connection_t *c) |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
54 { |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
55 size_t size; |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
56 uint64_t n; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
57 ngx_buf_t *b; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
58 ngx_event_t *rev; |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
59 ngx_pool_cleanup_t *cln; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
60 ngx_http_request_t *r; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
61 ngx_http_connection_t *hc; |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
62 ngx_http_v3_session_t *h3c; |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
63 ngx_http_core_loc_conf_t *clcf; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
64 ngx_http_core_srv_conf_t *cscf; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
65 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
66 if (ngx_http_v3_init_session(c) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
67 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
68 "internal error"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
69 ngx_http_close_connection(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
70 return; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
71 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
72 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
73 if (c->quic->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
74 ngx_http_v3_init_uni_stream(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
75 return; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
76 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
77 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
78 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init request stream"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
79 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
80 hc = c->data; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
81 |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
82 clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
83 |
8826
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
84 n = c->quic->id >> 2; |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
85 |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
86 if (n >= clcf->keepalive_requests * 2) { |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
87 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD, |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
88 "too many requests per connection"); |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
89 ngx_http_close_connection(c); |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
90 return; |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
91 } |
c35b255d80dc
HTTP/3: close connection on keepalive_requests * 2.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
92 |
8768
40d710a66aef
HTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan <arut@nginx.com>
parents:
8742
diff
changeset
|
93 h3c = ngx_http_v3_get_session(c); |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
94 |
8742
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
95 if (h3c->goaway) { |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
96 ngx_quic_reset_stream(c, NGX_HTTP_V3_ERR_REQUEST_REJECTED); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
97 ngx_http_close_connection(c); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
98 return; |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
99 } |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
100 |
8742
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
101 if (n + 1 == clcf->keepalive_requests |
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
102 || ngx_current_msec - c->quic->parent->start_time |
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
103 > clcf->keepalive_time) |
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
104 { |
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
105 h3c->goaway = 1; |
47a43b011dec
HTTP/3: keepalive_time support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8727
diff
changeset
|
106 |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
107 if (ngx_http_v3_send_goaway(c, (n + 1) << 2) != NGX_OK) { |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
108 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
109 "goaway error"); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
110 ngx_http_close_connection(c); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
111 return; |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
112 } |
8724
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
113 |
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
114 ngx_http_v3_shutdown_connection(c, NGX_HTTP_V3_ERR_NO_ERROR, |
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
115 "reached maximum number of requests"); |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
116 } |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8707
diff
changeset
|
117 |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
118 cln = ngx_pool_cleanup_add(c->pool, 0); |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
119 if (cln == NULL) { |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
120 ngx_http_close_connection(c); |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
121 return; |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
122 } |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
123 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
124 cln->handler = ngx_http_v3_cleanup_request; |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
125 cln->data = c; |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
126 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
127 h3c->nrequests++; |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
128 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
129 if (h3c->keepalive.timer_set) { |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
130 ngx_del_timer(&h3c->keepalive); |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
131 } |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
132 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
133 cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
134 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
135 size = cscf->client_header_buffer_size; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
136 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
137 b = c->buffer; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
138 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
139 if (b == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
140 b = ngx_create_temp_buf(c->pool, size); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
141 if (b == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
142 ngx_http_close_connection(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
143 return; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
144 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
145 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
146 c->buffer = b; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
147 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
148 } else if (b->start == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
149 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
150 b->start = ngx_palloc(c->pool, size); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
151 if (b->start == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
152 ngx_http_close_connection(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
153 return; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
154 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
155 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
156 b->pos = b->start; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
157 b->last = b->start; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
158 b->end = b->last + size; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
159 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
160 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
161 c->log->action = "reading client request"; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
162 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
163 r = ngx_http_create_request(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
164 if (r == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
165 ngx_http_close_connection(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
166 return; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
167 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
168 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
169 r->http_version = NGX_HTTP_VERSION_30; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
170 |
8706
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
171 r->v3_parse = ngx_pcalloc(r->pool, sizeof(ngx_http_v3_parse_t)); |
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
172 if (r->v3_parse == NULL) { |
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
173 ngx_http_close_connection(c); |
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
174 return; |
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
175 } |
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
176 |
8707
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
177 r->v3_parse->header_limit = cscf->large_client_header_buffers.size |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
178 * cscf->large_client_header_buffers.num; |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
179 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
180 c->data = r; |
8727
a64255c01dab
HTTP/3: fixed $connection_requests.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
181 c->requests = n + 1; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
182 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
183 rev = c->read; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
184 rev->handler = ngx_http_v3_process_request; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
185 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
186 ngx_http_v3_process_request(rev); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
187 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
188 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
189 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
190 static void |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
191 ngx_http_v3_cleanup_request(void *data) |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
192 { |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
193 ngx_connection_t *c = data; |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
194 |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
195 ngx_http_v3_session_t *h3c; |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
196 ngx_http_core_loc_conf_t *clcf; |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
197 |
8768
40d710a66aef
HTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan <arut@nginx.com>
parents:
8742
diff
changeset
|
198 h3c = ngx_http_v3_get_session(c); |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
199 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
200 if (--h3c->nrequests == 0) { |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
201 clcf = ngx_http_v3_get_module_loc_conf(c, ngx_http_core_module); |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
202 ngx_add_timer(&h3c->keepalive, clcf->keepalive_timeout); |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
203 } |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
204 } |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
205 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
206 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
207 static void |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
208 ngx_http_v3_process_request(ngx_event_t *rev) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
209 { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
210 ssize_t n; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
211 ngx_buf_t *b; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
212 ngx_int_t rc; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
213 ngx_connection_t *c; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
214 ngx_http_request_t *r; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
215 ngx_http_core_srv_conf_t *cscf; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
216 ngx_http_v3_parse_headers_t *st; |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
217 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
218 c = rev->data; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
219 r = c->data; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
220 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
221 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http3 process request"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
222 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
223 if (rev->timedout) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
224 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
225 c->timedout = 1; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
226 ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
227 return; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
228 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
229 |
8706
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
230 st = &r->v3_parse->headers; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
231 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
232 b = r->header_in; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
233 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
234 for ( ;; ) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
235 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
236 if (b->pos == b->last) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
237 |
8685
dbe33ef9cd9a
HTTP/3: call ngx_handle_read_event() from client header handler.
Roman Arutyunyan <arut@nginx.com>
parents:
8682
diff
changeset
|
238 if (rev->ready) { |
dbe33ef9cd9a
HTTP/3: call ngx_handle_read_event() from client header handler.
Roman Arutyunyan <arut@nginx.com>
parents:
8682
diff
changeset
|
239 n = c->recv(c, b->start, b->end - b->start); |
dbe33ef9cd9a
HTTP/3: call ngx_handle_read_event() from client header handler.
Roman Arutyunyan <arut@nginx.com>
parents:
8682
diff
changeset
|
240 |
dbe33ef9cd9a
HTTP/3: call ngx_handle_read_event() from client header handler.
Roman Arutyunyan <arut@nginx.com>
parents:
8682
diff
changeset
|
241 } else { |
dbe33ef9cd9a
HTTP/3: call ngx_handle_read_event() from client header handler.
Roman Arutyunyan <arut@nginx.com>
parents:
8682
diff
changeset
|
242 n = NGX_AGAIN; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
243 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
244 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
245 if (n == NGX_AGAIN) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
246 if (!rev->timer_set) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
247 cscf = ngx_http_get_module_srv_conf(r, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
248 ngx_http_core_module); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
249 ngx_add_timer(rev, cscf->client_header_timeout); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
250 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
251 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
252 if (ngx_handle_read_event(rev, 0) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
253 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
254 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
255 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
256 break; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
257 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
258 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
259 if (n == 0) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
260 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
261 "client prematurely closed connection"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
262 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
263 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
264 if (n == 0 || n == NGX_ERROR) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
265 c->error = 1; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
266 c->log->action = "reading client request"; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
267 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
268 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
269 break; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
270 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
271 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
272 b->pos = b->start; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
273 b->last = b->start + n; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
274 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
275 |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8452
diff
changeset
|
276 rc = ngx_http_v3_parse_headers(c, st, *b->pos); |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
277 |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
278 if (rc > 0) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
279 ngx_http_v3_finalize_connection(c, rc, |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
280 "could not parse request headers"); |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
281 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
282 break; |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
283 } |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
284 |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
285 if (rc == NGX_ERROR) { |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
286 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
287 "internal error"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
288 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
289 break; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
290 } |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
291 |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8452
diff
changeset
|
292 if (rc == NGX_BUSY) { |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
293 if (rev->error) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
294 ngx_http_close_request(r, NGX_HTTP_CLOSE); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
295 break; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
296 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
297 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
298 if (ngx_handle_read_event(rev, 0) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
299 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
300 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
301 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
302 break; |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8452
diff
changeset
|
303 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8452
diff
changeset
|
304 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8452
diff
changeset
|
305 b->pos++; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
306 r->request_length++; |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8452
diff
changeset
|
307 |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
308 if (rc == NGX_AGAIN) { |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
309 continue; |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
310 } |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
311 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
312 /* rc == NGX_OK || rc == NGX_DONE */ |
8233
1e45c02f6376
HTTP/3 $request_line variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8230
diff
changeset
|
313 |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8770
diff
changeset
|
314 if (ngx_http_v3_process_header(r, &st->field_rep.field.name, |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8770
diff
changeset
|
315 &st->field_rep.field.value) |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
316 != NGX_OK) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
317 { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
318 break; |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
319 } |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
320 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
321 if (rc == NGX_DONE) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
322 if (ngx_http_v3_process_request_header(r) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
323 break; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
324 } |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
325 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
326 ngx_http_process_request(r); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
327 break; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
328 } |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
329 } |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
330 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
331 ngx_http_run_posted_requests(c); |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
332 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
333 return; |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
334 } |
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
335 |
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
336 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
337 static ngx_int_t |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
338 ngx_http_v3_process_header(ngx_http_request_t *r, ngx_str_t *name, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
339 ngx_str_t *value) |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
340 { |
8707
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
341 size_t len; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
342 ngx_table_elt_t *h; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
343 ngx_http_header_t *hh; |
8682
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
344 ngx_http_core_srv_conf_t *cscf; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
345 ngx_http_core_main_conf_t *cmcf; |
8452
a6675a976560
HTTP/3: fixed dropping first non-pseudo header.
Roman Arutyunyan <arut@nginx.com>
parents:
8451
diff
changeset
|
346 |
8707
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
347 len = name->len + value->len; |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
348 |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
349 if (len > r->v3_parse->header_limit) { |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
350 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
351 "client sent too large header"); |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
352 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_HEADER_TOO_LARGE); |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
353 return NGX_ERROR; |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
354 } |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
355 |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
356 r->v3_parse->header_limit -= len; |
ffcaf0aad9f2
HTTP/3: limited client header size.
Roman Arutyunyan <arut@nginx.com>
parents:
8706
diff
changeset
|
357 |
8682
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
358 if (ngx_http_v3_validate_header(r, name, value) != NGX_OK) { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
359 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
360 return NGX_ERROR; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
361 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
362 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
363 if (r->invalid_header) { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
364 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
365 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
366 if (cscf->ignore_invalid_headers) { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
367 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
368 "client sent invalid header: \"%V\"", name); |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
369 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
370 return NGX_OK; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
371 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
372 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
373 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
374 if (name->len && name->data[0] == ':') { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
375 return ngx_http_v3_process_pseudo_header(r, name, value); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
376 } |
8452
a6675a976560
HTTP/3: fixed dropping first non-pseudo header.
Roman Arutyunyan <arut@nginx.com>
parents:
8451
diff
changeset
|
377 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
378 if (ngx_http_v3_init_pseudo_headers(r) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
379 return NGX_ERROR; |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
380 } |
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
381 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
382 h = ngx_list_push(&r->headers_in.headers); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
383 if (h == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
384 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
385 return NGX_ERROR; |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
386 } |
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
387 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
388 h->key = *name; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
389 h->value = *value; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
390 h->lowcase_key = h->key.data; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
391 h->hash = ngx_hash_key(h->key.data, h->key.len); |
8406
66feab03d9b7
HTTP/3: restricted symbols in header names.
Roman Arutyunyan <arut@nginx.com>
parents:
8405
diff
changeset
|
392 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
393 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
394 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
395 hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
396 h->lowcase_key, h->key.len); |
8406
66feab03d9b7
HTTP/3: restricted symbols in header names.
Roman Arutyunyan <arut@nginx.com>
parents:
8405
diff
changeset
|
397 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
398 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
399 return NGX_ERROR; |
8406
66feab03d9b7
HTTP/3: restricted symbols in header names.
Roman Arutyunyan <arut@nginx.com>
parents:
8405
diff
changeset
|
400 } |
66feab03d9b7
HTTP/3: restricted symbols in header names.
Roman Arutyunyan <arut@nginx.com>
parents:
8405
diff
changeset
|
401 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
402 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
403 "http3 header: \"%V: %V\"", name, value); |
8405
d2759e4cc437
HTTP/3: split header parser in two functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8394
diff
changeset
|
404 return NGX_OK; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
405 } |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
406 |
8215 | 407 |
408 static ngx_int_t | |
8682
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
409 ngx_http_v3_validate_header(ngx_http_request_t *r, ngx_str_t *name, |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
410 ngx_str_t *value) |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
411 { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
412 u_char ch; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
413 ngx_uint_t i; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
414 ngx_http_core_srv_conf_t *cscf; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
415 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
416 r->invalid_header = 0; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
417 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
418 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
419 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
420 for (i = (name->data[0] == ':'); i != name->len; i++) { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
421 ch = name->data[i]; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
422 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
423 if ((ch >= 'a' && ch <= 'z') |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
424 || (ch == '-') |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
425 || (ch >= '0' && ch <= '9') |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
426 || (ch == '_' && cscf->underscores_in_headers)) |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
427 { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
428 continue; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
429 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
430 |
8832
0d35b1ff6af5
HTTP/3: disabled control characters and space in header names.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8826
diff
changeset
|
431 if (ch <= 0x20 || ch == 0x7f || ch == ':' |
8682
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
432 || (ch >= 'A' && ch <= 'Z')) |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
433 { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
434 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
435 "client sent invalid header name: \"%V\"", name); |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
436 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
437 return NGX_ERROR; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
438 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
439 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
440 r->invalid_header = 1; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
441 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
442 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
443 for (i = 0; i != value->len; i++) { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
444 ch = value->data[i]; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
445 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
446 if (ch == '\0' || ch == LF || ch == CR) { |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
447 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
448 "client sent header \"%V\" with " |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
449 "invalid value: \"%V\"", name, value); |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
450 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
451 return NGX_ERROR; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
452 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
453 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
454 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
455 return NGX_OK; |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
456 } |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
457 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
458 |
916a2e1d6617
HTTP/3: client header validation.
Roman Arutyunyan <arut@nginx.com>
parents:
8680
diff
changeset
|
459 static ngx_int_t |
8215 | 460 ngx_http_v3_process_pseudo_header(ngx_http_request_t *r, ngx_str_t *name, |
461 ngx_str_t *value) | |
462 { | |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
463 u_char ch, c; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
464 ngx_uint_t i; |
8215 | 465 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
466 if (r->request_line.len) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
467 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
468 "client sent out of order pseudo-headers"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
469 goto failed; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
470 } |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
471 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
472 if (name->len == 7 && ngx_strncmp(name->data, ":method", 7) == 0) { |
8215 | 473 |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
474 if (r->method_name.len) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
475 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
476 "client sent duplicate \":method\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
477 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
478 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
479 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
480 if (value->len == 0) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
481 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
482 "client sent empty \":method\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
483 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
484 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
485 |
8650
9dce2978e4fd
HTTP/3: eliminated r->method_start.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
486 r->method_name = *value; |
8215 | 487 |
488 for (i = 0; i < sizeof(ngx_http_v3_methods) | |
489 / sizeof(ngx_http_v3_methods[0]); i++) | |
490 { | |
491 if (value->len == ngx_http_v3_methods[i].name.len | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
492 && ngx_strncmp(value->data, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
493 ngx_http_v3_methods[i].name.data, value->len) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
494 == 0) |
8215 | 495 { |
496 r->method = ngx_http_v3_methods[i].method; | |
497 break; | |
498 } | |
499 } | |
500 | |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
501 for (i = 0; i < value->len; i++) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
502 ch = value->data[i]; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
503 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
504 if ((ch < 'A' || ch > 'Z') && ch != '_' && ch != '-') { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
505 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
506 "client sent invalid method: \"%V\"", value); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
507 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
508 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
509 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
510 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
511 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
8215 | 512 "http3 method \"%V\" %ui", value, r->method); |
513 return NGX_OK; | |
514 } | |
515 | |
516 if (name->len == 5 && ngx_strncmp(name->data, ":path", 5) == 0) { | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
517 |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
518 if (r->uri_start) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
519 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
520 "client sent duplicate \":path\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
521 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
522 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
523 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
524 if (value->len == 0) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
525 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
526 "client sent empty \":path\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
527 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
528 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
529 |
8215 | 530 r->uri_start = value->data; |
531 r->uri_end = value->data + value->len; | |
532 | |
533 if (ngx_http_parse_uri(r) != NGX_OK) { | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
534 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
535 "client sent invalid \":path\" header: \"%V\"", |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
536 value); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
537 goto failed; |
8215 | 538 } |
539 | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
540 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
8215 | 541 "http3 path \"%V\"", value); |
542 return NGX_OK; | |
543 } | |
544 | |
545 if (name->len == 7 && ngx_strncmp(name->data, ":scheme", 7) == 0) { | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
546 |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
547 if (r->schema.len) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
548 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
549 "client sent duplicate \":scheme\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
550 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
551 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
552 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
553 if (value->len == 0) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
554 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
555 "client sent empty \":scheme\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
556 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
557 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
558 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
559 for (i = 0; i < value->len; i++) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
560 ch = value->data[i]; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
561 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
562 c = (u_char) (ch | 0x20); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
563 if (c >= 'a' && c <= 'z') { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
564 continue; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
565 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
566 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
567 if (((ch >= '0' && ch <= '9') |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
568 || ch == '+' || ch == '-' || ch == '.') |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
569 && i > 0) |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
570 { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
571 continue; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
572 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
573 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
574 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
575 "client sent invalid \":scheme\" header: \"%V\"", |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
576 value); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
577 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
578 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
579 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
580 r->schema = *value; |
8215 | 581 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
582 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
8215 | 583 "http3 schema \"%V\"", value); |
584 return NGX_OK; | |
585 } | |
586 | |
587 if (name->len == 10 && ngx_strncmp(name->data, ":authority", 10) == 0) { | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
588 |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
589 if (r->host_start) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
590 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
591 "client sent duplicate \":authority\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
592 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
593 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
594 |
8215 | 595 r->host_start = value->data; |
596 r->host_end = value->data + value->len; | |
597 | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
598 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
8215 | 599 "http3 authority \"%V\"", value); |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
600 return NGX_OK; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
601 } |
8215 | 602 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
603 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
604 "client sent unknown pseudo-header \"%V\"", name); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
605 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
606 failed: |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
607 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
608 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
609 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
610 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
611 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
612 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
613 static ngx_int_t |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
614 ngx_http_v3_init_pseudo_headers(ngx_http_request_t *r) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
615 { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
616 size_t len; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
617 u_char *p; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
618 ngx_int_t rc; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
619 ngx_str_t host; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
620 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
621 if (r->request_line.len) { |
8215 | 622 return NGX_OK; |
623 } | |
624 | |
8680
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
625 if (r->method_name.len == 0) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
626 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
627 "client sent no \":method\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
628 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
629 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
630 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
631 if (r->schema.len == 0) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
632 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
633 "client sent no \":scheme\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
634 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
635 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
636 |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
637 if (r->uri_start == NULL) { |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
638 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
639 "client sent no \":path\" header"); |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
640 goto failed; |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
641 } |
58acdba9b3b2
HTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan <arut@nginx.com>
parents:
8679
diff
changeset
|
642 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
643 len = r->method_name.len + 1 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
644 + (r->uri_end - r->uri_start) + 1 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
645 + sizeof("HTTP/3.0") - 1; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
646 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
647 p = ngx_pnalloc(r->pool, len); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
648 if (p == NULL) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
649 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
650 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
651 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
652 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
653 r->request_line.data = p; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
654 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
655 p = ngx_cpymem(p, r->method_name.data, r->method_name.len); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
656 *p++ = ' '; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
657 p = ngx_cpymem(p, r->uri_start, r->uri_end - r->uri_start); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
658 *p++ = ' '; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
659 p = ngx_cpymem(p, "HTTP/3.0", sizeof("HTTP/3.0") - 1); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
660 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
661 r->request_line.len = p - r->request_line.data; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
662 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
663 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
664 "http3 request line: \"%V\"", &r->request_line); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
665 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
666 ngx_str_set(&r->http_protocol, "HTTP/3.0"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
667 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
668 if (ngx_http_process_request_uri(r) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
669 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
670 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
671 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
672 if (r->host_end) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
673 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
674 host.len = r->host_end - r->host_start; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
675 host.data = r->host_start; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
676 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
677 rc = ngx_http_validate_host(&host, r->pool, 0); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
678 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
679 if (rc == NGX_DECLINED) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
680 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
681 "client sent invalid host in request line"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
682 goto failed; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
683 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
684 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
685 if (rc == NGX_ERROR) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
686 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
687 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
688 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
689 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
690 if (ngx_http_set_virtual_server(r, &host) == NGX_ERROR) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
691 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
692 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
693 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
694 r->headers_in.server = host; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
695 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
696 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
697 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
698 sizeof(ngx_table_elt_t)) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
699 != NGX_OK) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
700 { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
701 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
702 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
703 } |
8215 | 704 |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8219
diff
changeset
|
705 return NGX_OK; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
706 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
707 failed: |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
708 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
709 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
710 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
711 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
712 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
713 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
714 static ngx_int_t |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
715 ngx_http_v3_process_request_header(ngx_http_request_t *r) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
716 { |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
717 ssize_t n; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
718 ngx_buf_t *b; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
719 ngx_connection_t *c; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
720 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
721 c = r->connection; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
722 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
723 if (ngx_http_v3_init_pseudo_headers(r) != NGX_OK) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
724 return NGX_ERROR; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
725 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
726 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
727 if (r->headers_in.server.len == 0) { |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
728 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
729 "client sent neither \":authority\" nor \"Host\" header"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
730 goto failed; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
731 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
732 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
733 if (r->headers_in.host) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
734 if (r->headers_in.host->value.len != r->headers_in.server.len |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
735 || ngx_memcmp(r->headers_in.host->value.data, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
736 r->headers_in.server.data, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
737 r->headers_in.server.len) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
738 != 0) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
739 { |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
740 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
741 "client sent \":authority\" and \"Host\" headers " |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
742 "with different values"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
743 goto failed; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
744 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
745 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
746 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
747 if (r->headers_in.content_length) { |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
748 r->headers_in.content_length_n = |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
749 ngx_atoof(r->headers_in.content_length->value.data, |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
750 r->headers_in.content_length->value.len); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
751 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
752 if (r->headers_in.content_length_n == NGX_ERROR) { |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
753 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
754 "client sent invalid \"Content-Length\" header"); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
755 goto failed; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
756 } |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
757 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
758 } else { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
759 b = r->header_in; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
760 n = b->last - b->pos; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
761 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
762 if (n == 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
763 n = c->recv(c, b->start, b->end - b->start); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
764 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
765 if (n == NGX_ERROR) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
766 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
767 return NGX_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
768 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
769 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
770 if (n > 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
771 b->pos = b->start; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
772 b->last = b->start + n; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
773 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
774 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
775 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
776 if (n != 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
777 r->headers_in.chunked = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
778 } |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
779 } |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
780 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
781 return NGX_OK; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
782 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
783 failed: |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
784 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
785 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8665
diff
changeset
|
786 return NGX_ERROR; |
8215 | 787 } |
788 | |
789 | |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
790 ngx_int_t |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
791 ngx_http_v3_read_request_body(ngx_http_request_t *r) |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
792 { |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
793 size_t preread; |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
794 ngx_int_t rc; |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
795 ngx_chain_t *cl, out; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
796 ngx_http_request_body_t *rb; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
797 ngx_http_core_loc_conf_t *clcf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
798 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
799 rb = r->request_body; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
800 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
801 preread = r->header_in->last - r->header_in->pos; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
802 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
803 if (preread) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
804 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
805 /* there is the pre-read part of the request body */ |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
806 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
807 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
808 "http3 client request body preread %uz", preread); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
809 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
810 out.buf = r->header_in; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
811 out.next = NULL; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
812 cl = &out; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
813 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
814 } else { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
815 cl = NULL; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
816 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
817 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
818 rc = ngx_http_v3_request_body_filter(r, cl); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
819 if (rc != NGX_OK) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
820 return rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
821 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
822 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
823 if (rb->rest == 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
824 /* the whole request body was pre-read */ |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
825 r->request_body_no_buffering = 0; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
826 rb->post_handler(r); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
827 return NGX_OK; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
828 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
829 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
830 if (rb->rest < 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
831 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
832 "negative request body rest"); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
833 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
834 } |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
835 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
836 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
837 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
838 rb->buf = ngx_create_temp_buf(r->pool, clcf->client_body_buffer_size); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
839 if (rb->buf == NULL) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
840 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
841 } |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
842 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
843 r->read_event_handler = ngx_http_v3_read_client_request_body_handler; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
844 r->write_event_handler = ngx_http_request_empty_handler; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
845 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
846 return ngx_http_v3_do_read_client_request_body(r); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
847 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
848 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
849 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
850 static void |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
851 ngx_http_v3_read_client_request_body_handler(ngx_http_request_t *r) |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
852 { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
853 ngx_int_t rc; |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
854 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
855 if (r->connection->read->timedout) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
856 r->connection->timedout = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
857 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
858 return; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
859 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
860 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
861 rc = ngx_http_v3_do_read_client_request_body(r); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
862 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
863 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
864 ngx_http_finalize_request(r, rc); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
865 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
866 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
867 |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
868 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
869 ngx_int_t |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
870 ngx_http_v3_read_unbuffered_request_body(ngx_http_request_t *r) |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
871 { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
872 ngx_int_t rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
873 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
874 if (r->connection->read->timedout) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
875 r->connection->timedout = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
876 return NGX_HTTP_REQUEST_TIME_OUT; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
877 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
878 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
879 rc = ngx_http_v3_do_read_client_request_body(r); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
880 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
881 if (rc == NGX_OK) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
882 r->reading_body = 0; |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
883 } |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
884 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
885 return rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
886 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
887 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
888 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
889 static ngx_int_t |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
890 ngx_http_v3_do_read_client_request_body(ngx_http_request_t *r) |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
891 { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
892 off_t rest; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
893 size_t size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
894 ssize_t n; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
895 ngx_int_t rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
896 ngx_chain_t out; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
897 ngx_connection_t *c; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
898 ngx_http_request_body_t *rb; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
899 ngx_http_core_loc_conf_t *clcf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
900 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
901 c = r->connection; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
902 rb = r->request_body; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
903 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
904 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
905 "http3 read client request body"); |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
906 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
907 for ( ;; ) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
908 for ( ;; ) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
909 if (rb->buf->last == rb->buf->end) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
910 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
911 /* update chains */ |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
912 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
913 rc = ngx_http_v3_request_body_filter(r, NULL); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
914 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
915 if (rc != NGX_OK) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
916 return rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
917 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
918 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
919 if (rb->busy != NULL) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
920 if (r->request_body_no_buffering) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
921 if (c->read->timer_set) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
922 ngx_del_timer(c->read); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
923 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
924 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
925 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
926 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
927 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
928 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
929 return NGX_AGAIN; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
930 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
931 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
932 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
933 "busy buffers after request body flush"); |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
934 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
935 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
936 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
937 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
938 rb->buf->pos = rb->buf->start; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
939 rb->buf->last = rb->buf->start; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
940 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
941 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
942 size = rb->buf->end - rb->buf->last; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
943 rest = rb->rest - (rb->buf->last - rb->buf->pos); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
944 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
945 if ((off_t) size > rest) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
946 size = (size_t) rest; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
947 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
948 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
949 n = c->recv(c, rb->buf->last, size); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
950 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
951 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
952 "http3 client request body recv %z", n); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
953 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
954 if (n == NGX_AGAIN) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
955 break; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
956 } |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
957 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
958 if (n == 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
959 rb->buf->last_buf = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
960 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
961 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
962 if (n == NGX_ERROR) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
963 c->error = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
964 return NGX_HTTP_BAD_REQUEST; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
965 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
966 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
967 rb->buf->last += n; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
968 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
969 /* pass buffer to request body filter chain */ |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
970 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
971 out.buf = rb->buf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
972 out.next = NULL; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
973 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
974 rc = ngx_http_v3_request_body_filter(r, &out); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
975 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
976 if (rc != NGX_OK) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
977 return rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
978 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
979 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
980 if (rb->rest == 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
981 break; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
982 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
983 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
984 if (rb->buf->last < rb->buf->end) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
985 break; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
986 } |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
987 } |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
988 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
989 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
990 "http3 client request body rest %O", rb->rest); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
991 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
992 if (rb->rest == 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
993 break; |
8549
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8548
diff
changeset
|
994 } |
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8548
diff
changeset
|
995 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
996 if (!c->read->ready) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
997 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
998 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
999 ngx_add_timer(c->read, clcf->client_body_timeout); |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1000 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1001 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1002 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1003 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1004 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1005 return NGX_AGAIN; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1006 } |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1007 } |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1008 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1009 if (c->read->timer_set) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1010 ngx_del_timer(c->read); |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1011 } |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1012 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1013 if (!r->request_body_no_buffering) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1014 r->read_event_handler = ngx_http_block_reading; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1015 rb->post_handler(r); |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1016 } |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1017 |
8548
9ffef6054abf
HTTP/3: fixed handling request body eof.
Roman Arutyunyan <arut@nginx.com>
parents:
8511
diff
changeset
|
1018 return NGX_OK; |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1019 } |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1020 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1021 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1022 static ngx_int_t |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1023 ngx_http_v3_request_body_filter(ngx_http_request_t *r, ngx_chain_t *in) |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1024 { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1025 off_t max; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1026 size_t size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1027 ngx_int_t rc; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1028 ngx_buf_t *b; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1029 ngx_uint_t last; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1030 ngx_chain_t *cl, *out, *tl, **ll; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1031 ngx_http_request_body_t *rb; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1032 ngx_http_core_loc_conf_t *clcf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1033 ngx_http_core_srv_conf_t *cscf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1034 ngx_http_v3_parse_data_t *st; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1035 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1036 rb = r->request_body; |
8706
3057bae4dba7
HTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan <arut@nginx.com>
parents:
8690
diff
changeset
|
1037 st = &r->v3_parse->body; |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1038 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1039 if (rb->rest == -1) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1040 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1041 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1042 "http3 request body filter"); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1043 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1044 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1045 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1046 rb->rest = cscf->large_client_header_buffers.size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1047 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1048 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1049 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1050 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1051 max = r->headers_in.content_length_n; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1052 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1053 if (max == -1 && clcf->client_max_body_size) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1054 max = clcf->client_max_body_size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1055 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1056 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1057 out = NULL; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1058 ll = &out; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1059 last = 0; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1060 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1061 for (cl = in; cl; cl = cl->next) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1062 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1063 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1064 "http3 body buf " |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1065 "t:%d f:%d %p, pos %p, size: %z file: %O, size: %O", |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1066 cl->buf->temporary, cl->buf->in_file, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1067 cl->buf->start, cl->buf->pos, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1068 cl->buf->last - cl->buf->pos, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1069 cl->buf->file_pos, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1070 cl->buf->file_last - cl->buf->file_pos); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1071 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1072 if (cl->buf->last_buf) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1073 last = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1074 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1075 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1076 b = NULL; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1077 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1078 while (cl->buf->pos < cl->buf->last) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1079 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1080 if (st->length == 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1081 r->request_length++; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1082 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1083 rc = ngx_http_v3_parse_data(r->connection, st, *cl->buf->pos++); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1084 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1085 if (rc == NGX_AGAIN) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1086 continue; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1087 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1088 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1089 if (rc == NGX_DONE) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1090 last = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1091 goto done; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1092 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1093 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1094 if (rc > 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1095 ngx_http_v3_finalize_connection(r->connection, rc, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1096 "client sent invalid body"); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1097 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1098 "client sent invalid body"); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1099 return NGX_HTTP_BAD_REQUEST; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1100 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1101 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1102 if (rc == NGX_ERROR) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1103 ngx_http_v3_finalize_connection(r->connection, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1104 NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1105 "internal error"); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1106 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1107 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1108 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1109 /* rc == NGX_OK */ |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1110 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1111 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1112 if (max != -1 && (uint64_t) (max - rb->received) < st->length) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1113 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1114 "client intended to send too large " |
8690
a9034b10dacc
HTTP/3: fixed format specifier.
Roman Arutyunyan <arut@nginx.com>
parents:
8689
diff
changeset
|
1115 "body: %O+%ui bytes", |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1116 rb->received, st->length); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1117 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1118 return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1119 } |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1120 |
8689
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1121 if (b |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1122 && st->length <= 128 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1123 && (uint64_t) (cl->buf->last - cl->buf->pos) >= st->length) |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1124 { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1125 rb->received += st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1126 r->request_length += st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1127 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1128 if (st->length < 8) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1129 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1130 while (st->length) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1131 *b->last++ = *cl->buf->pos++; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1132 st->length--; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1133 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1134 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1135 } else { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1136 ngx_memmove(b->last, cl->buf->pos, st->length); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1137 b->last += st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1138 cl->buf->pos += st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1139 st->length = 0; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1140 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1141 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1142 continue; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1143 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1144 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1145 tl = ngx_chain_get_free_buf(r->pool, &rb->free); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1146 if (tl == NULL) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1147 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1148 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1149 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1150 b = tl->buf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1151 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1152 ngx_memzero(b, sizeof(ngx_buf_t)); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1153 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1154 b->temporary = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1155 b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1156 b->start = cl->buf->pos; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1157 b->pos = cl->buf->pos; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1158 b->last = cl->buf->last; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1159 b->end = cl->buf->end; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1160 b->flush = r->request_body_no_buffering; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1161 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1162 *ll = tl; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1163 ll = &tl->next; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1164 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1165 size = cl->buf->last - cl->buf->pos; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1166 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1167 if (size > st->length) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1168 cl->buf->pos += (size_t) st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1169 rb->received += st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1170 r->request_length += st->length; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1171 st->length = 0; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1172 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1173 } else { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1174 st->length -= size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1175 rb->received += size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1176 r->request_length += size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1177 cl->buf->pos = cl->buf->last; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1178 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1179 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1180 b->last = cl->buf->pos; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1181 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1182 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1183 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1184 done: |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1185 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1186 if (last) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1187 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1188 if (st->length > 0) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1189 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1190 "client prematurely closed stream"); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1191 r->connection->error = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1192 return NGX_HTTP_BAD_REQUEST; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1193 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1194 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1195 if (r->headers_in.content_length_n == -1) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1196 r->headers_in.content_length_n = rb->received; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1197 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1198 } else if (r->headers_in.content_length_n != rb->received) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1199 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1200 "client sent less body data than expected: " |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1201 "%O out of %O bytes of request body received", |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1202 rb->received, r->headers_in.content_length_n); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1203 return NGX_HTTP_BAD_REQUEST; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1204 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1205 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1206 rb->rest = 0; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1207 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1208 tl = ngx_chain_get_free_buf(r->pool, &rb->free); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1209 if (tl == NULL) { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1210 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1211 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1212 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1213 b = tl->buf; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1214 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1215 ngx_memzero(b, sizeof(ngx_buf_t)); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1216 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1217 b->last_buf = 1; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1218 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1219 *ll = tl; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1220 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1221 } else { |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1222 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1223 /* set rb->rest, amount of data we want to see next time */ |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1224 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1225 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1226 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1227 rb->rest = (off_t) cscf->large_client_header_buffers.size; |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1228 } |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1229 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1230 rc = ngx_http_top_request_body_filter(r, out); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1231 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1232 ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out, |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1233 (ngx_buf_tag_t) &ngx_http_read_client_request_body); |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1234 |
6bd8ed493b85
HTTP/3: refactored request body parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8685
diff
changeset
|
1235 return rc; |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8292
diff
changeset
|
1236 } |