﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1743	Can't flush HTTP response header under TLS+HTTP2	mrpre@…		"[[BR]]
I want to send HTTP response header first before data is sent to client.
so I do like this:
{{{

/*Want to response Header and flush*/
ngx_http_idle_send_header(r);
/*ngx_http_send_special doesn't work under HTTP2 but works under HTTP1*/
ngx_http_send_special(r, NGX_HTTP_FLUSH);
......
/*send Data later*/
ngx_http_output_filter(r, &out);
}}}  


I had already set postpone_output to 0, and then I found HTTP response header was cached in ssl_buffer( in function ngx_ssl_send_chain ).  [[BR]]


Under HTTP 1,  function ngx_ssl_send_chain will set c->buffered which c was the real connection and then we call ngx_http_send_special->...->ngx_http_write_filter->ngx_ssl_send_chain, the header was sent on network.  That was I want.  [[BR]]


Under HTTP 2,  function ngx_ssl_send_chain will set c->buffered which c was the real connection but when ngx_http_send_special->...->ngx_http_write_filter was called, ngx_ssl_send_chain wasn't called, because the c in ngx_http_write_filter was the H2 fake connection and c->buffered was not set [[BR]]


{{{
    if (size == 0
        && !(c->buffered & NGX_LOWLEVEL_BUFFERED)
        && !(last && c->need_last_buf))
    {
        /*return here*/
        if (last || flush || sync) {
            for (cl = r->out; cl; /* void */) {
                ln = cl;
                cl = cl->next;
                ngx_free_chain(r->pool, ln);
            }

            r->out = NULL;
            c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;

            return NGX_OK;
        }

        ngx_log_error(NGX_LOG_ALERT, c->log, 0,
                      ""the http output chain is empty"");

        ngx_debug_point();

        return NGX_ERROR;
    }

}}}  


What should I do if I want to flush HTTP response header into network before data is sent ?[[BR]]
"	defect	closed	minor		nginx-module	1.14.x	fixed	http2		centos7 CST 2017 x86_64 x86_64 x86_64 GNU/Linux	--with-stream --with-stream_ssl_module --with-http_ssl_module --with-http_v2_module
