Print out SOAP response data as it's received in chunks. Sure, that

Sat, 30 Aug 2008 03:41:18 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sat, 30 Aug 2008 03:41:18 +0000
changeset 24216
aa2a6eaa0afe
parent 24212
3ca5cc4d3caf
child 24217
68828276e98c

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.

libpurple/protocols/msn/soap.c file | annotate | diff | comparison | revisions
--- 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) {

mercurial