# HG changeset patch
# Node ID a9287d6f16de
# Parent  bcdd296252b3
diff --git a/libpurple/protocols/gg/edisc.c b/libpurple/protocols/gg/edisc.c
--- a/libpurple/protocols/gg/edisc.c
+++ b/libpurple/protocols/gg/edisc.c
@@ -517,6 +517,7 @@ ggp_edisc_xfer_send_init_authenticated(P
 	PurpleXfer *xfer = _xfer;
 	GGPXfer *edisc_xfer = GGP_XFER(xfer);
 	gchar *data;
+	GBytes *body = NULL;
 
 	if (purple_xfer_is_cancelled(xfer)) {
 		return;
@@ -544,9 +545,11 @@ ggp_edisc_xfer_send_init_authenticated(P
 	                       purple_xfer_get_remote_user(xfer),
 	                       edisc_xfer->filename,
 	                       (int)purple_xfer_get_size(xfer));
-	soup_message_set_request(msg,
-	                         "application/x-www-form-urlencoded; charset=UTF-8",
-	                         SOUP_MEMORY_TAKE, data, -1);
+	body = g_bytes_new_take(data, strlen(data));
+	soup_message_set_request_body_from_bytes(msg,
+	                                         "application/x-www-form-urlencoded; charset=UTF-8",
+	                                         body);
+	g_bytes_unref(body);
 
 	soup_session_queue_message(sdata->session, msg,
 	                           ggp_edisc_xfer_send_init_ticket_created, xfer);
diff --git a/libpurple/protocols/gg/oauth/oauth-purple.c b/libpurple/protocols/gg/oauth/oauth-purple.c
--- a/libpurple/protocols/gg/oauth/oauth-purple.c
+++ b/libpurple/protocols/gg/oauth/oauth-purple.c
@@ -162,6 +162,7 @@ ggp_oauth_request_token_got(SoupSession 
 	PurpleAccount *account;
 	PurpleXmlNode *xml;
 	gchar *request_data;
+	GBytes *body = NULL;
 	gboolean succ = TRUE;
 
 	PURPLE_ASSERT_CONNECTION_IS_VALID(data->gc);
@@ -208,8 +209,11 @@ ggp_oauth_request_token_got(SoupSession 
 	// purple_http_request_set_max_len(msg, GGP_OAUTH_RESPONSE_MAX);
 	/* we don't need any results, nor 302 redirection */
 	soup_message_set_flags(msg, SOUP_MESSAGE_NO_REDIRECT);
-	soup_message_set_request(msg, "application/x-www-form-urlencoded",
-	                         SOUP_MEMORY_TAKE, request_data, -1);
+	body = g_bytes_new_take(request_data, strlen(request_data));
+	soup_message_set_request_body_from_bytes(msg,
+	                                         "application/x-www-form-urlencoded",
+	                                         body);
+	g_bytes_unref(body);
 	soup_session_queue_message(session, msg, ggp_oauth_authorization_done,
 	                           data);
 }
diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c
--- a/libpurple/protocols/gg/pubdir-prpl.c
+++ b/libpurple/protocols/gg/pubdir-prpl.c
@@ -785,6 +785,7 @@ static void ggp_pubdir_set_info_got_toke
 	ggp_pubdir_record *record = _record;
 	GGPInfo *info = NULL;
 	SoupMessage *msg;
+	GBytes *body = NULL;
 	gchar *url;
 	gchar *request_data;
 	gchar *name, *surname, *city;
@@ -835,8 +836,11 @@ static void ggp_pubdir_set_info_got_toke
 	msg = soup_message_new("PUT", url);
 	soup_message_headers_replace(soup_message_get_request_headers(msg),
 	                             "Authorization", token);
-	soup_message_set_request(msg, "application/x-www-form-urlencoded",
-	                         SOUP_MEMORY_TAKE, request_data, -1);
+	body = g_bytes_new_take(request_data, strlen(request_data));
+	soup_message_set_request_body_from_bytes(msg,
+	                                         "application/x-www-form-urlencoded",
+	                                         body);
+	g_bytes_unref(body);
 	soup_session_queue_message(info->http, msg,
 	                           ggp_pubdir_set_info_got_response, NULL);
 
diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c
--- a/libpurple/protocols/jabber/bosh.c
+++ b/libpurple/protocols/jabber/bosh.c
@@ -493,12 +493,15 @@ jabber_bosh_connection_http_request_new(
                                         const GString *data)
 {
 	SoupMessage *req;
+	GBytes *body = NULL;
 
 	jabber_stream_restart_inactivity_timer(conn->js);
 
 	req = soup_message_new("POST", conn->url);
-	soup_message_set_request(req, "text/xml; charset=utf-8", SOUP_MEMORY_TAKE,
-	                         data->str, data->len);
+	body = g_bytes_new_take(data->str, data->len);
+	soup_message_set_request_body_from_bytes(req, "text/xml; charset=utf-8",
+	                                         body);
+	g_bytes_unref(body);
 
 	return req;
 }
diff --git a/libpurple/soupcompat.h b/libpurple/soupcompat.h
--- a/libpurple/soupcompat.h
+++ b/libpurple/soupcompat.h
@@ -88,6 +88,19 @@ soup_message_new_from_encoded_form(const
 	return msg;
 }
 
+static inline void
+soup_message_set_request_body_from_bytes(SoupMessage *msg,
+                                         const gchar *content_type,
+                                         GBytes *bytes)
+{
+	gconstpointer data = NULL;
+	gsize length = 0;
+
+	data = g_bytes_get_data(bytes, &length);
+	soup_message_set_request(msg, content_type, SOUP_MEMORY_COPY,
+	                         data, length);
+}
+
 #endif /* SOUP_MAJOR_VERSION < 3 */
 
 #endif /* PURPLE_SOUPCOMPAT_H */
