http: revisit http_perhapsrewind()

- use facilities provided by client readers better
- work also for non-uploading requests like GET/HEAD
- update documentation

Closes #13117
This commit is contained in:
Stefan Eissing 2024-03-13 11:42:17 +01:00 committed by Daniel Stenberg
parent 6ea75877fa
commit 77b0571cdc
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 73 additions and 96 deletions

View file

@ -38,6 +38,7 @@
#include "http2.h"
#include "http_proxy.h"
#include "multiif.h"
#include "sendf.h"
#include "cf-h2-proxy.h"
/* The last 3 #include files should be in this order */
@ -954,6 +955,9 @@ static CURLcode submit_CONNECT(struct Curl_cfilter *cf,
struct httpreq *req = NULL;
result = Curl_http_proxy_create_CONNECT(&req, cf, data, 2);
if(result)
goto out;
result = Curl_creader_set_null(data);
if(result)
goto out;
@ -1125,7 +1129,12 @@ static CURLcode cf_h2_proxy_connect(struct Curl_cfilter *cf,
out:
*done = (result == CURLE_OK) && (ts->state == H2_TUNNEL_ESTABLISHED);
cf->connected = *done;
if(*done) {
cf->connected = TRUE;
/* The real request will follow the CONNECT, reset request partially */
Curl_req_soft_reset(&data->req, data);
Curl_client_reset(data);
}
CF_DATA_RESTORE(cf, save);
return result;
}