]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/thirdparty/curl/lib/http.h
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / thirdparty / curl / lib / http.h
1 #ifndef HEADER_CURL_HTTP_H
2 #define HEADER_CURL_HTTP_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24 #ifndef CURL_DISABLE_HTTP
25
26 extern const struct Curl_handler Curl_handler_http;
27
28 #ifdef USE_SSL
29 extern const struct Curl_handler Curl_handler_https;
30 #endif
31
32 bool Curl_compareheader(const char *headerline,  /* line to check */
33                         const char *header,   /* header keyword _with_ colon */
34                         const char *content); /* content string to find */
35
36 char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader);
37
38 /* ------------------------------------------------------------------------- */
39 /*
40  * The add_buffer series of functions are used to build one large memory chunk
41  * from repeated function invokes. Used so that the entire HTTP request can
42  * be sent in one go.
43  */
44 struct Curl_send_buffer {
45   char *buffer;
46   size_t size_max;
47   size_t size_used;
48 };
49 typedef struct Curl_send_buffer Curl_send_buffer;
50
51 Curl_send_buffer *Curl_add_buffer_init(void);
52 CURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...);
53 CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size);
54 CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
55                               struct connectdata *conn,
56                               long *bytes_written,
57                               size_t included_body_bytes,
58                               int socketindex);
59
60 CURLcode Curl_add_timecondition(struct SessionHandle *data,
61                                 Curl_send_buffer *buf);
62 CURLcode Curl_add_custom_headers(struct connectdata *conn,
63                                    Curl_send_buffer *req_buffer);
64
65 /* protocol-specific functions set up to be called by the main engine */
66 CURLcode Curl_http(struct connectdata *conn, bool *done);
67 CURLcode Curl_http_done(struct connectdata *, CURLcode, bool premature);
68 CURLcode Curl_http_connect(struct connectdata *conn, bool *done);
69
70 /* The following functions are defined in http_chunks.c */
71 void Curl_httpchunk_init(struct connectdata *conn);
72 CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
73                               ssize_t length, ssize_t *wrote);
74
75 /* These functions are in http.c */
76 void Curl_http_auth_stage(struct SessionHandle *data, int stage);
77 CURLcode Curl_http_input_auth(struct connectdata *conn,
78                               int httpcode, const char *header);
79 CURLcode Curl_http_auth_act(struct connectdata *conn);
80 CURLcode Curl_http_perhapsrewind(struct connectdata *conn);
81
82 /* If only the PICKNONE bit is set, there has been a round-trip and we
83    selected to use no auth at all. Ie, we actively select no auth, as opposed
84    to not having one selected. The other CURLAUTH_* defines are present in the
85    public curl/curl.h header. */
86 #define CURLAUTH_PICKNONE (1<<30) /* don't use auth */
87
88 /* MAX_INITIAL_POST_SIZE indicates the number of bytes that will make the POST
89    data get included in the initial data chunk sent to the server. If the
90    data is larger than this, it will automatically get split up in multiple
91    system calls.
92
93    This value used to be fairly big (100K), but we must take into account that
94    if the server rejects the POST due for authentication reasons, this data
95    will always be uncondtionally sent and thus it may not be larger than can
96    always be afforded to send twice.
97
98    It must not be greater than 64K to work on VMS.
99 */
100 #ifndef MAX_INITIAL_POST_SIZE
101 #define MAX_INITIAL_POST_SIZE (64*1024)
102 #endif
103
104 #ifndef TINY_INITIAL_POST_SIZE
105 #define TINY_INITIAL_POST_SIZE 1024
106 #endif
107
108 #endif /* CURL_DISABLE_HTTP */
109
110 /****************************************************************************
111  * HTTP unique setup
112  ***************************************************************************/
113 struct HTTP {
114   struct FormData *sendit;
115   curl_off_t postsize; /* off_t to handle large file sizes */
116   const char *postdata;
117
118   const char *p_pragma;      /* Pragma: string */
119   const char *p_accept;      /* Accept: string */
120   curl_off_t readbytecount;
121   curl_off_t writebytecount;
122
123   /* For FORM posting */
124   struct Form form;
125
126   struct back {
127     curl_read_callback fread_func; /* backup storage for fread pointer */
128     void *fread_in;           /* backup storage for fread_in pointer */
129     const char *postdata;
130     curl_off_t postsize;
131   } backup;
132
133   enum {
134     HTTPSEND_NADA,    /* init */
135     HTTPSEND_REQUEST, /* sending a request */
136     HTTPSEND_BODY,    /* sending body */
137     HTTPSEND_LAST     /* never use this */
138   } sending;
139
140   void *send_buffer; /* used if the request couldn't be sent in one chunk,
141                         points to an allocated send_buffer struct */
142 };
143
144 CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
145                                      struct connectdata *conn,
146                                      ssize_t *nread,
147                                      bool *stop_reading);
148
149 /**
150  * Curl_http_output_auth() setups the authentication headers for the
151  * host/proxy and the correct authentication
152  * method. conn->data->state.authdone is set to TRUE when authentication is
153  * done.
154  *
155  * @param conn all information about the current connection
156  * @param request pointer to the request keyword
157  * @param path pointer to the requested path
158  * @param proxytunnel boolean if this is the request setting up a "proxy
159  * tunnel"
160  *
161  * @returns CURLcode
162  */
163 CURLcode
164 Curl_http_output_auth(struct connectdata *conn,
165                       const char *request,
166                       const char *path,
167                       bool proxytunnel); /* TRUE if this is the request setting
168                                             up the proxy tunnel */
169
170 #endif /* HEADER_CURL_HTTP_H */
171