diff options
author | Jeff Burdges <burdges@gnunet.org> | 2016-06-14 16:52:33 +0200 |
---|---|---|
committer | Jeff Burdges <burdges@gnunet.org> | 2016-06-14 16:52:33 +0200 |
commit | 877c5d918015164d1c1234e473984b8fd030efdb (patch) | |
tree | 2907e81cb8901beca7c3b8b7fe35023f9169fd77 /src/exchange-lib/exchange_api_handle.c | |
parent | de55e59207b3d65703b534f7bf951adcc79ec007 (diff) | |
parent | 7b9272d3e8cb4c540c876bc4e10875d45971214b (diff) |
Merge branch 'master' of git.taler.net:/var/git/exchange
Diffstat (limited to 'src/exchange-lib/exchange_api_handle.c')
-rw-r--r-- | src/exchange-lib/exchange_api_handle.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/exchange-lib/exchange_api_handle.c b/src/exchange-lib/exchange_api_handle.c index b9104869..318fd9e6 100644 --- a/src/exchange-lib/exchange_api_handle.c +++ b/src/exchange-lib/exchange_api_handle.c @@ -779,23 +779,39 @@ MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h) /** * Obtain the URL to use for an API request. * - * @param h the exchange handle to query + * @param base_url base URL of the exchange (i.e. "http://exchange/") * @param path Taler API path (i.e. "/reserve/withdraw") * @return the full URI to use with cURL */ char * -MAH_path_to_url (struct TALER_EXCHANGE_Handle *h, +MAH_path_to_url (struct TALER_EXCHANGE_Handle *exchange, const char *path) { + return MAH_path_to_url2 (exchange->url, + path); +} + + +/** + * Obtain the URL to use for an API request. + * + * @param base_url base URL of the exchange (i.e. "http://exchange/") + * @param path Taler API path (i.e. "/reserve/withdraw") + * @return the full URI to use with cURL + */ +char * +MAH_path_to_url2 (const char *base_url, + const char *path) +{ char *url; if ( ('/' == path[0]) && - (0 < strlen (h->url)) && - ('/' == h->url[strlen (h->url) - 1]) ) + (0 < strlen (base_url)) && + ('/' == base_url[strlen (base_url) - 1]) ) path++; /* avoid generating URL with "//" from concat */ GNUNET_asprintf (&url, "%s%s", - h->url, + base_url, path); return url; } |