Changeset f2520b5 for protocols


Ignore:
Timestamp:
2010-08-20T08:22:28Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
801b90b
Parents:
80175a1
Message:

In debugging mode, dump all SOAP requests + responses with some indentation
for easier debugging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/soap.c

    r80175a1 rf2520b5  
    6868
    6969static int msn_soap_send_request( struct msn_soap_req_data *req );
     70static void msn_soap_debug_print( const char *headers, const char *payload );
    7071
    7172static int msn_soap_start( struct im_connection *ic,
     
    107108                strlen( soap_req->payload ), soap_req->payload );
    108109       
     110        msn_soap_debug_print( http_req, soap_req->payload );
     111       
    109112        soap_req->http_req = http_dorequest( url.host, url.port, url.proto == PROTO_HTTPS,
    110113                http_req, msn_soap_handle_response, soap_req );
     
    131134        }
    132135       
     136        msn_soap_debug_print( http_req->reply_headers, http_req->reply_body );
     137       
    133138        st = soap_req->handle_response( soap_req );
    134139       
     
    163168       
    164169        return ret;
     170}
     171
     172static void msn_soap_debug_print( const char *headers, const char *payload )
     173{
     174        char *s;
     175       
     176        if( !getenv( "BITLBEE_DEBUG" ) )
     177                return;
     178       
     179        if( ( s = strstr( headers, "\r\n\r\n" ) ) )
     180                write( 1, s, s - headers + 4 );
     181        else
     182                write( 1, headers, strlen( headers ) );
     183       
     184#ifdef DEBUG
     185        {
     186                struct xt_node *xt = xt_from_string( payload );
     187                if( xt )
     188                        xt_print( xt );
     189                xt_free_node( xt );
     190        }
     191#endif
    165192}
    166193
Note: See TracChangeset for help on using the changeset viewer.