gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -work on #6948


From: gnunet
Subject: [taler-exchange] branch master updated: -work on #6948
Date: Mon, 02 Aug 2021 19:48:42 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 3a6ae694 -work on #6948
3a6ae694 is described below

commit 3a6ae694ecba19af06d84906facbcb5f7d51d72b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Aug 2 19:48:37 2021 +0200

    -work on #6948
---
 src/include/taler_util.h |  9 +++++++++
 src/util/url.c           | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 33c126cb..59824a52 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -183,6 +183,15 @@ TALER_project_data_default (void);
 char *
 TALER_urlencode (const char *s);
 
+/**
+ * Test if all characters in @a url are valid for
+ * a URL.
+ *
+ * @param url URL to sanity-check
+ * @return true if @a url only contains valid characters
+ */
+bool
+TALER_url_valid_charset (const char *url);
 
 /**
  * Check if @a lang matches the @a language_pattern, and if so with
diff --git a/src/util/url.c b/src/util/url.c
index 5962a18b..3fbc4a04 100644
--- a/src/util/url.c
+++ b/src/util/url.c
@@ -365,4 +365,20 @@ TALER_url_absolute_raw (const char *proto,
 }
 
 
+bool
+TALER_url_valid_charset (const char *url)
+{
+  for (unsigned int i = 0; '\0' != url[i]; i++)
+  {
+#define ALLOWED_CHARACTERS \
+  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/:&?-.,=_~%"
+    if (NULL == strchr (ALLOWED_CHARACTERS,
+                        (int) url[i]))
+      return false;
+#undef ALLOWED_CHARACTERS
+  }
+  return true;
+}
+
+
 /* end of url.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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