aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/xmltree.c4
-rw-r--r--protocols/msn/soap.c27
2 files changed, 29 insertions, 2 deletions
diff --git a/lib/xmltree.c b/lib/xmltree.c
index 20d69455..3ec7e673 100644
--- a/lib/xmltree.c
+++ b/lib/xmltree.c
@@ -330,7 +330,7 @@ void xt_print( struct xt_node *node )
/* Indentation */
for( c = node; c->parent; c = c->parent )
- printf( "\t" );
+ printf( " " );
/* Start the tag */
printf( "<%s", node->name );
@@ -368,7 +368,7 @@ void xt_print( struct xt_node *node )
if( node->children )
for( c = node; c->parent; c = c->parent )
- printf( "\t" );
+ printf( " " );
/* Non-empty tag is now finished. */
printf( "</%s>\n", node->name );
diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c
index 410ff37c..6665eef1 100644
--- a/protocols/msn/soap.c
+++ b/protocols/msn/soap.c
@@ -67,6 +67,7 @@ struct msn_soap_req_data
};
static int msn_soap_send_request( struct msn_soap_req_data *req );
+static void msn_soap_debug_print( const char *headers, const char *payload );
static int msn_soap_start( struct im_connection *ic,
void *data,
@@ -106,6 +107,8 @@ static int msn_soap_send_request( struct msn_soap_req_data *soap_req )
soap_action ? soap_action : "",
strlen( soap_req->payload ), soap_req->payload );
+ msn_soap_debug_print( http_req, soap_req->payload );
+
soap_req->http_req = http_dorequest( url.host, url.port, url.proto == PROTO_HTTPS,
http_req, msn_soap_handle_response, soap_req );
@@ -130,6 +133,8 @@ static void msn_soap_handle_response( struct http_request *http_req )
xt_free( parser );
}
+ msn_soap_debug_print( http_req->reply_headers, http_req->reply_body );
+
st = soap_req->handle_response( soap_req );
g_free( soap_req->url );
@@ -164,6 +169,28 @@ static char *msn_soap_abservice_build( const char *body_fmt, const char *scenari
return ret;
}
+static void msn_soap_debug_print( const char *headers, const char *payload )
+{
+ char *s;
+
+ if( !getenv( "BITLBEE_DEBUG" ) )
+ return;
+
+ if( ( s = strstr( headers, "\r\n\r\n" ) ) )
+ write( 1, s, s - headers + 4 );
+ else
+ write( 1, headers, strlen( headers ) );
+
+#ifdef DEBUG
+ {
+ struct xt_node *xt = xt_from_string( payload );
+ if( xt )
+ xt_print( xt );
+ xt_free_node( xt );
+ }
+#endif
+}
+
/* passport_sso: Authentication MSNP15+ */