Go to the documentation of this file.00001 #ifndef HEADER_CURL_HTTP_H
00002 #define HEADER_CURL_HTTP_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "curl_setup.h"
00025
00026 #ifndef CURL_DISABLE_HTTP
00027
00028 #ifdef USE_NGHTTP2
00029 #include <nghttp2/nghttp2.h>
00030 #endif
00031
00032 extern const struct Curl_handler Curl_handler_http;
00033
00034 #ifdef USE_SSL
00035 extern const struct Curl_handler Curl_handler_https;
00036 #endif
00037
00038
00039 bool Curl_compareheader(const char *headerline,
00040 const char *header,
00041 const char *content);
00042
00043 char *Curl_checkheaders(const struct connectdata *conn,
00044 const char *thisheader);
00045 char *Curl_copy_header_value(const char *header);
00046
00047 char *Curl_checkProxyheaders(const struct connectdata *conn,
00048 const char *thisheader);
00049
00050
00051
00052
00053
00054
00055 struct Curl_send_buffer {
00056 char *buffer;
00057 size_t size_max;
00058 size_t size_used;
00059 };
00060 typedef struct Curl_send_buffer Curl_send_buffer;
00061
00062 Curl_send_buffer *Curl_add_buffer_init(void);
00063 void Curl_add_buffer_free(Curl_send_buffer *buff);
00064 CURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...);
00065 CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size);
00066 CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
00067 struct connectdata *conn,
00068 long *bytes_written,
00069 size_t included_body_bytes,
00070 int socketindex);
00071
00072 CURLcode Curl_add_timecondition(struct Curl_easy *data,
00073 Curl_send_buffer *buf);
00074 CURLcode Curl_add_custom_headers(struct connectdata *conn,
00075 bool is_connect,
00076 Curl_send_buffer *req_buffer);
00077
00078
00079 CURLcode Curl_http(struct connectdata *conn, bool *done);
00080 CURLcode Curl_http_done(struct connectdata *, CURLcode, bool premature);
00081 CURLcode Curl_http_connect(struct connectdata *conn, bool *done);
00082 CURLcode Curl_http_setup_conn(struct connectdata *conn);
00083
00084
00085 void Curl_httpchunk_init(struct connectdata *conn);
00086 CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
00087 ssize_t length, ssize_t *wrote);
00088
00089
00090 void Curl_http_auth_stage(struct Curl_easy *data, int stage);
00091 CURLcode Curl_http_input_auth(struct connectdata *conn, bool proxy,
00092 const char *auth);
00093 CURLcode Curl_http_auth_act(struct connectdata *conn);
00094 CURLcode Curl_http_perhapsrewind(struct connectdata *conn);
00095
00096
00097
00098
00099
00100 #define CURLAUTH_PICKNONE (1<<30)
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 #ifndef MAX_INITIAL_POST_SIZE
00115 #define MAX_INITIAL_POST_SIZE (64*1024)
00116 #endif
00117
00118 #ifndef TINY_INITIAL_POST_SIZE
00119 #define TINY_INITIAL_POST_SIZE 1024
00120 #endif
00121
00122 #endif
00123
00124
00125
00126
00127 struct HTTP {
00128 struct FormData *sendit;
00129 curl_off_t postsize;
00130 const char *postdata;
00131
00132 const char *p_pragma;
00133 const char *p_accept;
00134 curl_off_t readbytecount;
00135 curl_off_t writebytecount;
00136
00137
00138 struct Form form;
00139
00140 struct back {
00141 curl_read_callback fread_func;
00142 void *fread_in;
00143 const char *postdata;
00144 curl_off_t postsize;
00145 } backup;
00146
00147 enum {
00148 HTTPSEND_NADA,
00149 HTTPSEND_REQUEST,
00150 HTTPSEND_BODY,
00151 HTTPSEND_LAST
00152 } sending;
00153
00154 void *send_buffer;
00155
00156
00157 #ifdef USE_NGHTTP2
00158
00159 int32_t stream_id;
00160
00161 bool bodystarted;
00162
00163 Curl_send_buffer *header_recvbuf;
00164 size_t nread_header_recvbuf;
00165
00166 Curl_send_buffer *trailer_recvbuf;
00167 int status_code;
00168 const uint8_t *pausedata;
00169 size_t pauselen;
00170 bool closed;
00171 bool close_handled;
00172 uint32_t error_code;
00173
00174 char *mem;
00175 size_t len;
00176 size_t memlen;
00177
00178 const uint8_t *upload_mem;
00179 size_t upload_len;
00180 curl_off_t upload_left;
00181
00182 char **push_headers;
00183 size_t push_headers_used;
00184 size_t push_headers_alloc;
00185 #endif
00186 };
00187
00188 typedef int (*sending)(void);
00189 typedef int (*recving)(void);
00190
00191 #ifdef USE_NGHTTP2
00192
00193 struct h2settings {
00194 uint32_t max_concurrent_streams;
00195 bool enable_push;
00196 };
00197 #endif
00198
00199
00200 struct http_conn {
00201 #ifdef USE_NGHTTP2
00202 #define H2_BINSETTINGS_LEN 80
00203 nghttp2_session *h2;
00204 uint8_t binsettings[H2_BINSETTINGS_LEN];
00205 size_t binlen;
00206 sending send_underlying;
00207 recving recv_underlying;
00208 char *inbuf;
00209 size_t inbuflen;
00210 size_t nread_inbuf;
00211
00212
00213
00214
00215
00216 int32_t pause_stream_id;
00217
00218 size_t drain_total;
00219
00220
00221 struct h2settings settings;
00222 #else
00223 int unused;
00224 #endif
00225 };
00226
00227 CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
00228 struct connectdata *conn,
00229 ssize_t *nread,
00230 bool *stop_reading);
00231
00246 CURLcode
00247 Curl_http_output_auth(struct connectdata *conn,
00248 const char *request,
00249 const char *path,
00250 bool proxytunnel);
00251
00252
00253 #endif
00254