Changeset 12740


Ignore:
Timestamp:
Aug 25, 2011, 9:08:50 AM (10 years ago)
Author:
jordan
Message:

(trunk libT) #4437 "Multi file webseeds don't work" -- fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/webseed.c

    r12555 r12740  
    4242    long                 response_code;
    4343    int                  torrent_id;
     44    bool                 bad_range;
    4445};
    4546
     
    415416                ++w->retry_tickcount;
    416417
     418            t->bad_range = response_code == 416;
     419
    417420            tr_list_remove_data( &w->tasks, t );
    418421            evbuffer_free( t->content );
     
    457460
    458461static struct evbuffer *
    459 make_url( tr_webseed * w, const tr_file * file )
     462make_url( struct tr_webseed_task * t, const tr_file * file )
    460463{
    461464    struct evbuffer * buf = evbuffer_new( );
     465    struct tr_webseed * w = t->webseed;
    462466
    463467    evbuffer_add( buf, w->base_url, w->base_url_len );
    464468
    465     /* if url ends with a '/', add the torrent name */
    466     if( w->base_url[w->base_url_len - 1] == '/' && file->name )
     469    if( t->bad_range || ( w->base_url[w->base_url_len - 1] == '/' && file->name ) ) {
     470        if( t->bad_range )
     471            evbuffer_add( buf, "/", 1 );
    467472        tr_http_escape( buf, file->name, strlen(file->name), false );
     473    }
    468474
    469475    return buf;
     
    500506
    501507        if( !urls[file_index] )
    502             urls[file_index] = evbuffer_free_to_str( make_url( t->webseed, file ) );
     508            urls[file_index] = evbuffer_free_to_str( make_url( t, file ) );
    503509
    504510        tr_snprintf( range, sizeof range, "%"PRIu64"-%"PRIu64,
Note: See TracChangeset for help on using the changeset viewer.