summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-23 16:52:26 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-23 16:52:34 +0200
commitef86866cee09c03bf426f1c84c15ecae0e5ba39d (patch)
tree52b376aa6fedbbc362d82412fb458371493c8cb0
parenta57d476abbe857365aff157f389cc1188b5dd090 (diff)
add function GNUNET_CURL_extend_headers()
-rw-r--r--src/curl/curl.c27
-rw-r--r--src/include/gnunet_curl_lib.h22
-rw-r--r--src/include/gnunet_setu_service.h1
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,
/**
+ * Add @a extra_headers to the HTTP headers for @a job.
+ *
+ * @param[in,out] job the job to modify
+ * @param extra_headers headers to append
+ */
+void
+GNUNET_CURL_extend_headers (struct GNUNET_CURL_Job *job,
+ const struct curl_slist *extra_headers)
+{
+ struct curl_slist *all_headers = job->job_headers;
+
+ for (const struct curl_slist *curr = extra_headers;
+ NULL != curr;
+ curr = curr->next)
+ {
+ GNUNET_assert (NULL !=
+ (all_headers = curl_slist_append (all_headers,
+ curr->data)));
+ }
+ job->job_headers = all_headers;
+}
+
+
+/**
* Schedule a CURL request to be executed and call the given @a jcc
* upon its completion. Note that the context will make use of the
* CURLOPT_PRIVATE facility of the CURL @a eh. Used to download
@@ -864,7 +888,8 @@ do_benchmark (CURLMsg *cmsg)
curl -w "foo%{size_request} -XPOST --data "ABC" $URL
the CURLINFO_REQUEST_SIZE should be the whole size of the request
including headers and body.
- */GNUNET_break (size_curl <= size_long);
+ *///
+ GNUNET_break (size_curl <= size_long);
urd = get_url_benchmark_data (url, (unsigned int) response_code);
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,
/**
- * Force use of the provided TLS client certificate
- * for client authentication for all operations performed
- * with @a ctx.
+ * Force use of the provided TLS client certificate for client authentication
+ * for all operations performed with @a ctx.
*
* Note that if the provided information is incorrect,
* the earliest operation that could fail is
@@ -298,9 +297,9 @@ GNUNET_CURL_set_tlscert (struct GNUNET_CURL_Context *ctx,
/**
- * Schedule a CURL request to be executed and call the given @a jcc
- * upon its completion. Note that the context will make use of the
- * CURLOPT_PRIVATE facility of the CURL @a eh.
+ * Schedule a CURL request to be executed and call the given @a jcc upon its
+ * completion. Note that the context will make use of the CURLOPT_PRIVATE
+ * facility of the CURL @a eh.
*
* This function modifies the CURL handle to add the
* "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,
/**
+ * Add @a extra_headers to the HTTP headers for @a job.
+ *
+ * @param[in,out] job the job to modify
+ * @param extra_headers headers to append
+ */
+void
+GNUNET_CURL_extend_headers (struct GNUNET_CURL_Job *job,
+ const struct curl_slist *extra_headers);
+
+
+/**
* Cancel a job. Must only be called before the job completion
* callback is called for the respective job.
*
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
/**
* Notify client also if we are sending a value to the other peer.
- * FIXME: not implemented!
*/
GNUNET_SETU_OPTION_SYMMETRIC = 8
};