diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-08-23 16:52:26 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-08-23 16:52:34 +0200 |
commit | ef86866cee09c03bf426f1c84c15ecae0e5ba39d (patch) | |
tree | 52b376aa6fedbbc362d82412fb458371493c8cb0 /src | |
parent | a57d476abbe857365aff157f389cc1188b5dd090 (diff) | |
download | gnunet-ef86866cee09c03bf426f1c84c15ecae0e5ba39d.tar.gz gnunet-ef86866cee09c03bf426f1c84c15ecae0e5ba39d.zip |
add function GNUNET_CURL_extend_headers()
Diffstat (limited to 'src')
-rw-r--r-- | src/curl/curl.c | 27 | ||||
-rw-r--r-- | src/include/gnunet_curl_lib.h | 22 | ||||
-rw-r--r-- | src/include/gnunet_setu_service.h | 1 |
3 files changed, 42 insertions, 8 deletions
diff --git a/src/curl/curl.c b/src/curl/curl.c index eb9dd6a29..d89c97176 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -472,6 +472,30 @@ setup_job (CURL *eh, | |||
472 | 472 | ||
473 | 473 | ||
474 | /** | 474 | /** |
475 | * Add @a extra_headers to the HTTP headers for @a job. | ||
476 | * | ||
477 | * @param[in,out] job the job to modify | ||
478 | * @param extra_headers headers to append | ||
479 | */ | ||
480 | void | ||
481 | GNUNET_CURL_extend_headers (struct GNUNET_CURL_Job *job, | ||
482 | const struct curl_slist *extra_headers) | ||
483 | { | ||
484 | struct curl_slist *all_headers = job->job_headers; | ||
485 | |||
486 | for (const struct curl_slist *curr = extra_headers; | ||
487 | NULL != curr; | ||
488 | curr = curr->next) | ||
489 | { | ||
490 | GNUNET_assert (NULL != | ||
491 | (all_headers = curl_slist_append (all_headers, | ||
492 | curr->data))); | ||
493 | } | ||
494 | job->job_headers = all_headers; | ||
495 | } | ||
496 | |||
497 | |||
498 | /** | ||
475 | * Schedule a CURL request to be executed and call the given @a jcc | 499 | * Schedule a CURL request to be executed and call the given @a jcc |
476 | * upon its completion. Note that the context will make use of the | 500 | * upon its completion. Note that the context will make use of the |
477 | * CURLOPT_PRIVATE facility of the CURL @a eh. Used to download | 501 | * CURLOPT_PRIVATE facility of the CURL @a eh. Used to download |
@@ -864,7 +888,8 @@ do_benchmark (CURLMsg *cmsg) | |||
864 | curl -w "foo%{size_request} -XPOST --data "ABC" $URL | 888 | curl -w "foo%{size_request} -XPOST --data "ABC" $URL |
865 | the CURLINFO_REQUEST_SIZE should be the whole size of the request | 889 | the CURLINFO_REQUEST_SIZE should be the whole size of the request |
866 | including headers and body. | 890 | including headers and body. |
867 | */GNUNET_break (size_curl <= size_long); | 891 | */// |
892 | GNUNET_break (size_curl <= size_long); | ||
868 | 893 | ||
869 | urd = get_url_benchmark_data (url, (unsigned int) response_code); | 894 | urd = get_url_benchmark_data (url, (unsigned int) response_code); |
870 | urd->count++; | 895 | urd->count++; |
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index 9de58d608..f291d6b14 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h | |||
@@ -275,9 +275,8 @@ GNUNET_CURL_set_userpass (struct GNUNET_CURL_Context *ctx, | |||
275 | 275 | ||
276 | 276 | ||
277 | /** | 277 | /** |
278 | * Force use of the provided TLS client certificate | 278 | * Force use of the provided TLS client certificate for client authentication |
279 | * for client authentication for all operations performed | 279 | * for all operations performed with @a ctx. |
280 | * with @a ctx. | ||
281 | * | 280 | * |
282 | * Note that if the provided information is incorrect, | 281 | * Note that if the provided information is incorrect, |
283 | * the earliest operation that could fail is | 282 | * the earliest operation that could fail is |
@@ -298,9 +297,9 @@ GNUNET_CURL_set_tlscert (struct GNUNET_CURL_Context *ctx, | |||
298 | 297 | ||
299 | 298 | ||
300 | /** | 299 | /** |
301 | * Schedule a CURL request to be executed and call the given @a jcc | 300 | * Schedule a CURL request to be executed and call the given @a jcc upon its |
302 | * upon its completion. Note that the context will make use of the | 301 | * completion. Note that the context will make use of the CURLOPT_PRIVATE |
303 | * CURLOPT_PRIVATE facility of the CURL @a eh. | 302 | * facility of the CURL @a eh. |
304 | * | 303 | * |
305 | * This function modifies the CURL handle to add the | 304 | * This function modifies the CURL handle to add the |
306 | * "Content-Type: application/json" header if @a add_json is set. | 305 | * "Content-Type: application/json" header if @a add_json is set. |
@@ -345,6 +344,17 @@ GNUNET_CURL_job_add_raw (struct GNUNET_CURL_Context *ctx, | |||
345 | 344 | ||
346 | 345 | ||
347 | /** | 346 | /** |
347 | * Add @a extra_headers to the HTTP headers for @a job. | ||
348 | * | ||
349 | * @param[in,out] job the job to modify | ||
350 | * @param extra_headers headers to append | ||
351 | */ | ||
352 | void | ||
353 | GNUNET_CURL_extend_headers (struct GNUNET_CURL_Job *job, | ||
354 | const struct curl_slist *extra_headers); | ||
355 | |||
356 | |||
357 | /** | ||
348 | * Cancel a job. Must only be called before the job completion | 358 | * Cancel a job. Must only be called before the job completion |
349 | * callback is called for the respective job. | 359 | * callback is called for the respective job. |
350 | * | 360 | * |
diff --git a/src/include/gnunet_setu_service.h b/src/include/gnunet_setu_service.h index 459a6156b..634c5c40b 100644 --- a/src/include/gnunet_setu_service.h +++ b/src/include/gnunet_setu_service.h | |||
@@ -162,7 +162,6 @@ enum GNUNET_SETU_OptionType | |||
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Notify client also if we are sending a value to the other peer. | 164 | * Notify client also if we are sending a value to the other peer. |
165 | * FIXME: not implemented! | ||
166 | */ | 165 | */ |
167 | GNUNET_SETU_OPTION_SYMMETRIC = 8 | 166 | GNUNET_SETU_OPTION_SYMMETRIC = 8 |
168 | }; | 167 | }; |