summaryrefslogtreecommitdiff
path: root/src/include/taler_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_util.h')
-rw-r--r--src/include/taler_util.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 84d4f5dee..407521c6e 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -22,6 +22,7 @@
#define TALER_UTIL_H
#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
#include "taler_amount_lib.h"
#include "taler_crypto_lib.h"
@@ -134,4 +135,62 @@ const struct GNUNET_OS_ProjectData *
TALER_project_data_default (void);
+/**
+ * URL-encode a string according to rfc3986.
+ *
+ * @param s string to encode
+ * @returns the urlencoded string, the caller must free it with GNUNET_free
+ */
+char *
+TALER_urlencode (const char *s);
+
+
+/**
+ * Make an absolute URL with query parameters.
+ *
+ * @param base_url absolute base URL to use
+ * @param path path of the url
+ * @param ... NULL-terminated key-value pairs (char *) for query parameters,
+ * only the value will be url-encoded
+ * @returns the URL, must be freed with #GNUNET_free
+ */
+char *
+TALER_url_join (const char *base_url,
+ const char *path,
+ ...);
+
+
+/**
+ * Make an absolute URL for the given parameters.
+ *
+ * @param proto protocol for the URL (typically https)
+ * @param host hostname for the URL
+ * @param prefix prefix for the URL
+ * @param path path for the URL
+ * @param ... NULL-terminated key-value pairs (char *) for query parameters,
+ * the value will be url-encoded
+ * @returns the URL, must be freed with #GNUNET_free
+ */
+char *
+TALER_url_absolute_raw (const char *proto,
+ const char *host,
+ const char *prefix,
+ const char *path,
+ ...);
+
+
+/**
+ * Make an absolute URL for a given MHD connection.
+ *
+ * @param path path of the url
+ * @param ... NULL-terminated key-value pairs (char *) for query parameters,
+ * the value will be url-encoded
+ * @returns the URL, must be freed with #GNUNET_free
+ */
+char *
+TALER_url_absolute_mhd (struct MHD_Connection *connection,
+ const char *path,
+ ...);
+
+
#endif