http: h1/h2 proxy unification

- use shared code for setting up the CONNECT request
  when tunneling, used in HTTP/1.x and HTTP/2 proxying
- eliminate use of Curl_buffer_send() and other manipulations
  of `data->req` or `data->state.ulbuf`

Closes #11808
This commit is contained in:
Stefan Eissing 2023-09-06 14:43:22 +02:00 committed by Daniel Stenberg
parent 9c7165e96a
commit bb4032a152
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 258 additions and 229 deletions

View file

@ -318,5 +318,29 @@ out:
return nread;
}
CURLcode Curl_h1_req_write_head(struct httpreq *req, int http_minor,
struct dynbuf *dbuf)
{
CURLcode result;
result = Curl_dyn_addf(dbuf, "%s %s%s%s%s HTTP/1.%d\r\n",
req->method,
req->scheme? req->scheme : "",
req->scheme? "://" : "",
req->authority? req->authority : "",
req->path? req->path : "",
http_minor);
if(result)
goto out;
result = Curl_dynhds_h1_dprint(&req->headers, dbuf);
if(result)
goto out;
result = Curl_dyn_addn(dbuf, STRCONST("\r\n"));
out:
return result;
}
#endif /* !CURL_DISABLE_HTTP */