changeset 23531:3207561b0f17

Don't free the SOAP message when we're still using it for a redirect. Also, always specify a / at the beginning of the POST because purple_url_parse doesn't return it. I even tested redirects this time!
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 17 Jun 2008 04:11:18 +0000
parents e29019f78984
children d65150b5622f
files libpurple/protocols/msn/soap2.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/soap2.c	Tue Jun 17 00:55:26 2008 +0000
+++ b/libpurple/protocols/msn/soap2.c	Tue Jun 17 04:11:18 2008 +0000
@@ -80,7 +80,7 @@
 	MsnSoapMessage *message, const char *host, const char *path,
 	MsnSoapCallback cb, gpointer cb_data, gboolean first);
 
-static void msn_soap_request_destroy(MsnSoapRequest *req);
+static void msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message);
 static void msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect);
 static gboolean msn_soap_write_cb_internal(gpointer data, gint fd, PurpleInputCondition cond, gboolean initial);
 static void msn_soap_process(MsnSoapConnection *conn);
@@ -191,7 +191,7 @@
 			conn->current_request->message,	host, path,
 			conn->current_request->cb, conn->current_request->cb_data, TRUE);
 
-		msn_soap_request_destroy(conn->current_request);
+		msn_soap_request_destroy(conn->current_request, TRUE);
 		conn->current_request = NULL;
 
 		g_free(host);
@@ -251,7 +251,7 @@
 		request->cb(request->message, response,
 			request->cb_data);
 		msn_soap_message_destroy(response);
-		msn_soap_request_destroy(request);
+		msn_soap_request_destroy(request, FALSE);
 	}
 
 	return TRUE;
@@ -486,7 +486,7 @@
 			conn->buf = g_string_new("");
 
 			g_string_append_printf(conn->buf,
-				"POST %s HTTP/1.1\r\n"
+				"POST /%s HTTP/1.1\r\n"
 				"SOAPAction: %s\r\n"
 				"Content-Type:text/xml; charset=utf-8\r\n"
 				"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
@@ -589,7 +589,7 @@
 	}
 
 	if (conn->current_request) {
-		msn_soap_request_destroy(conn->current_request);
+		msn_soap_request_destroy(conn->current_request, FALSE);
 		conn->current_request = NULL;
 	}
 }
@@ -616,7 +616,7 @@
 	if (req->cb)
 		req->cb(req->message, NULL, req->cb_data);
 
-	msn_soap_request_destroy(req);
+	msn_soap_request_destroy(req, FALSE);
 }
 
 static void
@@ -670,10 +670,11 @@
 }
 
 static void
-msn_soap_request_destroy(MsnSoapRequest *req)
+msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message)
 {
 	g_free(req->path);
-	msn_soap_message_destroy(req->message);
+	if (!keep_message)
+		msn_soap_message_destroy(req->message);
 	g_free(req);
 }