Ignore:
Timestamp:
2006-05-28T23:13:47Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
df417ca
Parents:
cdca30b (diff), 79b6213 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging from main/jelmer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/passport.c

    rcdca30b r4ff0966  
    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       
     
    145153}
    146154
    147 #define PPR_REQUEST "GET /rdr/pprdr.asp HTTP/1.0\r\n\r\n"
    148155static int passport_retrieve_dalogin( gpointer func, gpointer data, char *header )
    149156{
     
    155162        rep->header = header;
    156163       
    157         req = http_dorequest( "nexus.passport.com", 443, 1, PPR_REQUEST, passport_retrieve_dalogin_ready, rep );
     164        req = http_dorequest_url( "https://nexus.passport.com/rdr/pprdr.asp", passport_retrieve_dalogin_ready, rep );
    158165       
    159166        if( !req )
     
    169176        char *urlend;
    170177       
    171         if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers )
     178        if( !g_slist_find( msn_connections, rep->data ) )
    172179        {
    173180                destroy_reply( rep );
     
    175182        }
    176183       
     184        if( !req->finished || !req->reply_headers || req->status_code != 200 )
     185        {
     186                rep->error_string = g_strdup_printf( "HTTP error while fetching DALogin: %s",
     187                                        req->status_string ? req->status_string : "Unknown error" );
     188                goto failure;
     189        }
     190       
    177191        dalogin = strstr( req->reply_headers, "DALogin=" );     
    178192       
    179193        if( !dalogin )
     194        {
     195                rep->error_string = g_strdup( "Parse error while fetching DALogin" );
    180196                goto failure;
     197        }
    181198       
    182199        dalogin += strlen( "DALogin=" );
     
    208225        g_free( rep->result );
    209226        g_free( rep->header );
     227        g_free( rep->error_string );
    210228        g_free( rep );
    211229}
Note: See TracChangeset for help on using the changeset viewer.