mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 16:48:49 -05:00
c-hyper: abort CONNECT response reading early on non 2xx responses
Fixes test 493 Closes #7209
This commit is contained in:
parent
aeb064db03
commit
c214a6a17b
@ -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;
|
||||
|
@ -744,6 +744,8 @@ static CURLcode CONNECT(struct Curl_easy *data,
|
||||
hyper_io_set_write(io, Curl_hyper_send);
|
||||
conn->sockfd = tunnelsocket;
|
||||
|
||||
data->state.hconnect = TRUE;
|
||||
|
||||
/* create an executor to poll futures */
|
||||
if(!h->exec) {
|
||||
h->exec = hyper_executor_new();
|
||||
|
@ -1411,6 +1411,7 @@ struct UrlState {
|
||||
trailers_state trailers_state; /* whether we are sending trailers
|
||||
and what stage are we at */
|
||||
#ifdef USE_HYPER
|
||||
bool hconnect; /* set if a CONNECT request */
|
||||
CURLcode hresult; /* used to pass return codes back from hyper callbacks */
|
||||
#endif
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HSTS
|
||||
url_effective
|
||||
</keywords>
|
||||
@ -9,16 +10,16 @@ url_effective
|
||||
<reply>
|
||||
|
||||
# we use this as response to a CONNECT
|
||||
<data nocheck="yes">
|
||||
HTTP/1.1 403 not OK at all
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Funny-head: yesyes
|
||||
|
||||
<connect nocheck="yes">
|
||||
HTTP/1.1 403 not OK at all
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Funny-head: yesyes
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</connect>
|
||||
</reply>
|
||||
|
||||
<client>
|
||||
@ -53,6 +54,13 @@ Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
<stdout>
|
||||
HTTP/1.1 403 not OK at all
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Funny-head: yesyes
|
||||
|
||||
https://this.hsts.example/%TESTNUMBER
|
||||
</stdout>
|
||||
# Proxy CONNECT aborted
|
||||
|
Loading…
Reference in New Issue
Block a user