[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: avoid boolean argument in GNUNET_CURL_jo
From: |
gnunet |
Subject: |
[gnunet] branch master updated: avoid boolean argument in GNUNET_CURL_job_add(), see #6188 |
Date: |
Thu, 16 Jul 2020 20:42:04 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new bbe0a0501 avoid boolean argument in GNUNET_CURL_job_add(), see #6188
bbe0a0501 is described below
commit bbe0a0501959db1add350cae54b86cbd59d48c77
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jul 16 20:36:12 2020 +0200
avoid boolean argument in GNUNET_CURL_job_add(), see #6188
---
src/curl/curl.c | 48 ++++++++++++++++++++++++++++++-------------
src/include/gnunet_curl_lib.h | 27 +++++++++++++++++++-----
2 files changed, 56 insertions(+), 19 deletions(-)
diff --git a/src/curl/curl.c b/src/curl/curl.c
index f43670944..b3d2af252 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -586,33 +586,27 @@ GNUNET_CURL_job_add2 (struct GNUNET_CURL_Context *ctx,
* 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.
+ * "Content-Type: application/json" header.
*
* @param ctx context to execute the job in
* @param eh curl easy handle for the request, will
* be executed AND cleaned up
- * @param add_json add "application/json" content type header
* @param jcc callback to invoke upon completion
* @param jcc_cls closure for @a jcc
* @return NULL on error (in this case, @eh is still released!)
*/
struct GNUNET_CURL_Job *
-GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
- CURL *eh,
- int add_json,
- GNUNET_CURL_JobCompletionCallback jcc,
- void *jcc_cls)
+GNUNET_CURL_job_add_with_ct_json (struct GNUNET_CURL_Context *ctx,
+ CURL *eh,
+ GNUNET_CURL_JobCompletionCallback jcc,
+ void *jcc_cls)
{
struct GNUNET_CURL_Job *job;
struct curl_slist *job_headers = NULL;
- if (GNUNET_YES == add_json)
- {
- GNUNET_assert (
- NULL != (job_headers =
- curl_slist_append (NULL, "Content-Type: application/json")));
- }
-
+ GNUNET_assert (NULL != (job_headers =
+ curl_slist_append (NULL,
+ "Content-Type:
application/json")));
job = GNUNET_CURL_job_add2 (ctx,
eh,
job_headers,
@@ -623,6 +617,32 @@ GNUNET_CURL_job_add (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.
+ *
+ * @param ctx context to execute the job in
+ * @param eh curl easy handle for the request, will
+ * be executed AND cleaned up
+ * @param jcc callback to invoke upon completion
+ * @param jcc_cls closure for @a jcc
+ * @return NULL on error (in this case, @eh is still released!)
+ */
+struct GNUNET_CURL_Job *
+GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
+ CURL *eh,
+ GNUNET_CURL_JobCompletionCallback jcc,
+ void *jcc_cls)
+{
+ return GNUNET_CURL_job_add2 (ctx,
+ eh,
+ NULL,
+ jcc,
+ jcc_cls);
+}
+
+
/**
* Cancel a job. Must only be called before the job completion
* callback is called for the respective job.
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 0bb337ee7..8f744512d 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -225,13 +225,9 @@ typedef void
* 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.
- *
* @param ctx context to execute the job in
* @param eh curl easy handle for the request, will
* be executed AND cleaned up
- * @param add_json add "application/json" content type header
* @param jcc callback to invoke upon completion
* @param jcc_cls closure for @a jcc
* @return NULL on error (in this case, @eh is still released!)
@@ -239,11 +235,32 @@ typedef void
struct GNUNET_CURL_Job *
GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
CURL *eh,
- int add_json,
GNUNET_CURL_JobCompletionCallback jcc,
void *jcc_cls);
+/**
+ * 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.
+ *
+ * @param ctx context to execute the job in
+ * @param eh curl easy handle for the request, will
+ * be executed AND cleaned up
+ * @param jcc callback to invoke upon completion
+ * @param jcc_cls closure for @a jcc
+ * @return NULL on error (in this case, @eh is still released!)
+ */
+struct GNUNET_CURL_Job *
+GNUNET_CURL_job_add_with_ct_json (struct GNUNET_CURL_Context *ctx,
+ CURL *eh,
+ GNUNET_CURL_JobCompletionCallback jcc,
+ void *jcc_cls);
+
+
/**
* Force use of the provided username and password
* for client authentication for all operations performed
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: avoid boolean argument in GNUNET_CURL_job_add(), see #6188,
gnunet <=