Changeset 9993


Ignore:
Timestamp:
Jan 22, 2010, 7:27:19 AM (12 years ago)
Author:
charles
Message:

(trunk libT) #2783 "starting with r9992, IP blocklist is empty" -- when replacing a URL's hostname with an IP address before passing the URL to curl, manually set the Host: header to the original hostname. (Xref: #2781)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/web.c

    r9992 r9993  
    8585{
    8686    unsigned long tag;
     87    struct curl_slist * slist;
    8788    struct evbuffer * response;
    8889    char * url;
     
    101102task_free( struct tr_web_task * task )
    102103{
     104    if( task->slist != NULL )
     105        curl_slist_free_all( task->slist );
    103106    evtimer_del( &task->timer_event );
    104107    evbuffer_free( task->response );
     
    259262        if( task->resolved_host != NULL )
    260263        {
     264            char * host;
    261265            struct evbuffer * buf = evbuffer_new( );
    262266            char * pch = strstr( task->url, task->host );
     
    268272            dbgmsg( "old url: \"%s\" -- new url: \"%s\"", task->url, url );
    269273            evbuffer_free( buf );
     274
     275            host = tr_strdup_printf( "Host: %s", task->host );
     276            task->slist = curl_slist_append( NULL, host );
     277            curl_easy_setopt( e, CURLOPT_HTTPHEADER, task->slist );
     278            tr_free( host );
    270279        }
    271280
Note: See TracChangeset for help on using the changeset viewer.