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