summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-09-02 18:07:03 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-09-02 21:35:40 +0200
commitfe1a864e4a6739ad07d890cd47f8cf180a3d1cdf (patch)
tree17cd4c5c9d36099401e8b2fcc2add37abeec91db
parentc07461a56c22a7263166fd8debff9d3fca452e8e (diff)
downloadlibrest-fe1a864e4a6739ad07d890cd47f8cf180a3d1cdf.tar.gz
flickr: Fix function setting regression
Since commit c66b6d, RestProxyCall::url is regenerated after calling the RestProxyCall::prepare virtual method. This breaks the flickr code as it needs to reset RestProxyCall::url in order to remove the function from it. It used to do that by directly accessing RestProxyCall private data. Since c66b6d, this can be solved using only public methods as if the function is reset on the RestProxyCall in ::prepare, ::url will be regenerated to reflect that after ::prepare and ::serialize_params have been called. https://bugzilla.gnome.org/show_bug.cgi?id=708359
-rw-r--r--rest-extras/flickr-proxy-call.c12
-rw-r--r--rest-extras/flickr-proxy.c4
2 files changed, 10 insertions, 6 deletions
diff --git a/rest-extras/flickr-proxy-call.c b/rest-extras/flickr-proxy-call.c
index a9bc6f7..d03f919 100644
--- a/rest-extras/flickr-proxy-call.c
+++ b/rest-extras/flickr-proxy-call.c
@@ -70,13 +70,17 @@ _prepare (RestProxyCall *call, GError **error)
priv = FLICKR_PROXY_GET_PRIVATE (proxy);
call_priv = call->priv;
- /* We need to reset the URL because Flickr puts the function in the parameters */
if (GET_PRIVATE (call)->upload) {
- call_priv->url = g_strdup ("http://api.flickr.com/services/upload/");
+ rest_proxy_bind (REST_PROXY(proxy), "upload");
+ rest_proxy_call_set_function (call, NULL);
} else {
- call_priv->url = g_strdup ("http://api.flickr.com/services/rest/");
- rest_proxy_call_add_param (call, "method", call_priv->function);
+ rest_proxy_bind (REST_PROXY(proxy), "rest");
+ rest_proxy_call_add_param (call, "method",
+ rest_proxy_call_get_function (call));
+ /* We need to reset the function because Flickr puts the function in the
+ * parameters, not in the base URL */
+ rest_proxy_call_set_function (call, NULL);
}
rest_proxy_call_add_param (call, "api_key", priv->api_key);
diff --git a/rest-extras/flickr-proxy.c b/rest-extras/flickr-proxy.c
index 5b7d960..48f1c86 100644
--- a/rest-extras/flickr-proxy.c
+++ b/rest-extras/flickr-proxy.c
@@ -188,8 +188,8 @@ flickr_proxy_new_with_token (const char *api_key,
"api-key", api_key,
"shared-secret", shared_secret,
"token", token,
- "url-format", "http://api.flickr.com/services/rest/",
- "binding-required", FALSE,
+ "url-format", "http://api.flickr.com/services/%s/",
+ "binding-required", TRUE,
NULL);
}