| 59 int socketfd; |
61 int socketfd; |
| 60 |
62 |
| 61 HeaderArray *request_headers; |
63 HeaderArray *request_headers; |
| 62 HeaderArray *response_headers; |
64 HeaderArray *response_headers; |
| 63 |
65 |
| |
66 /* |
| |
67 * request content length |
| |
68 * 0: no request body |
| |
69 * > 0: request body with static length |
| |
70 * -1: request body with chunked transfer encoding |
| |
71 */ |
| |
72 int64_t req_content_length; |
| |
73 |
| 64 int error; |
74 int error; |
| 65 int statuscode; |
75 int statuscode; |
| 66 |
76 |
| 67 /* |
77 /* |
| 68 * Request body callback function |
78 * Request body callback function |
| 69 * |
79 * |
| 70 * size_t request_body_read(HttpClient *client, void *buf, size_t size, void *userdata) |
80 * ssize_t request_body_read(HttpClient *client, void *buf, size_t size, void *userdata) |
| |
81 * |
| |
82 * Return: number of processed bytes, |
| |
83 * HTTP_CLIENT_CALLBACK_WOULD_BLOCK or HTTP_CLIENT_CALLBACK_ERROR. |
| 71 */ |
84 */ |
| 72 // TODO: fix, doesn't work this way |
85 ssize_t (*request_body_read)(HttpClient *, void *, size_t, void *); |
| 73 //size_t (*request_body_read)(HttpClient *, void *, size_t, void *); |
86 void *request_body_read_userdata; |
| 74 //void *request_body_read_userdata; |
|
| 75 |
87 |
| 76 /* |
88 /* |
| 77 * Response start callback function |
89 * Response start callback function |
| 78 * |
90 * |
| 79 * int response_start(HttpClient *client, int status, char *message, void *userdata) |
91 * int response_start(HttpClient *client, int status, char *message, void *userdata) |
| 146 * This functions creates a copy of name/value and the original pointers can be |
161 * This functions creates a copy of name/value and the original pointers can be |
| 147 * discarded after the function returns. |
162 * discarded after the function returns. |
| 148 */ |
163 */ |
| 149 int http_client_add_request_header_copy(HttpClient *client, cxstring name, cxstring value); |
164 int http_client_add_request_header_copy(HttpClient *client, cxstring name, cxstring value); |
| 150 |
165 |
| |
166 /* |
| |
167 * Sets the content length for the request body |
| |
168 */ |
| |
169 int http_client_set_content_length(HttpClient *client, int64_t contentlength); |
| |
170 |
| |
171 /* |
| |
172 * Enables a request body with a chunked transfer encoding |
| |
173 */ |
| |
174 int http_client_enable_chunked_transfer_encoding(HttpClient *client); |
| |
175 |
| 151 int http_client_start(HttpClient *client); |
176 int http_client_start(HttpClient *client); |
| 152 |
177 |
| 153 |
178 |
| 154 void http_client_add_tests(CxTestSuite *suite); |
179 void http_client_add_tests(CxTestSuite *suite); |
| 155 |
180 |