Changeset 164352e for lib/http_client.c


Ignore:
Timestamp:
2011-12-24T18:02:39Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
34ded90
Parents:
e306fbf (diff), 96f954d (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 mainline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    re306fbf r164352e  
    3333
    3434static gboolean http_connected( gpointer data, int source, b_input_condition cond );
    35 static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond );
     35static gboolean http_ssl_connected( gpointer data, int returncode, void *source, b_input_condition cond );
    3636static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond );
    3737static void http_free( struct http_request *req );
     
    4747        if( ssl )
    4848        {
    49                 req->ssl = ssl_connect( host, port, http_ssl_connected, req );
     49                req->ssl = ssl_connect( host, port, TRUE, http_ssl_connected, req );
    5050                if( req->ssl == NULL )
    5151                        error = 1;
     
    163163       
    164164error:
    165         req->status_string = g_strdup( "Error while writing HTTP request" );
     165        if( req->status_string == NULL )
     166                req->status_string = g_strdup( "Error while writing HTTP request" );
    166167       
    167168        req->func( req );
     
    170171}
    171172
    172 static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond )
     173static gboolean http_ssl_connected( gpointer data, int returncode, void *source, b_input_condition cond )
    173174{
    174175        struct http_request *req = data;
    175176       
    176177        if( source == NULL )
     178        {
     179                if( returncode != 0 )
     180                {
     181                        char *err = ssl_verify_strerror( returncode );
     182                        req->status_string = g_strdup_printf(
     183                                "Certificate verification problem 0x%x: %s",
     184                                returncode, err ? err : "Unknown" );
     185                        g_free( err );
     186                }
    177187                return http_connected( data, -1, cond );
     188        }
    178189       
    179190        req->fd = ssl_getfd( source );
     
    439450                if( new_proto == PROTO_HTTPS )
    440451                {
    441                         req->ssl = ssl_connect( new_host, new_port, http_ssl_connected, req );
     452                        req->ssl = ssl_connect( new_host, new_port, TRUE, http_ssl_connected, req );
    442453                        if( req->ssl == NULL )
    443454                                error = 1;
Note: See TracChangeset for help on using the changeset viewer.