summaryrefslogtreecommitdiff
path: root/lib/http.h
diff options
context:
space:
mode:
authorStefan Eissing <stefan@eissing.org>2023-04-14 11:38:14 +0200
committerDaniel Stenberg <daniel@haxx.se>2023-04-17 17:27:49 +0200
commitfc2f1e547a4a4b4bec5fd3c8bfde5136706488a1 (patch)
tree3d3194251c317144d529b35bb928567a84a9b57b /lib/http.h
parentfb1d62ff0736961032a489a0a8bff4b79b13eccb (diff)
downloadcurl-fc2f1e547a4a4b4bec5fd3c8bfde5136706488a1.tar.gz
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
Diffstat (limited to 'lib/http.h')
-rw-r--r--lib/http.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/lib/http.h b/lib/http.h
index bdd5524db..5fde9ce79 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -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
*/