diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-03-15 22:06:28 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-03-15 22:06:28 +0100 |
commit | 7de26292b744122b20e9cd6ecea95a2273311587 (patch) | |
tree | 5df302bac6761c8645e18948870ded04a05862ea /src/curl | |
parent | eb903e5bfc4b979967cfe27c98a994264befb155 (diff) | |
download | gnunet-7de26292b744122b20e9cd6ecea95a2273311587.tar.gz gnunet-7de26292b744122b20e9cd6ecea95a2273311587.zip |
add function that logically belongs to libgnunetcurl instead of in multiple Taler binaries
Diffstat (limited to 'src/curl')
-rw-r--r-- | src/curl/curl.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/curl/curl.c b/src/curl/curl.c index 01c7c5fca..da486ecc1 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -189,7 +189,8 @@ GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, void *cb_cls) | |||
189 | 189 | ||
190 | if (curl_fail) | 190 | if (curl_fail) |
191 | { | 191 | { |
192 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Curl was not initialised properly\n"); | 192 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
193 | "Curl was not initialised properly\n"); | ||
193 | return NULL; | 194 | return NULL; |
194 | } | 195 | } |
195 | if (NULL == (multi = curl_multi_init ())) | 196 | if (NULL == (multi = curl_multi_init ())) |
@@ -228,6 +229,27 @@ GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx, | |||
228 | 229 | ||
229 | 230 | ||
230 | /** | 231 | /** |
232 | * Return #GNUNET_YES if given a valid scope ID and | ||
233 | * #GNUNET_NO otherwise. See #setup_job_headers, | ||
234 | * logic related to | ||
235 | * #GNUNET_CURL_enable_async_scope_header() for the | ||
236 | * code that generates such a @a scope_id. | ||
237 | * | ||
238 | * @returns #GNUNET_YES iff given a valid scope ID | ||
239 | */ | ||
240 | int | ||
241 | GNUNET_CURL_is_valid_scope_id (const char *scope_id) | ||
242 | { | ||
243 | if (strlen (scope_id) >= 64) | ||
244 | return GNUNET_NO; | ||
245 | for (size_t i = 0; i < strlen (scope_id); i++) | ||
246 | if (! (isalnum (scope_id[i]) || (scope_id[i] == '-'))) | ||
247 | return GNUNET_NO; | ||
248 | return GNUNET_YES; | ||
249 | } | ||
250 | |||
251 | |||
252 | /** | ||
231 | * Callback used when downloading the reply to an HTTP request. | 253 | * Callback used when downloading the reply to an HTTP request. |
232 | * Just appends all of the data to the `buf` in the | 254 | * Just appends all of the data to the `buf` in the |
233 | * `struct DownloadBuffer` for further processing. The size of | 255 | * `struct DownloadBuffer` for further processing. The size of |