diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-16 21:57:40 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-16 21:57:40 +0100 |
commit | a9ae2171b897dfc9635e9ab72a04d65379bf2208 (patch) | |
tree | 11d67216d1c5594a4048d333b56ac40b4cf0acd1 /src/lib/exchange_api_handle.c | |
parent | dd6bad739a7b7539952af6bebb74bfe3ffa0f9d7 (diff) |
reuse TALER_url_join
Diffstat (limited to 'src/lib/exchange_api_handle.c')
-rw-r--r-- | src/lib/exchange_api_handle.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index c7b402b5e..c3a0598f8 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -1415,34 +1415,14 @@ char * TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h, const char *path) { - return TEAH_path_to_url2 (h->url, - path); -} - - -/** - * Obtain the URL to use for an API request. - * FIXME: duplicates MAH_path_to_url2, and likely also logic in util! - * - * @param base_url base URL of the exchange (i.e. "http://exchange/") - * @param path Taler API path (i.e. "/reserve/withdraw") - * @return the full URL to use with cURL - */ -char * -TEAH_path_to_url2 (const char *base_url, - const char *path) -{ - char *url; - - if ( ('/' == path[0]) && - (0 < strlen (base_url)) && - ('/' == base_url[strlen (base_url) - 1]) ) - path++; /* avoid generating URL with "//" from concat */ - GNUNET_asprintf (&url, - "%s%s", - base_url, - path); - return url; + char *ret; + + GNUNET_assert ('/' == path[0]); + ret = TALER_url_join (h->url, + path + 1, + NULL); + GNUNET_assert (NULL != ret); + return ret; } |