211 {
212
213 self->locals.
handle = curl_easy_init();
214 assert(self->locals.
handle);
215
216 curl_easy_setopt(self->locals.
handle, CURLOPT_ERRORBUFFER, self->
error);
217 curl_easy_setopt(self->locals.
handle, CURLOPT_FOLLOWLOCATION,
true);
218
220 curl_easy_setopt(self->locals.
handle, CURLOPT_HEADERDATA, self);
221
222 curl_easy_setopt(self->locals.
handle, CURLOPT_XFERINFOFUNCTION,
progress);
223 curl_easy_setopt(self->locals.
handle, CURLOPT_XFERINFODATA, self);
224
226 if (body) {
227 curl_easy_setopt(self->locals.
handle, CURLOPT_POSTFIELDS, body->
bytes);
228 curl_easy_setopt(self->locals.
handle, CURLOPT_POSTFIELDSIZE, body->
length);
229 }
230
231 struct curl_slist *httpHeaders = NULL;
233
235 if (headers) {
237 }
238
240 if (headers) {
242 }
243
244 curl_easy_setopt(self->locals.
handle, CURLOPT_HTTPHEADER, httpHeaders);
245
247
250 curl_easy_setopt(self->locals.
handle, CURLOPT_POST,
true);
251 break;
253 curl_easy_setopt(self->locals.
handle, CURLOPT_PUT,
true);
254 break;
256 curl_easy_setopt(self->locals.
handle, CURLOPT_CUSTOMREQUEST,
"DELETE");
257 break;
259 curl_easy_setopt(self->locals.
handle, CURLOPT_NOBODY,
true);
260 break;
261 default:
262 break;
263 }
264
266}
static void requestHeaders_enumerator(const Dictionary *dictionary, ident obj, ident key, ident data)
A helper to populate the request headers list for CURL.
static size_t responseHeader(char *buffer, size_t size, size_t count, void *data)
The CURLOPT_HEADERFUNCTION for parsing response headers.
size_t length
The length of bytes.
uint8_t * bytes
The bytes.
Immutable key-value stores.
void enumerateObjectsAndKeys(const Dictionary *self, DictionaryEnumerator enumerator, ident data)
Enumerate the pairs of this Dictionary with the given function.
String * urlString
The URL String.
HTTPMethod httpMethod
The HTTP request method.
Dictionary * httpHeaders
The HTTP request headers.
Data * httpBody
The HTTP request body, sent as POST or PUT data.
Dictionary * httpHeaders
The HTTP headers added to every HTTP URLRequest.
URLSessionConfiguration * configuration
The session configuration.
ident requestHeaders
HTTP headers, in libcurl list structure.