changeset 23949:cb60838756e7

Print out SOAP response data as it's received in chunks. Sure, that means more work when debugging, but at least we aren't printing out the same stuff over and over. Unfortunately, that 16K buffer because of OS X still sucks for word wrap performance.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 30 Aug 2008 03:41:18 +0000
parents 4830c1ec1379
children 8691534526f1
files libpurple/protocols/msn/soap.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/soap.c	Sat Aug 30 00:28:34 2008 +0000
+++ b/libpurple/protocols/msn/soap.c	Sat Aug 30 03:41:18 2008 +0000
@@ -268,6 +268,7 @@
 		(something weird with the login.live.com server). With NSS it works
 		fine, so I believe it's some bug with OS X */ 
 	char buf[16 * 1024];
+	gsize cursor;
 
 	if (conn->message == NULL) {
 		conn->message = msn_soap_message_new(NULL, NULL);
@@ -276,12 +277,20 @@
 	if (conn->buf == NULL) {
 		conn->buf = g_string_new_len(buf, 0);
 	}
-	
+
+	cursor = conn->buf->len;
 	while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) {
 		purple_debug_info("soap", "read %d bytes\n", cnt);
 		count += cnt;
 		g_string_append_len(conn->buf, buf, cnt);
 	}
+#ifndef MSN_UNSAFE_DEBUG
+	if (conn->current_request->secure)
+		purple_debug_misc("soap", "Received secure request.\n");
+	else
+#endif
+	if (count != 0)
+		purple_debug_misc("soap", "current %s\n", conn->buf->str + cursor);
 
 	/* && count is necessary for Adium, on OS X the last read always
 	   return an error, so we want to proceed anyway. See #5212 for
@@ -310,13 +319,6 @@
 	char *cursor;
 	char *linebreak;
 
-#ifndef MSN_UNSAFE_DEBUG
-	if (conn->current_request->secure)
-		purple_debug_misc("soap", "Received secure request.\n");
-	else
-#endif
-	purple_debug_misc("soap", "current %s\n", conn->buf->str);
-
 	cursor = conn->buf->str + conn->handled_len;
 
 	if (!conn->headers_done) {