http2: support HTTP/2 to forward proxies, non-tunneling

- with `--proxy-http2` allow h2 ALPN negotiation to
  forward proxies
- applies to http: requests against a https: proxy only,
  as https: requests will auto-tunnel
- adding a HTTP/1 request parser in http1.c
- removed h2h3.c
- using new request parser in nghttp2 and all h3 backends
- adding test 2603 for request parser
- adding h2 proxy test cases to test_10_*

scorecard.py: request scoring accidentally always run curl
with '-v'. Removed that, expect double numbers.

labeller: added http1.* and h2-proxy sources to detection

Closes #10967
This commit is contained in:
Stefan Eissing 2023-04-14 11:38:14 +02:00 committed by Daniel Stenberg
parent fb1d62ff07
commit fc2f1e547a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
28 changed files with 1522 additions and 824 deletions

View file

@ -260,6 +260,7 @@ Curl_http_output_auth(struct Curl_easy *data,
/* Decode HTTP status code string. */
CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len);
/**
* All about a core HTTP request, excluding body and trailers
*/
@ -276,13 +277,41 @@ struct http_req {
* Create a HTTP request struct.
*/
CURLcode Curl_http_req_make(struct http_req **preq,
const char *method,
const char *scheme,
const char *authority,
const char *path);
const char *method, size_t m_len,
const char *scheme, size_t s_len,
const char *authority, size_t a_len,
const char *path, size_t p_len);
CURLcode Curl_http_req_make2(struct http_req **preq,
const char *method, size_t m_len,
CURLU *url, const char *scheme_default);
void Curl_http_req_free(struct http_req *req);
#define HTTP_PSEUDO_METHOD ":method"
#define HTTP_PSEUDO_SCHEME ":scheme"
#define HTTP_PSEUDO_AUTHORITY ":authority"
#define HTTP_PSEUDO_PATH ":path"
#define HTTP_PSEUDO_STATUS ":status"
/**
* Create the list of HTTP/2 headers which represent the request,
* using HTTP/2 pseudo headers preceeding the `req->headers`.
*
* Applies the following transformations:
* - if `authority` is set, any "Host" header is removed.
* - if `authority` is unset and a "Host" header is present, use
* that as `authority` and remove "Host"
* - removes and Connection header fields as defined in rfc9113 ch. 8.2.2
* - lower-cases the header field names
*
* @param h2_headers will contain the HTTP/2 headers on success
* @param req the request to transform
* @param data the handle to lookup defaults like ' :scheme' from
*/
CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers,
struct http_req *req, struct Curl_easy *data);
/**
* All about a core HTTP response, excluding body and trailers
*/