diff --git a/reg-tests/http-messaging/protocol_upgrade.vtc b/reg-tests/http-messaging/protocol_upgrade.vtc index 3cd0f4cb0..2fe65e717 100644 --- a/reg-tests/http-messaging/protocol_upgrade.vtc +++ b/reg-tests/http-messaging/protocol_upgrade.vtc @@ -72,7 +72,7 @@ server srv_h2 { txresp \ -status 200 } -run -} -repeat 4 -start +} -repeat 2 -start # http2 server without support for RFC8441 server srv_h2_no_ws { @@ -219,8 +219,7 @@ client c1_h1_h2 -connect ${hap_frt_h1_h2_sock} { client c2_h2 -connect ${hap_frt_h2_sock} { txpri stream 0 { - # manually send RFC8441 SETTINGS_ENABLE_CONNECT_PROTOCOL - sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" + txsettings rxsettings txsettings -ack rxsettings @@ -242,62 +241,11 @@ client c2_h2 -connect ${hap_frt_h2_sock} { } -run } -run -# connect to h2 server frontend without extension: must fail -client c2_h2_rej1 -connect ${hap_frt_h2_sock} { - txpri - stream 0 { - # no extension sent - txsettings - rxsettings - txsettings -ack - rxsettings - expect settings.ack == true - } -run - - stream 1 { - txreq \ - -req "CONNECT" \ - -scheme "http" \ - -url "/" \ - -hdr ":authority" "127.0.0.1" \ - -hdr ":protocol" "custom_protocol" \ - -nostrend - - rxrst - } -run -} -run - -# connect to h2 server with ext but :proto with bad method: must fail -client c2_h2_rej2 -connect ${hap_frt_h2_sock} { - txpri - stream 0 { - # manually send RFC8441 SETTINGS_ENABLE_CONNECT_PROTOCOL - sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" - rxsettings - txsettings -ack - rxsettings - expect settings.ack == true - } -run - - stream 1 { - txreq \ - -req "GET" \ - -scheme "http" \ - -url "/" \ - -hdr ":authority" "127.0.0.1" \ - -hdr ":protocol" "custom_protocol" \ - -nostrend - - rxrst - } -run -} -run - # connect to h2 translation frontend client c3_h2_h1 -connect ${hap_frt_h2_h1_sock} { txpri stream 0 { - # manually send RFC8441 SETTINGS_ENABLE_CONNECT_PROTOCOL - sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" + txsettings rxsettings txsettings -ack rxsettings @@ -391,8 +339,7 @@ client c8_h2c -connect ${hap_frt_h1_h2c_sock} { client c9_h2c -connect ${hap_frt_h2_h1_sock} { txpri stream 0 { - # manually send RFC8441 SETTINGS_ENABLE_CONNECT_PROTOCOL - sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" + txsettings rxsettings txsettings -ack rxsettings diff --git a/reg-tests/http-messaging/websocket.vtc b/reg-tests/http-messaging/websocket.vtc index b82f5a318..9567ea577 100644 --- a/reg-tests/http-messaging/websocket.vtc +++ b/reg-tests/http-messaging/websocket.vtc @@ -177,8 +177,7 @@ client c3 -connect ${hap_fe2_sock} { client c4 -connect ${hap_fe3_sock} { txpri stream 0 { - # manually send RFC8441 SETTINGS_ENABLE_CONNECT_PROTOCOL - sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" + txsettings rxsettings txsettings -ack rxsettings @@ -206,8 +205,7 @@ client c4 -connect ${hap_fe3_sock} { client c5 -connect ${hap_fe4_sock} { txpri stream 0 { - # manually send RFC8441 SETTINGS_ENABLE_CONNECT_PROTOCOL - sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" + txsettings rxsettings txsettings -ack rxsettings diff --git a/src/mux_h2.c b/src/mux_h2.c index a04fa8f90..9720ae99c 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -6286,8 +6286,16 @@ next_frame: /* If an Extended CONNECT has been sent on this stream, set message flag * to convert 200 response to 101 htx response. We only support this if * the connection supports RFC8441. + * On the backend, that means the origin server advertised the setting. + * On the frontend, RFC 8441 §3 only requires the server (us) to + * advertise it; clients are not required to echo it back. Use whether + * we ourselves advertised it as the gate. */ - msgf |= (h2c->flags & H2_CF_RCVD_RFC8441) ? H2_MSGF_EXT_CONN_OK : 0; + if (h2c->flags & H2_CF_IS_BACK) + msgf |= (h2c->flags & H2_CF_RCVD_RFC8441) ? H2_MSGF_EXT_CONN_OK : 0; + else if (!(global.tune.options & GTUNE_DISABLE_H2_WEBSOCKET)) + msgf |= H2_MSGF_EXT_CONN_OK; + msgf |= (*flags & H2_SF_EXT_CONNECT_SENT) ? H2_MSGF_EXT_CONNECT: 0; /* when dealing with trailers, we need to check the content-length */