summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/http.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/http.h')
-rw-r--r--libs/libcurl/src/http.h96
1 files changed, 46 insertions, 50 deletions
diff --git a/libs/libcurl/src/http.h b/libs/libcurl/src/http.h
index 677825ae73..5b05e74be9 100644
--- a/libs/libcurl/src/http.h
+++ b/libs/libcurl/src/http.h
@@ -42,6 +42,24 @@ typedef enum {
HTTPREQ_HEAD
} Curl_HttpReq;
+
+/* When redirecting transfers. */
+typedef enum {
+ FOLLOW_NONE, /* not used within the function, just a placeholder to
+ allow initing to this */
+ FOLLOW_FAKE, /* only records stuff, not actually following */
+ FOLLOW_RETRY, /* set if this is a request retry as opposed to a real
+ redirect following */
+ FOLLOW_REDIR /* a full true redirect */
+} followtype;
+
+#define CURL_HTTP_V1x (1 << 0)
+#define CURL_HTTP_V2x (1 << 1)
+#define CURL_HTTP_V3x (1 << 2)
+/* bitmask of CURL_HTTP_V* values */
+typedef unsigned char http_majors;
+
+
#ifndef CURL_DISABLE_HTTP
#if defined(USE_HTTP3)
@@ -56,6 +74,18 @@ extern const struct Curl_handler Curl_handler_https;
struct dynhds;
+struct http_negotiation {
+ unsigned char rcvd_min; /* minimum version seen in responses, 09, 10, 11 */
+ http_majors wanted; /* wanted major versions when talking to server */
+ http_majors allowed; /* allowed major versions when talking to server */
+ BIT(h2_upgrade); /* Do HTTP Upgrade from 1.1 to 2 */
+ BIT(h2_prior_knowledge); /* Directly do HTTP/2 without ALPN/SSL */
+ BIT(accept_09); /* Accept an HTTP/0.9 response */
+ BIT(only_10); /* When using major version 1x, use only 1.0 */
+};
+
+void Curl_http_neg_init(struct Curl_easy *data, struct http_negotiation *neg);
+
CURLcode Curl_bump_headersize(struct Curl_easy *data,
size_t delta,
bool connect_only);
@@ -74,53 +104,14 @@ char *Curl_checkProxyheaders(struct Curl_easy *data,
const char *thisheader,
const size_t thislen);
-CURLcode Curl_add_timecondition(struct Curl_easy *data,
-#ifndef USE_HYPER
- struct dynbuf *req
-#else
- void *headers
-#endif
- );
-CURLcode Curl_add_custom_headers(struct Curl_easy *data,
- bool is_connect,
-#ifndef USE_HYPER
- struct dynbuf *req
-#else
- void *headers
-#endif
- );
-CURLcode Curl_dynhds_add_custom(struct Curl_easy *data,
- bool is_connect,
+CURLcode Curl_add_timecondition(struct Curl_easy *data, struct dynbuf *req);
+CURLcode Curl_add_custom_headers(struct Curl_easy *data, bool is_connect,
+ int httpversion, struct dynbuf *req);
+CURLcode Curl_dynhds_add_custom(struct Curl_easy *data, bool is_connect,
struct dynhds *hds);
void Curl_http_method(struct Curl_easy *data, struct connectdata *conn,
const char **method, Curl_HttpReq *);
-CURLcode Curl_http_useragent(struct Curl_easy *data);
-CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn);
-CURLcode Curl_http_target(struct Curl_easy *data, struct connectdata *conn,
- struct dynbuf *req);
-CURLcode Curl_http_statusline(struct Curl_easy *data,
- struct connectdata *conn);
-CURLcode Curl_http_header(struct Curl_easy *data,
- const char *hd, size_t hdlen);
-CURLcode Curl_transferencode(struct Curl_easy *data);
-CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
- Curl_HttpReq httpreq,
- const char **tep);
-CURLcode Curl_http_req_complete(struct Curl_easy *data,
- struct dynbuf *r, Curl_HttpReq httpreq);
-bool Curl_use_http_1_1plus(const struct Curl_easy *data,
- const struct connectdata *conn);
-#ifndef CURL_DISABLE_COOKIES
-CURLcode Curl_http_cookies(struct Curl_easy *data,
- struct connectdata *conn,
- struct dynbuf *r);
-#else
-#define Curl_http_cookies(a,b,c) CURLE_OK
-#endif
-CURLcode Curl_http_range(struct Curl_easy *data,
- Curl_HttpReq httpreq);
-CURLcode Curl_http_firstwrite(struct Curl_easy *data);
/* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http_setup_conn(struct Curl_easy *data,
@@ -140,8 +131,13 @@ CURLcode Curl_http_write_resp_hd(struct Curl_easy *data,
/* These functions are in http.c */
CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
const char *auth);
+
CURLcode Curl_http_auth_act(struct Curl_easy *data);
+/* follow a redirect or not */
+CURLcode Curl_http_follow(struct Curl_easy *data, const char *newurl,
+ followtype type);
+
/* If only the PICKNONE bit is set, there has been a round-trip and we
selected to use no auth at all. Ie, we actively select no auth, as opposed
to not having one selected. The other CURLAUTH_* defines are present in the
@@ -178,8 +174,10 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data);
version. This count includes CONNECT response headers. */
#define MAX_HTTP_RESP_HEADER_SIZE (300*1024)
-bool Curl_http_exp100_is_selected(struct Curl_easy *data);
-void Curl_http_exp100_got100(struct Curl_easy *data);
+/* MAX_HTTP_RESP_HEADER_COUNT is the maximum number of response headers that
+ libcurl allows for a single HTTP response, including CONNECT and
+ redirects. */
+#define MAX_HTTP_RESP_HEADER_COUNT 5000
#endif /* CURL_DISABLE_HTTP */
@@ -187,8 +185,6 @@ void Curl_http_exp100_got100(struct Curl_easy *data);
* HTTP unique setup
***************************************************************************/
-CURLcode Curl_http_size(struct Curl_easy *data);
-
CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
const char *buf, size_t blen,
size_t *pconsumed);
@@ -226,12 +222,12 @@ CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len);
* All about a core HTTP request, excluding body and trailers
*/
struct httpreq {
- char method[24];
+ struct dynhds headers;
+ struct dynhds trailers;
char *scheme;
char *authority;
char *path;
- struct dynhds headers;
- struct dynhds trailers;
+ char method[1];
};
/**