changeset 20529:1180920ffcec

handle unauthenticated soap connection
author Ka-Hing Cheung <khc@hxbc.us>
date Mon, 24 Sep 2007 06:04:54 +0000
parents 06527cc0f79b
children 719ce4acfcb9
files libpurple/protocols/msn/soap2.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/soap2.c	Mon Sep 24 05:29:07 2007 +0000
+++ b/libpurple/protocols/msn/soap2.c	Mon Sep 24 06:04:54 2007 +0000
@@ -365,25 +365,30 @@
 			int len = -1;
 			char *body = xmlnode_to_str(req->message->xml, &len);
 			GSList *iter;
+			char *authstr = NULL;
 
 			g_queue_pop_head(conn->queue);
 
 			conn->buf = g_string_new("");
 
+			if (conn->session->passport_info.mspauth)
+				authstr = g_strdup_printf("Cookie: MSPAuth=%s\r\n",
+					conn->session->passport_info.mspauth);
+
+
 			g_string_append_printf(conn->buf,
 				"POST %s HTTP/1.1\r\n"
 				"SOAPAction: %s\r\n"
 				"Content-Type:text/xml; charset=utf-8\r\n"
-				"Cookie: MSPAuth=%s\r\n"
+				"%s"
 				"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
 				"Accept: */*\r\n"
 				"Host: %s\r\n"
 				"Content-Length: %d\r\n"
 				"Connection: Keep-Alive\r\n"
 				"Cache-Control: no-cache\r\n",
-				req->path, req->message->action,
-				conn->session->passport_info.mspauth,
-				conn->host, len);
+				req->path, req->message->action ? req->message->action : "",
+				authstr ? authstr : "",	conn->host, len);
 
 			for (iter = req->message->headers; iter; iter = iter->next) {
 				g_string_append(conn->buf, (char *)iter->data);
@@ -399,6 +404,8 @@
 			conn->event_handle = purple_input_add(conn->ssl->fd,
 				PURPLE_INPUT_WRITE, msn_soap_write_cb, conn);
 			msn_soap_write_cb(conn, conn->ssl->fd, PURPLE_INPUT_WRITE);
+
+			g_free(authstr);
 		}		
 	}