Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2.c @ 6642:72282dd5884e
HTTP/2: flushing of the SSL buffer in transition to the idle state.
It fixes potential connection leak if some unsent data was left in the SSL
buffer. Particularly, that could happen when a client canceled the stream
after the HEADERS frame has already been created. In this case no other
frames might be produced and the HEADERS frame alone didn't flush the buffer.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Tue, 19 Jul 2016 20:34:17 +0300 |
parents | b5d1c17181ca |
children | 57148b755320 09cf90250844 |
comparison
equal
deleted
inserted
replaced
6641:b5d1c17181ca | 6642:72282dd5884e |
---|---|
597 | 597 |
598 | 598 |
599 static void | 599 static void |
600 ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) | 600 ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) |
601 { | 601 { |
602 ngx_connection_t *c; | 602 ngx_int_t rc; |
603 ngx_connection_t *c; | |
603 ngx_http_v2_srv_conf_t *h2scf; | 604 ngx_http_v2_srv_conf_t *h2scf; |
604 | 605 |
605 if (h2c->last_out || h2c->processing) { | 606 if (h2c->last_out || h2c->processing) { |
606 return; | 607 return; |
607 } | 608 } |
612 ngx_http_close_connection(c); | 613 ngx_http_close_connection(c); |
613 return; | 614 return; |
614 } | 615 } |
615 | 616 |
616 if (c->buffered) { | 617 if (c->buffered) { |
617 return; | 618 h2c->blocked = 1; |
619 | |
620 rc = ngx_http_v2_send_output_queue(h2c); | |
621 | |
622 h2c->blocked = 0; | |
623 | |
624 if (rc == NGX_ERROR) { | |
625 ngx_http_close_connection(c); | |
626 return; | |
627 } | |
628 | |
629 if (rc == NGX_AGAIN) { | |
630 return; | |
631 } | |
632 | |
633 /* rc == NGX_OK */ | |
618 } | 634 } |
619 | 635 |
620 h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx, | 636 h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx, |
621 ngx_http_v2_module); | 637 ngx_http_v2_module); |
622 if (h2c->state.incomplete) { | 638 if (h2c->state.incomplete) { |