Changeset a2582c8


Ignore:
Timestamp:
2006-05-26T22:44:48Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
db28304
Parents:
fe23720
Message:

Added error_string variable to Passport client.

Location:
protocols/msn
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    rfe23720 ra2582c8  
    650650        if( key == NULL )
    651651        {
    652                 hide_login_progress( gc, "Error during Passport authentication" );
     652                char *err;
     653               
     654                err = g_strdup_printf( "Error during Passport authentication (%s)",
     655                                       rep->error_string ? rep->error_string : "Unknown error" );
     656               
     657                hide_login_progress( gc, err );
    653658                signoff( gc );
     659               
     660                g_free( err );
    654661        }
    655662        else
  • protocols/msn/passport.c

    rfe23720 ra2582c8  
    6969        }
    7070       
    71         reqs = g_malloc( strlen( header ) + strlen( dummy ) + 128 );
    72         sprintf( reqs, "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header );
     71        reqs = g_strdup_printf( "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header );
    7372       
    7473        *dummy = 0;
     
    8887        struct passport_reply *rep = req->data;
    8988       
    90         if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers )
     89        if( !g_slist_find( msn_connections, rep->data ) )
    9190        {
    9291                destroy_reply( rep );
     
    9493        }
    9594       
    96         if( req->status_code == 200 )
     95        if( req->finished && req->reply_headers && req->status_code == 200 )
    9796        {
    9897                char *dummy;
     
    109108                        rep->result = g_strdup( dummy );
    110109                }
     110                else
     111                {
     112                        rep->error_string = g_strdup( "Could not parse Passport server response" );
     113                }
     114        }
     115        else
     116        {
     117                rep->error_string = g_strdup_printf( "HTTP error: %s",
     118                                      req->status_string ? req->status_string : "Unknown error" );
    111119        }
    112120       
     
    169177        char *urlend;
    170178       
    171         if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers )
     179        if( !g_slist_find( msn_connections, rep->data ) )
    172180        {
    173181                destroy_reply( rep );
     
    175183        }
    176184       
     185        if( !req->finished || !req->reply_headers || req->status_code != 200 )
     186        {
     187                rep->error_string = g_strdup_printf( "HTTP error while fetching DALogin (%s)",
     188                                        req->status_string ? req->status_string : "Unknown error" );
     189                goto failure;
     190        }
     191       
    177192        dalogin = strstr( req->reply_headers, "DALogin=" );     
    178193       
    179194        if( !dalogin )
     195        {
     196                rep->error_string = g_strdup( "Parse error while fetching DALogin" );
    180197                goto failure;
     198        }
    181199       
    182200        dalogin += strlen( "DALogin=" );
     
    208226        g_free( rep->result );
    209227        g_free( rep->header );
     228        g_free( rep->error_string );
    210229        g_free( rep );
    211230}
  • protocols/msn/passport.h

    rfe23720 ra2582c8  
    3939        char *result;
    4040        char *header;
     41        char *error_string;
    4142};
    4243
Note: See TracChangeset for help on using the changeset viewer.