123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- #ifndef HEADER_CURL_HTTP_H
- #define HEADER_CURL_HTTP_H
- #include "curl_setup.h"
- #if defined(USE_MSH3) && !defined(_WIN32)
- #include <pthread.h>
- #endif
- #include "bufq.h"
- #include "dynhds.h"
- #include "ws.h"
- typedef enum {
- HTTPREQ_GET,
- HTTPREQ_POST,
- HTTPREQ_POST_FORM,
- HTTPREQ_POST_MIME,
- HTTPREQ_PUT,
- HTTPREQ_HEAD
- } Curl_HttpReq;
- #ifndef CURL_DISABLE_HTTP
- #if defined(USE_HTTP3)
- #include <stdint.h>
- #endif
- extern const struct Curl_handler Curl_handler_http;
- #ifdef USE_SSL
- extern const struct Curl_handler Curl_handler_https;
- #endif
- struct dynhds;
- CURLcode Curl_bump_headersize(struct Curl_easy *data,
- size_t delta,
- bool connect_only);
- bool Curl_compareheader(const char *headerline,
- const char *header,
- const size_t hlen,
- const char *content,
- const size_t clen);
- char *Curl_copy_header_value(const char *header);
- char *Curl_checkProxyheaders(struct Curl_easy *data,
- const struct connectdata *conn,
- 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
- );
- 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);
- CURLcode Curl_http_setup_conn(struct Curl_easy *data,
- struct connectdata *conn);
- CURLcode Curl_http(struct Curl_easy *data, bool *done);
- CURLcode Curl_http_done(struct Curl_easy *data, CURLcode, bool premature);
- CURLcode Curl_http_connect(struct Curl_easy *data, bool *done);
- int Curl_http_getsock_do(struct Curl_easy *data, struct connectdata *conn,
- curl_socket_t *socks);
- CURLcode Curl_http_write_resp(struct Curl_easy *data,
- const char *buf, size_t blen,
- bool is_eos);
- CURLcode Curl_http_write_resp_hd(struct Curl_easy *data,
- const char *hd, size_t hdlen,
- bool is_eos);
- CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
- const char *auth);
- CURLcode Curl_http_auth_act(struct Curl_easy *data);
- #define CURLAUTH_PICKNONE (1<<30)
- #ifndef MAX_INITIAL_POST_SIZE
- #define MAX_INITIAL_POST_SIZE (64*1024)
- #endif
- #ifndef EXPECT_100_THRESHOLD
- #define EXPECT_100_THRESHOLD (1024*1024)
- #endif
- #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);
- #endif
- 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);
- CURLcode
- Curl_http_output_auth(struct Curl_easy *data,
- struct connectdata *conn,
- const char *request,
- Curl_HttpReq httpreq,
- const char *path,
- bool proxytunnel);
- CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len);
- struct httpreq {
- char method[24];
- char *scheme;
- char *authority;
- char *path;
- struct dynhds headers;
- struct dynhds trailers;
- };
- CURLcode Curl_http_req_make(struct httpreq **preq,
- 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 httpreq **preq,
- const char *method, size_t m_len,
- CURLU *url, const char *scheme_default);
- void Curl_http_req_free(struct httpreq *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"
- CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers,
- struct httpreq *req, struct Curl_easy *data);
- struct http_resp {
- int status;
- char *description;
- struct dynhds headers;
- struct dynhds trailers;
- struct http_resp *prev;
- };
- CURLcode Curl_http_resp_make(struct http_resp **presp,
- int status,
- const char *description);
- void Curl_http_resp_free(struct http_resp *resp);
- #endif
|