--- a/libpurple/protocols/facebook/api.c Sat Oct 12 04:38:00 2019 -0400
+++ b/libpurple/protocols/facebook/api.c Sat Oct 12 22:32:50 2019 -0400
@@ -704,8 +704,6 @@
fb_http_params_set_str(params, "locale", val);
- msg = soup_message_new("POST", url);
/* Ensure an old signature is not computed */
g_hash_table_remove(params, "sig");
@@ -727,6 +725,9 @@
+ msg = soup_form_request_new_from_hash("POST", url, params); + fb_http_params_free(params); if (priv->token != NULL) {
data = g_strdup_printf("OAuth %s", priv->token);
soup_message_headers_replace(msg->request_headers, "Authorization",
@@ -734,10 +735,6 @@
- data = fb_http_params_close(params, NULL);
- soup_message_set_request(msg,
- "application/x-www-form-urlencoded; charset=utf-8",
- SOUP_MEMORY_TAKE, data, -1);
soup_session_queue_message(priv->cons, msg, callback, api);
fb_util_debug(FB_UTIL_DEBUG_INFO, "HTTP Request (%p):", msg);
--- a/libpurple/protocols/facebook/http.c Sat Oct 12 04:38:00 2019 -0400
+++ b/libpurple/protocols/facebook/http.c Sat Oct 12 22:32:50 2019 -0400
@@ -58,56 +58,29 @@
fb_http_params_new_parse(const gchar *data, gboolean isurl)
- params = fb_http_params_new();
+ return fb_http_params_new(); - data = strchr(data, '?');
+ uri = soup_uri_new(data);
+ return fb_http_params_new(); - tail = strchr(++data, '#');
- data = g_strndup(data, tail - data);
- ps = g_strsplit(data, "&", 0);
- for (i = 0; ps[i] != NULL; i++) {
- val = strchr(ps[i], '=');
+ params = soup_form_decode(data);
- key = g_uri_unescape_string(key, NULL);
- val = g_uri_unescape_string(val, NULL);
- g_hash_table_replace(params, key, val);
- g_free((gchar *) data);
@@ -117,41 +90,6 @@
g_hash_table_destroy(params);
-fb_http_params_close(FbHttpParams *params, const gchar *url)
- g_hash_table_iter_init(&iter, params);
- ret = g_string_new(NULL);
- while (g_hash_table_iter_next(&iter, &key, &val)) {
- g_hash_table_iter_remove(&iter);
- g_string_append_c(ret, '&');
- g_string_append_uri_escaped(ret, key, NULL, TRUE);
- g_string_append_c(ret, '=');
- g_string_append_uri_escaped(ret, val, NULL, TRUE);
- g_string_prepend_c(ret, '?');
- g_string_prepend(ret, url);
- fb_http_params_free(params);
- return g_string_free(ret, FALSE);
fb_http_params_get(FbHttpParams *params, const gchar *name, GError **error)
--- a/libpurple/protocols/facebook/http.h Sat Oct 12 04:38:00 2019 -0400
+++ b/libpurple/protocols/facebook/http.h Sat Oct 12 22:32:50 2019 -0400
@@ -124,21 +124,6 @@
fb_http_params_free(FbHttpParams *params);
- * fb_http_params_close:
- * @params: The #FbHttpParams.
- * @url: The URL or #NULL.
- * Closes the #FbHttpParams by returning a string representing the HTTP
- * parameters. If @url is non-#NULL, then the parameters are appended
- * to the value of @url. This frees the #FbHttpParams. The returned
- * string should be freed with #g_free() when no longer needed.
- * Returns: The string representation of the HTTP parameters.
-fb_http_params_close(FbHttpParams *params, const gchar *url);
* fb_http_params_get_bool:
* @params: The #FbHttpParams.
* @name: The parameter name.