comparison src/http/v2/ngx_http_v2_filter_module.c @ 8843:32b0ba4855a6

HTTP/2: made it possible to flush response headers (ticket #1743). Response headers can be buffered in the SSL buffer. But stream's fake connection buffered flag did not reflect this, so any attempts to flush the buffer without sending additional data were stopped by the write filter. It does not seem to be possible to reflect this in fc->buffered though, as we never known if main connection's c->buffered corresponds to the particular stream or not. As such, fc->buffered might prevent request finalization due to sending data on some other stream. Fix is to implement handling of flush buffers when the c->need_flush_buf flag is set, similarly to the existing last buffer handling. The same flag is now used for UDP sockets in the stream module instead of explicit checking of c->type.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 03 Feb 2022 01:44:38 +0300
parents a7a77549265e
children ef6a3a99a81a
comparison
equal deleted inserted replaced
8842:dd718d1cef3c 8843:32b0ba4855a6
663 cln->handler = ngx_http_v2_filter_cleanup; 663 cln->handler = ngx_http_v2_filter_cleanup;
664 cln->data = stream; 664 cln->data = stream;
665 665
666 fc->send_chain = ngx_http_v2_send_chain; 666 fc->send_chain = ngx_http_v2_send_chain;
667 fc->need_last_buf = 1; 667 fc->need_last_buf = 1;
668 fc->need_flush_buf = 1;
668 669
669 return ngx_http_v2_filter_send(fc, stream); 670 return ngx_http_v2_filter_send(fc, stream);
670 } 671 }
671 672
672 673
1813 1814
1814 1815
1815 static ngx_inline ngx_int_t 1816 static ngx_inline ngx_int_t
1816 ngx_http_v2_filter_send(ngx_connection_t *fc, ngx_http_v2_stream_t *stream) 1817 ngx_http_v2_filter_send(ngx_connection_t *fc, ngx_http_v2_stream_t *stream)
1817 { 1818 {
1818 if (stream->queued == 0) { 1819 ngx_connection_t *c;
1820
1821 c = stream->connection->connection;
1822
1823 if (stream->queued == 0 && !c->buffered) {
1819 fc->buffered &= ~NGX_HTTP_V2_BUFFERED; 1824 fc->buffered &= ~NGX_HTTP_V2_BUFFERED;
1820 return NGX_OK; 1825 return NGX_OK;
1821 } 1826 }
1822 1827
1823 stream->blocked = 1; 1828 stream->blocked = 1;