1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# CURL wrapping functions reference.
## int curl_wrap_perform (CURL * curl, char **result, size_t * size)
Perform the CURL operation for 'curl' and put the result in memory. If 'result'
isn't NULL it receives the returned content that then must be freed. If 'size'
isn't NULL, it receives the size of the returned content. Note that if not NULL,
the real content is one byte greater than the read size and the last byte
zero. This facility allows to handle the returned content as a null terminated
C-string.
## void curl_wrap_do(CURL *curl, void (*callback)(void *closure, int status, CURL *curl, const char *result, size_t size), void *closure)
Will perform the CURL operation and on success invokes the callback with the
result and size of the operation or error on a failure.
## int curl_wrap_content_type_is (CURL * curl, const char *value)
Request `Content-Type` information from the curl session with this function
Returns non-zero value if the CURL content type match the `value` and 0 otherwize
## long curl_wrap_response_code_get(CURL *curl)
Request the response code to a CURL operation.
Returns the response code received on success or 0 on failure.
## CURL *curl_wrap_prepare_get_url(const char *url)
Prepare a GET CURL operation on the url given as parameter and Returns the CURL
pointer.
## CURL *curl_wrap_prepare_get(const char *base, const char *path, const char * const *args)
Prepare a GET CURL operation on the decomposed url and escape it. The `url` has been
decomposed in 3 parts:
* `base`: representing the FQDN of the url.
* `path`: the path to the requested page.
* `args`: optionnal array of arguments provided for the GET request.
Returns the prepared CURL request.
## int curl_wrap_add_header(CURL *curl, const char *header)
Add a header to a CURL operation.
Returns the prepared CURL request.
## int curl_wrap_add_header_value(CURL *curl, const char *name, const char *value)
Add a tuple `name`, `value` to the header of a CURL operation.
Returns the prepared CURL request.
## CURL *curl_wrap_prepare_post_url_data(const char *url, const char *datatype, const char *data, size_t szdata)
Prepare a POST CURL operation on the provided `url`.
* `url`: a HTTP url.
* `datatype`: HTTP `Content-Type` to use for the operation.
* `data`: data to send.
* `szdata`: size of the data to send.
Returns the prepared CURL request.
## CURL *curl_wrap_prepare_post_simple_unescaped(const char *base, const char *path, const char *args)
Prepare a POST CURL operation on an unescaped `url` with arguments provided as
a simple string.
* `base`: representing the FQDN of the url.
* `path`: the path to the requested page.
* `args`: optionnals argument for the POST http request.
Returns the prepared CURL request.
## CURL *curl_wrap_prepare_post_simple_escaped(const char *base, const char *path, char *args)
Prepare a POST CURL operation on an escaped `url` with arguments provided as
a simple string.
* `base`: representing the FQDN of the url.
* `path`: the path to the requested page.
* `args`: optionnals argument for the POST http request.
Returns the prepared CURL request.
## CURL *curl_wrap_prepare_post_unescaped(const char *base, const char *path, const char *separator, const char * const *args)
Prepare a POST CURL operation on an unescaped `url` with arguments provided as
an array of string concatened with a provided separator string.
* `base`: representing the FQDN of the url.
* `path`: the path to the requested page.
* `separator`: string used as a separator when concatening the arguments.
* `args`: optionnal array of arguments for the POST http request.
Returns the prepared CURL request.
## CURL *curl_wrap_prepare_post_escaped(const char *base, const char *path, const char * const *args)
Prepare a POST CURL operation on an unescaped `url` with arguments provided as
an array of string concatened without any separator.
* `base`: representing the FQDN of the url.
* `path`: the path to the requested page.
* `args`: optionnal array of arguments for the POST http request.
Returns the prepared CURL request.
|