Mercurial > hg > nginx
comparison src/http/v3/ngx_http_v3_request.c @ 8452:a6675a976560 quic
HTTP/3: fixed dropping first non-pseudo header.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 26 Jun 2020 10:05:28 +0300 |
parents | 908cae4f3078 |
children | c9538aef3211 |
comparison
equal
deleted
inserted
replaced
8451:908cae4f3078 | 8452:a6675a976560 |
---|---|
103 p = ngx_cpymem(p, r->uri_start, r->uri_end - r->uri_start); | 103 p = ngx_cpymem(p, r->uri_start, r->uri_end - r->uri_start); |
104 *p++ = ' '; | 104 *p++ = ' '; |
105 p = ngx_cpymem(p, "HTTP/3", sizeof("HTTP/3") - 1); | 105 p = ngx_cpymem(p, "HTTP/3", sizeof("HTTP/3") - 1); |
106 | 106 |
107 r->request_end = p; | 107 r->request_end = p; |
108 r->state = 0; | |
108 | 109 |
109 return NGX_OK; | 110 return NGX_OK; |
110 } | 111 } |
111 | 112 |
112 return NGX_AGAIN; | 113 return NGX_AGAIN; |
125 ngx_int_t rc; | 126 ngx_int_t rc; |
126 ngx_str_t *name, *value; | 127 ngx_str_t *name, *value; |
127 ngx_uint_t hash, i, n; | 128 ngx_uint_t hash, i, n; |
128 ngx_connection_t *c; | 129 ngx_connection_t *c; |
129 ngx_http_v3_parse_headers_t *st; | 130 ngx_http_v3_parse_headers_t *st; |
131 enum { | |
132 sw_start = 0, | |
133 sw_done, | |
134 sw_next, | |
135 sw_header | |
136 }; | |
130 | 137 |
131 c = r->connection; | 138 c = r->connection; |
132 st = r->h3_parse; | 139 st = r->h3_parse; |
133 | 140 |
134 if (st->header_rep.state == 0) { | 141 switch (r->state) { |
142 | |
143 case sw_start: | |
144 r->parse_start = b->pos; | |
145 | |
146 if (st->state) { | |
147 r->state = sw_next; | |
148 goto done; | |
149 } | |
150 | |
151 name = &st->header_rep.header.name; | |
152 | |
153 if (name->len && name->data[0] != ':') { | |
154 r->state = sw_done; | |
155 goto done; | |
156 } | |
157 | |
158 /* fall through */ | |
159 | |
160 case sw_done: | |
161 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
162 "http3 parse header done"); | |
163 return NGX_HTTP_PARSE_HEADER_DONE; | |
164 | |
165 case sw_next: | |
135 r->parse_start = b->pos; | 166 r->parse_start = b->pos; |
136 r->invalid_header = 0; | 167 r->invalid_header = 0; |
137 } | 168 break; |
138 | 169 |
139 if (st->state == 0) { | 170 case sw_header: |
140 if (r->header_name_start == NULL) { | 171 break; |
141 name = &st->header_rep.header.name; | |
142 | |
143 if (name->len && name->data[0] != ':') { | |
144 goto done; | |
145 } | |
146 } | |
147 | |
148 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
149 "http3 parse header done"); | |
150 | |
151 return NGX_HTTP_PARSE_HEADER_DONE; | |
152 } | 172 } |
153 | 173 |
154 while (b->pos < b->last) { | 174 while (b->pos < b->last) { |
155 rc = ngx_http_v3_parse_headers(c, st, *b->pos++); | 175 rc = ngx_http_v3_parse_headers(c, st, *b->pos++); |
156 | 176 |
157 if (rc == NGX_ERROR) { | 177 if (rc == NGX_ERROR) { |
158 return NGX_HTTP_PARSE_INVALID_HEADER; | 178 return NGX_HTTP_PARSE_INVALID_HEADER; |
159 } | 179 } |
160 | 180 |
161 if (rc != NGX_AGAIN) { | 181 if (rc == NGX_DONE) { |
182 r->state = sw_done; | |
162 goto done; | 183 goto done; |
163 } | 184 } |
164 } | 185 |
165 | 186 if (rc == NGX_OK) { |
187 r->state = sw_next; | |
188 goto done; | |
189 } | |
190 } | |
191 | |
192 r->state = sw_header; | |
166 return NGX_AGAIN; | 193 return NGX_AGAIN; |
167 | 194 |
168 done: | 195 done: |
169 | 196 |
170 name = &st->header_rep.header.name; | 197 name = &st->header_rep.header.name; |