@@ -378,6 +378,7 @@ private abstract static class Stream {
378378 protected final ContextInternal context ;
379379 protected final int id ;
380380
381+ private HttpVersion version ;
381382 private Object trace ;
382383 private Object metric ;
383384 private HttpRequestHead request ;
@@ -793,8 +794,7 @@ private void handleHttpMessage(HttpObject obj) {
793794 } else {
794795 version = io .vertx .core .http .HttpVersion .HTTP_1_1 ;
795796 }
796- handleResponseBegin (stream , new HttpResponseHead (
797- version ,
797+ handleResponseBegin (stream , version , new HttpResponseHead (
798798 response .status ().code (),
799799 response .status ().reasonPhrase (),
800800 new HeadersAdaptor (response .headers ())));
@@ -822,7 +822,7 @@ private void handleChunk(ByteBuf chunk) {
822822 }
823823 }
824824
825- private void handleResponseBegin (Stream stream , HttpResponseHead response ) {
825+ private void handleResponseBegin (Stream stream , HttpVersion version , HttpResponseHead response ) {
826826 // How can we handle future undefined 1xx informational response codes?
827827 if (response .statusCode == HttpResponseStatus .CONTINUE .code ()) {
828828 stream .handleContinue ();
@@ -832,6 +832,7 @@ private void handleResponseBegin(Stream stream, HttpResponseHead response) {
832832 HttpRequestHead request ;
833833 synchronized (this ) {
834834 request = stream .request ;
835+ stream .version = version ;
835836 stream .response = response ;
836837 if (metrics != null ) {
837838 metrics .responseBegin (stream .metric , response );
@@ -885,9 +886,11 @@ private void handleResponseChunk(Stream stream, ByteBuf chunk) {
885886
886887 private void handleResponseEnd (Stream stream , LastHttpContent trailer ) {
887888 boolean check ;
888- HttpResponseHead response ;
889+ HttpResponseHead response ;
890+ HttpVersion version ;
889891 synchronized (this ) {
890892 response = stream .response ;
893+ version = stream .version ;
891894 if (response == null ) {
892895 // 100-continue
893896 return ;
@@ -903,7 +906,7 @@ private void handleResponseEnd(Stream stream, LastHttpContent trailer) {
903906 if (HttpHeaderValues .CLOSE .contentEqualsIgnoreCase (responseConnectionHeader ) || HttpHeaderValues .CLOSE .contentEqualsIgnoreCase (requestConnectionHeader )) {
904907 // In all cases, if we have a close connection option then we SHOULD NOT treat the connection as persistent
905908 close = true ;
906- } else if (response . version == HttpVersion .HTTP_1_0 && !HttpHeaderValues .KEEP_ALIVE .contentEqualsIgnoreCase (responseConnectionHeader )) {
909+ } else if (version == HttpVersion .HTTP_1_0 && !HttpHeaderValues .KEEP_ALIVE .contentEqualsIgnoreCase (responseConnectionHeader )) {
907910 // In the HTTP/1.0 case both request/response need a keep-alive connection header the connection to be persistent
908911 // currently Vertx forces the Connection header if keepalive is enabled for 1.0
909912 close = true ;
0 commit comments