comparison src/http/ngx_http_header_filter_module.c @ 8653:1efee5e4194c quic

HTTP/3: introduced ngx_http_v3_filter. The filter is responsible for creating HTTP/3 response header and body. The change removes differences to the default branch for ngx_http_chunked_filter_module and ngx_http_header_filter_module.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 27 Nov 2020 17:46:21 +0000
parents a3257a725b3d
children 7c2adf237091
comparison
equal deleted inserted replaced
8652:e9bd4305e68b 8653:1efee5e4194c
185 185
186 if (r->method == NGX_HTTP_HEAD) { 186 if (r->method == NGX_HTTP_HEAD) {
187 r->header_only = 1; 187 r->header_only = 1;
188 } 188 }
189 189
190 if (r->headers_out.status_line.len == 0) {
191 if (r->headers_out.status == NGX_HTTP_NO_CONTENT
192 || r->headers_out.status == NGX_HTTP_NOT_MODIFIED)
193 {
194 r->header_only = 1;
195 }
196 }
197
198 #if (NGX_HTTP_V3)
199
200 if (r->http_version == NGX_HTTP_VERSION_30) {
201 ngx_chain_t *cl;
202
203 cl = ngx_http_v3_create_header(r);
204 if (cl == NULL) {
205 return NGX_ERROR;
206 }
207
208 return ngx_http_write_filter(r, cl);
209 }
210
211 #endif
212
213 if (r->headers_out.last_modified_time != -1) { 190 if (r->headers_out.last_modified_time != -1) {
214 if (r->headers_out.status != NGX_HTTP_OK 191 if (r->headers_out.status != NGX_HTTP_OK
215 && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT 192 && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
216 && r->headers_out.status != NGX_HTTP_NOT_MODIFIED) 193 && r->headers_out.status != NGX_HTTP_NOT_MODIFIED)
217 { 194 {
241 && status < NGX_HTTP_LAST_2XX) 218 && status < NGX_HTTP_LAST_2XX)
242 { 219 {
243 /* 2XX */ 220 /* 2XX */
244 221
245 if (status == NGX_HTTP_NO_CONTENT) { 222 if (status == NGX_HTTP_NO_CONTENT) {
223 r->header_only = 1;
246 ngx_str_null(&r->headers_out.content_type); 224 ngx_str_null(&r->headers_out.content_type);
247 r->headers_out.last_modified_time = -1; 225 r->headers_out.last_modified_time = -1;
248 r->headers_out.last_modified = NULL; 226 r->headers_out.last_modified = NULL;
249 r->headers_out.content_length = NULL; 227 r->headers_out.content_length = NULL;
250 r->headers_out.content_length_n = -1; 228 r->headers_out.content_length_n = -1;
256 234
257 } else if (status >= NGX_HTTP_MOVED_PERMANENTLY 235 } else if (status >= NGX_HTTP_MOVED_PERMANENTLY
258 && status < NGX_HTTP_LAST_3XX) 236 && status < NGX_HTTP_LAST_3XX)
259 { 237 {
260 /* 3XX */ 238 /* 3XX */
239
240 if (status == NGX_HTTP_NOT_MODIFIED) {
241 r->header_only = 1;
242 }
261 243
262 status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX; 244 status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
263 status_line = &ngx_http_status_lines[status]; 245 status_line = &ngx_http_status_lines[status];
264 len += ngx_http_status_lines[status].len; 246 len += ngx_http_status_lines[status].len;
265 247