diff --git a/reg-tests/http-messaging/websocket.vtc b/reg-tests/http-messaging/websocket.vtc index 5f4b960e8..aed55fe51 100644 --- a/reg-tests/http-messaging/websocket.vtc +++ b/reg-tests/http-messaging/websocket.vtc @@ -27,7 +27,10 @@ server s1 { -hdr "connection: upgrade" \ -hdr "upgrade: websocket" \ -hdr "sec-websocket-accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=" -} -repeat 2 -start + + recv 4 + send "PONG" +} -start # non-conformant server: no websocket key server s2 { @@ -124,6 +127,9 @@ client c1 -connect ${hap_fe1_sock} { expect resp.http.connection == "upgrade" expect resp.http.upgrade == "websocket" expect resp.http.sec-websocket-accept == "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=" + + send "PING" + recv 4 } -run # missing websocket key diff --git a/src/http_ana.c b/src/http_ana.c index 8828e6b12..9097856ff 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2089,10 +2089,9 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit } } - if ((txn->meth == HTTP_METH_CONNECT && txn->status >= 200 && txn->status < 300) || txn->status == 101 || - !(msg->flags & HTTP_MSGF_XFER_LEN)) { + if (!(txn->flags & TX_CON_WANT_TUN) && !(msg->flags & HTTP_MSGF_XFER_LEN)) { + /* One-side tunnel */ msg->msg_state = HTTP_MSG_TUNNEL; - goto ending; } else { msg->msg_state = HTTP_MSG_DONE; @@ -4255,8 +4254,10 @@ static void http_end_request(struct stream *s) /* Tunnel mode will not have any analyser so it needs to * poll for reads. */ - channel_auto_read(chn); + channel_auto_read(&s->req); txn->req.msg_state = HTTP_MSG_TUNNEL; + channel_auto_read(&s->res); + txn->rsp.msg_state = HTTP_MSG_TUNNEL; } else { /* we're not expecting any new data to come for this @@ -4363,7 +4364,9 @@ static void http_end_response(struct stream *s) * direction, and sometimes for a close to be effective. */ if (txn->flags & TX_CON_WANT_TUN) { - channel_auto_read(chn); + channel_auto_read(&s->req); + txn->req.msg_state = HTTP_MSG_TUNNEL; + channel_auto_read(&s->res); txn->rsp.msg_state = HTTP_MSG_TUNNEL; } else {