From c214a6a17b2b6f6e4720c40cec9a061b8504daf0 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 8 Jun 2021 23:30:57 +0200 Subject: c-hyper: abort CONNECT response reading early on non 2xx responses Fixes test 493 Closes #7209 --- lib/c-hyper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/c-hyper.c') diff --git a/lib/c-hyper.c b/lib/c-hyper.c index c7102979e..e3fd26c1a 100644 --- a/lib/c-hyper.c +++ b/lib/c-hyper.c @@ -186,7 +186,13 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk) Curl_safefree(data->req.newurl); } #endif - result = Curl_http_firstwrite(data, data->conn, &done); + if(data->state.hconnect && + (data->req.httpcode/100 != 2)) { + done = TRUE; + result = CURLE_OK; + } + else + result = Curl_http_firstwrite(data, data->conn, &done); if(result || done) { infof(data, "Return early from hyper_body_chunk\n"); data->state.hresult = result; -- cgit v1.2.1