gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: add function that logically belongs to l


From: gnunet
Subject: [gnunet] branch master updated: add function that logically belongs to libgnunetcurl instead of in multiple Taler binaries
Date: Sun, 15 Mar 2020 22:10:52 +0100

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 7de26292b add function that logically belongs to libgnunetcurl instead 
of in multiple Taler binaries
     new 16864fd3b Merge branch 'master' of git+ssh://gnunet.org/gnunet
7de26292b is described below

commit 7de26292b744122b20e9cd6ecea95a2273311587
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Mar 15 22:06:28 2020 +0100

    add function that logically belongs to libgnunetcurl instead of in multiple 
Taler binaries
---
 src/curl/curl.c               | 24 +++++++++++++++++++++++-
 src/include/gnunet_curl_lib.h | 17 +++++++++++++++--
 2 files changed, 38 insertions(+), 3 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)
 
   if (curl_fail)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Curl was not initialised 
properly\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Curl was not initialised properly\n");
     return NULL;
   }
   if (NULL == (multi = curl_multi_init ()))
@@ -227,6 +228,27 @@ GNUNET_CURL_enable_async_scope_header (struct 
GNUNET_CURL_Context *ctx,
 }
 
 
+/**
+ * Return #GNUNET_YES if given a valid scope ID and
+ * #GNUNET_NO otherwise.  See #setup_job_headers,
+ * logic related to
+ * #GNUNET_CURL_enable_async_scope_header() for the
+ * code that generates such a @a scope_id.
+ *
+ * @returns #GNUNET_YES iff given a valid scope ID
+ */
+int
+GNUNET_CURL_is_valid_scope_id (const char *scope_id)
+{
+  if (strlen (scope_id) >= 64)
+    return GNUNET_NO;
+  for (size_t i = 0; i < strlen (scope_id); i++)
+    if (! (isalnum (scope_id[i]) || (scope_id[i] == '-')))
+      return GNUNET_NO;
+  return GNUNET_YES;
+}
+
+
 /**
  * Callback used when downloading the reply to an HTTP request.
  * Just appends all of the data to the `buf` in the
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 8e981e91e..875cfa3bd 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -360,8 +360,21 @@ GNUNET_CURL_gnunet_scheduler_reschedule (void *cls);
  * @param header_name name of the header to send.
  */
 void
-GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx, const
-                                       char *header_name);
+GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx,
+                                       const char *header_name);
+
+
+/**
+ * Return #GNUNET_YES if given a valid scope ID and
+ * #GNUNET_NO otherwise.  See
+ * #GNUNET_CURL_enable_async_scope_header() for the
+ * code that generates such a @a scope_id in an HTTP
+ * header.
+ *
+ * @returns #GNUNET_YES iff given a valid scope ID
+ */
+int
+GNUNET_CURL_is_valid_scope_id (const char *scope_id);
 
 
 #endif

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]