Changeset 8455


Ignore:
Timestamp:
May 20, 2009, 9:05:48 PM (12 years ago)
Author:
charles
Message:

backports for 1.54.

ticketed items:

  • r8390 #1916: phantom 'verifying' appears if another verify in progress
  • r8396 #2061: Toolbar z-index should be less than menus, dialogs
  • r8400 #2073: can't upload new torrent file in web ui
  • r8402 #1451: make it clearer that the statusbar's ratio mode button is a button
  • r8418 #2085: in Web Client, torrents added by URL are always paused, regardless of preferences
  • r8419 #1451: make it clearer that the statusbar's ratio mode button is a button
  • r8428 #1188: comments and announce address are cut off
  • r8432 #2094: Torrent comment box does not scroll, so long comments are partially hidden

nonticketed items:

  • r8415: message #9 is for setting the peer's DHT listening port, not their BitTorrent? listening port.
  • r8427: fix _leftUntilDone not updating when it hits 0
  • r8399: fix small memory leaks in libtransmission and in gtk client
  • r8425: fix intltool build problem
  • r8391: remove dead code found by clang
  • r8412: speed up rpcimpl's torrentGet() by about 75%
  • r8426: in the web client, use the correct filterbar image and style it properly
Location:
branches/1.5x
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5x/Makefile.am

    r8051 r8455  
    3737  README \
    3838  autogen.sh \
    39   Transmission.xcodeproj/project.pbxproj \
    40   intltool-extract.in \
    41   intltool-merge.in \
    42   intltool-update.in
     39  Transmission.xcodeproj/project.pbxproj
    4340
    4441clutchdir = $(datadir)/transmission/web
  • branches/1.5x/NEWS

    r8379 r8455  
    11NEWS file for Transmission <http://www.transmissionbt.com/>
     2
     31.54 (2009/xx/yy)
     4This 1.5x maintenance release backports a handful of bugfixes from 1.62.
     5- All Platforms
     6   + fix bug that could forget which port to use when connecting to some peers
     7   + phantom 'verifying' appears if another verify in progress
     8   + fix small memory leaks and remove dead code
     9- Web Client
     10   + fix 1.53 bug that broke adding new torrents in the web client
     11   + torrents added by URL were always paused, regardless of preferences
     12   + in the inspector, comments and announce address were cut off
     13   + toolbar z-index should be less than menus, dialogs
     14   + the "data remaining" wasn't updated when the number reached 0
     15- GTK+
     16   + Fix intltool build error
     17   + Make it clearer that the statusbar's ratio mode button is a button
     18   + Torrent comment box does not scroll, so long comments are partially hidden
    219
    3201.53 (2009/05/11)
  • branches/1.5x/configure.ac

    r8379 r8455  
    201201if test "x$enable_nls" = "xyes" ; then
    202202    use_nls=yes
    203     IT_PROG_INTLTOOL([0.23],[no-xml])
     203    IT_PROG_INTLTOOL([0.40.0],[no-xml])
    204204    AC_CHECK_HEADERS([libintl.h])
    205205    GETTEXT_PACKAGE=transmission
  • branches/1.5x/gtk/details.c

    r8205 r8455  
    620620    int             row = 0;
    621621    GtkWidget *     t = hig_workarea_create( );
    622     GtkWidget *     l, *w, *fr;
     622    GtkWidget *     l, *w, *fr, *sw;
    623623    char *          pch;
    624624    char            sizeStr[128];
     
    662662    gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( w ), GTK_WRAP_WORD );
    663663    gtk_text_view_set_editable( GTK_TEXT_VIEW( w ), FALSE );
     664    sw = gtk_scrolled_window_new( NULL, NULL );
     665    gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sw ),
     666                                    GTK_POLICY_AUTOMATIC,
     667                                    GTK_POLICY_AUTOMATIC );
     668    gtk_container_add( GTK_CONTAINER( sw ), w );
    664669    fr = gtk_frame_new( NULL );
    665670    gtk_frame_set_shadow_type( GTK_FRAME( fr ), GTK_SHADOW_IN );
    666     gtk_container_add( GTK_CONTAINER( fr ), w );
     671    gtk_container_add( GTK_CONTAINER( fr ), sw );
    667672    w = hig_workarea_add_row( t, &row, _( "Comment:" ), fr, NULL );
    668673    gtk_misc_set_alignment( GTK_MISC( w ), 0.0f, 0.0f );
  • branches/1.5x/gtk/tr-core.c

    r8205 r8455  
    512512            g_free( filename );
    513513        }
     514        g_dir_close( dir );
    514515    }
    515516}
  • branches/1.5x/gtk/tr-window.c

    r8205 r8455  
    240240
    241241static void
    242 onYinYangReleased( GtkWidget * w           UNUSED,
    243                    GdkEventButton * button UNUSED,
    244                    gpointer                vprivate )
     242onYinYangReleased( GtkWidget * w UNUSED, gpointer vprivate )
    245243{
    246244    PrivateData * p = vprivate;
    247245
    248     gtk_menu_popup( GTK_MENU(
    249                        p->status_menu ), NULL, NULL, NULL, NULL, 0,
    250                    gtk_get_current_event_time( ) );
     246    gtk_menu_popup( GTK_MENU( p->status_menu ),
     247                    NULL, NULL, NULL, NULL, 0,
     248                    gtk_get_current_event_time( ) );
    251249}
    252250
     
    502500    PrivateData * p;
    503501    GtkWidget   *mainmenu, *toolbar, *filter, *list, *status;
    504     GtkWidget *   vbox, *w, *self, *h, *c, *s, *image, *menu;
     502    GtkWidget *   vbox, *w, *self, *h, *s, *image, *menu;
    505503    GtkWindow *   win;
    506504    GSList *      l;
     
    618616    w = p->stats_lb = gtk_label_new( NULL );
    619617    gtk_box_pack_end( GTK_BOX( h ), w, FALSE, FALSE, 0 );
    620     w = gtk_image_new_from_stock( GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU );
    621     c = gtk_event_box_new( );
    622     gtk_container_add( GTK_CONTAINER( c ), w );
    623     w = c;
     618    w = gtk_button_new( );
     619    gtk_container_add( GTK_CONTAINER( w ), gtk_image_new_from_stock( GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU ) );
     620    gtk_button_set_relief( GTK_BUTTON( w ), GTK_RELIEF_NONE );
     621    g_signal_connect( w, "clicked", G_CALLBACK( onYinYangReleased ), p );
    624622    gtk_box_pack_end( GTK_BOX( h ), w, FALSE, FALSE, 0 );
    625     g_signal_connect( w, "button-release-event",
    626                       G_CALLBACK( onYinYangReleased ), p );
    627623
    628624    menu = gtk_menu_new( );
  • branches/1.5x/libtransmission/ConvertUTF.c

    r7767 r8455  
    354354{
    355355    const UTF8* source = (const UTF8*) str;
    356     const UTF8* sourceEnd = source;
     356    const UTF8* sourceEnd;
    357357
    358358    if( max_len == 0 )
  • branches/1.5x/libtransmission/net.c

    r8218 r8455  
    500500    const int               type = SOCK_STREAM;
    501501    int                     addrlen;
    502     int                     retval;
    503502
    504503#if defined( SO_REUSEADDR ) || defined( SO_REUSEPORT ) || defined( IPV6_V6ONLY )
     
    518517#ifdef IPV6_V6ONLY
    519518    if( addr->type == TR_AF_INET6 &&
    520         ( retval = setsockopt( s, IPPROTO_IPV6, IPV6_V6ONLY, &optval,
     519        ( setsockopt( s, IPPROTO_IPV6, IPV6_V6ONLY, &optval,
    521520                             sizeof( optval ) ) ) == -1 ) {
    522521        /* the kernel may not support this. if not, ignore it */
  • branches/1.5x/libtransmission/peer-mgr.h

    r7722 r8455  
    8080    uint8_t                  encryption_preference;
    8181    tr_port                  port;
     82    tr_port                  dht_port;
    8283    tr_address               addr;
    8384    struct tr_peerIo       * io;
  • branches/1.5x/libtransmission/peer-msgs.c

    r8204 r8455  
    14291429        case BT_PORT:
    14301430            dbgmsg( msgs, "Got a BT_PORT" );
    1431             tr_peerIoReadUint16( msgs->peer->io, inbuf, &msgs->peer->port );
     1431            tr_peerIoReadUint16( msgs->peer->io, inbuf, &msgs->peer->dht_port );
    14321432            break;
    14331433
  • branches/1.5x/libtransmission/rpc-server.c

    r8378 r8455  
    3333#include "list.h"
    3434#include "platform.h"
     35#include "ptrarray.h"
    3536#include "rpcimpl.h"
    3637#include "rpc-server.h"
     
    8283
    8384
     85/***
     86****
     87***/
     88
     89static char*
     90get_current_session_id( struct tr_rpc_server * server )
     91{
     92    const time_t now = time( NULL );
     93
     94    if( !server->sessionId || ( now >= server->sessionIdExpiresAt ) )
     95    {
     96        int i;
     97        const int n = 48;
     98        const char * pool = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
     99        const size_t pool_size = strlen( pool );
     100        char * buf = tr_new( char, n+1 );
     101
     102        for( i=0; i<n; ++i )
     103            buf[i] = pool[ tr_cryptoRandInt( pool_size ) ];
     104        buf[n] = '\0';
     105
     106        tr_free( server->sessionId );
     107        server->sessionId = buf;
     108        server->sessionIdExpiresAt = now + (60*60); /* expire in an hour */
     109    }
     110
     111    return server->sessionId;
     112}
     113
     114
    84115/**
    85116***
     
    103134
    104135static const char*
    105 tr_memmem( const char * s1,
    106            size_t       l1,
    107            const char * s2,
    108            size_t       l2 )
     136tr_memmem( const char * s1, size_t l1, /* haystack */
     137           const char * s2, size_t l2 ) /* needle */
    109138{
    110139    if( !l2 ) return s1;
     
    120149}
    121150
     151struct tr_mimepart
     152{
     153    char * headers;
     154    int headers_len;
     155    char * body;
     156    int body_len;
     157};
     158
     159static void
     160tr_mimepart_free( struct tr_mimepart * p )
     161{
     162    tr_free( p->body );
     163    tr_free( p->headers );
     164    tr_free( p );
     165}
     166
     167static void
     168extract_parts_from_multipart( const struct evkeyvalq * headers,
     169                              const struct evbuffer * body,
     170                              tr_ptrArray * setme_parts )
     171{
     172    const char * content_type = evhttp_find_header( headers, "Content-Type" );
     173    const char * in = (const char*) EVBUFFER_DATA( body );
     174    size_t inlen = EVBUFFER_LENGTH( body );
     175
     176    const char * boundary_key = "boundary=";
     177    const char * boundary_key_begin = strstr( content_type, boundary_key );
     178    const char * boundary_val = boundary_key_begin ? boundary_key_begin + strlen( boundary_key ) : "arglebargle";
     179    char * boundary = tr_strdup_printf( "--%s", boundary_val );
     180    const size_t boundary_len = strlen( boundary );
     181
     182    const char * delim = tr_memmem( in, inlen, boundary, boundary_len );
     183    while( delim )
     184    {
     185        size_t part_len;
     186        const char * part = delim + boundary_len;
     187
     188        inlen -= ( part - in );
     189        in = part;
     190
     191        delim = tr_memmem( in, inlen, boundary, boundary_len );
     192        part_len = delim ? (size_t)( delim - part ) : inlen;
     193
     194        if( part_len )
     195        {
     196            const char * rnrn = tr_memmem( part, part_len, "\r\n\r\n", 4 );
     197            if( rnrn )
     198            {
     199                struct tr_mimepart * p = tr_new( struct tr_mimepart, 1 );
     200                p->headers_len = rnrn - part;
     201                p->headers = tr_strndup( part, p->headers_len );
     202                p->body_len = (part+part_len) - (rnrn + 4);
     203                p->body = tr_strndup( rnrn+4, p->body_len );
     204                tr_ptrArrayAppend( setme_parts, p );
     205            }
     206        }
     207    }
     208
     209    tr_free( boundary );
     210}
     211
    122212static void
    123213handle_upload( struct evhttp_request * req,
     
    130220    else
    131221    {
    132         const char * content_type = evhttp_find_header( req->input_headers,
    133                                                         "Content-Type" );
     222        int i;
     223        int n;
     224        tr_bool hasSessionId = FALSE;
     225        tr_ptrArray parts = TR_PTR_ARRAY_INIT;
    134226
    135227        const char * query = strchr( req->uri, '?' );
    136         const int    paused = query && strstr( query + 1, "paused=true" );
    137 
    138         const char * in = (const char *) EVBUFFER_DATA( req->input_buffer );
    139         size_t       inlen = EVBUFFER_LENGTH( req->input_buffer );
    140 
    141         const char * boundary_key = "boundary=";
    142         const char * boundary_key_begin = strstr( content_type,
    143                                                   boundary_key );
    144         const char * boundary_val =
    145             boundary_key_begin ? boundary_key_begin +
    146             strlen( boundary_key ) : "arglebargle";
    147 
    148         char *       boundary = tr_strdup_printf( "--%s", boundary_val );
    149         const size_t boundary_len = strlen( boundary );
    150 
    151         const char * delim = tr_memmem( in, inlen, boundary, boundary_len );
    152         while( delim )
    153         {
    154             size_t       part_len;
    155             const char * part = delim + boundary_len;
    156             inlen -= ( part - in );
    157             in = part;
    158             delim = tr_memmem( in, inlen, boundary, boundary_len );
    159             part_len = delim ? (size_t)( delim - part ) : inlen;
    160 
    161             if( part_len )
     228        const tr_bool paused = query && strstr( query + 1, "paused=true" );
     229
     230        extract_parts_from_multipart( req->input_headers, req->input_buffer, &parts );
     231        n = tr_ptrArraySize( &parts );
     232
     233        /* first look for the session id */
     234        for( i=0; i<n; ++i ) {
     235            struct tr_mimepart * p = tr_ptrArrayNth( &parts, i );
     236            if( tr_memmem( p->headers, p->headers_len, TR_RPC_SESSION_ID_HEADER, strlen( TR_RPC_SESSION_ID_HEADER ) ) )
     237                break;
     238        }
     239        if( i<n ) {
     240            const struct tr_mimepart * p = tr_ptrArrayNth( &parts, i );
     241            const char * ours = get_current_session_id( server );
     242            const int ourlen = strlen( ours );
     243            hasSessionId = ourlen<=p->body_len && !memcmp( p->body, ours, ourlen );
     244        }
     245
     246        if( !hasSessionId )
     247        {
     248            send_simple_response( req, 409, NULL );
     249        }
     250        else for( i=0; i<n; ++i )
     251        {
     252            struct tr_mimepart * p = tr_ptrArrayNth( &parts, i );
     253            if( strstr( p->headers, "filename=\"" ) )
    162254            {
    163                 char * text = tr_strndup( part, part_len );
    164                 if( strstr( text, "filename=\"" ) )
    165                 {
    166                     const char * body = strstr( text, "\r\n\r\n" );
    167                     if( body )
    168                     {
    169                         char * b64;
    170                         size_t  body_len;
    171                         tr_benc top, *args;
    172                         struct evbuffer * json = tr_getBuffer( );
    173 
    174                         body += 4; /* walk past the \r\n\r\n */
    175                         body_len = part_len - ( body - text );
    176                         if( body_len >= 2
    177                           && !memcmp( &body[body_len - 2], "\r\n", 2 ) )
    178                             body_len -= 2;
    179 
    180                         tr_bencInitDict( &top, 2 );
    181                         args = tr_bencDictAddDict( &top, "arguments", 2 );
    182                         tr_bencDictAddStr( &top, "method", "torrent-add" );
    183                         b64 = tr_base64_encode( body, body_len, NULL );
    184                         tr_bencDictAddStr( args, "metainfo", b64 );
    185                         tr_bencDictAddInt( args, "paused", paused );
    186                         tr_bencSaveAsJSON( &top, json );
    187                         tr_rpc_request_exec_json( server->session,
    188                                                   EVBUFFER_DATA( json ),
    189                                                   EVBUFFER_LENGTH( json ),
    190                                                   NULL, NULL );
    191 
    192                         tr_releaseBuffer( json );
    193                         tr_free( b64 );
    194                         tr_bencFree( &top );
    195                     }
    196                 }
    197                 tr_free( text );
     255                char * b64;
     256                int body_len = p->body_len;
     257                tr_benc top, *args;
     258                const char * body = p->body;
     259                struct evbuffer * json = evbuffer_new( );
     260
     261                if( body_len >= 2 && !memcmp( &body[body_len - 2], "\r\n", 2 ) )
     262                    body_len -= 2;
     263
     264                tr_bencInitDict( &top, 2 );
     265                args = tr_bencDictAddDict( &top, "arguments", 2 );
     266                tr_bencDictAddStr( &top, "method", "torrent-add" );
     267                b64 = tr_base64_encode( body, body_len, NULL );
     268                tr_bencDictAddStr( args, "metainfo", b64 );
     269                tr_bencDictAddInt( args, "paused", paused );
     270                tr_bencSaveAsJSON( &top, json );
     271                tr_rpc_request_exec_json( server->session,
     272                                          EVBUFFER_DATA( json ),
     273                                          EVBUFFER_LENGTH( json ),
     274                                          NULL, NULL );
     275
     276                evbuffer_free( json );
     277                tr_free( b64 );
     278                tr_bencFree( &top );
    198279            }
    199280        }
    200281
    201         tr_free( boundary );
     282        tr_ptrArrayDestruct( &parts, (PtrArrayForeachFunc)tr_mimepart_free );
    202283
    203284        /* use xml here because json responses to file uploads is trouble.
     
    457538}
    458539
    459 static char*
    460 get_current_session_id( struct tr_rpc_server * server )
    461 {
    462     const time_t now = time( NULL );
    463 
    464     if( !server->sessionId || ( now >= server->sessionIdExpiresAt ) )
    465     {
    466         int i;
    467         const int n = 48;
    468         const char * pool = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    469         const size_t pool_size = strlen( pool );
    470         char * buf = tr_new( char, n+1 );
    471 
    472         for( i=0; i<n; ++i )
    473             buf[i] = pool[ tr_cryptoRandInt( pool_size ) ];
    474         buf[n] = '\0';
    475 
    476         tr_free( server->sessionId );
    477         server->sessionId = buf;
    478         server->sessionIdExpiresAt = now + (60*60); /* expire in an hour */
    479     }
    480 
    481     return server->sessionId;
    482 }
    483 
    484 
    485540static tr_bool
    486541test_session_id( struct tr_rpc_server * server, struct evhttp_request * req )
     
    549604        {
    550605            handle_clutch( req, server );
     606        }
     607        else if( !strncmp( req->uri, "/transmission/upload", 20 ) )
     608        {
     609            handle_upload( req, server );
    551610        }
    552611#ifdef REQUIRE_SESSION_ID
     
    569628        {
    570629            handle_rpc( req, server );
    571         }
    572         else if( !strncmp( req->uri, "/transmission/upload", 20 ) )
    573         {
    574             handle_upload( req, server );
    575630        }
    576631        else
     
    778833    deflateEnd( &s->stream );
    779834#endif
     835    tr_free( s->sessionId );
    780836    tr_free( s->whitelistStr );
    781837    tr_free( s->username );
  • branches/1.5x/libtransmission/rpcimpl.c

    r8005 r8455  
    332332}
    333333
     334/* faster-than-strcmp() optimization.  this is kind of clumsy,
     335 * but addField() was in the profiler's top 10 list, and this
     336 * makes it 4x faster... */
     337#define tr_streq(a,alen,b) ((alen+1==sizeof(b)) && !memcmp(a,b,alen))
     338
    334339static void
    335 addField( const tr_torrent * tor,
    336           tr_benc *          d,
    337           const char *       key )
     340addField( const tr_torrent * tor, tr_benc * d, const char * key )
    338341{
    339342    const tr_info * inf = tr_torrentInfo( tor );
    340343    const tr_stat * st = tr_torrentStat( (tr_torrent*)tor );
    341 
    342     if( !strcmp( key, "activityDate" ) )
     344    const size_t keylen = strlen( key );
     345
     346    if( tr_streq( key, keylen, "activityDate" ) )
    343347        tr_bencDictAddInt( d, key, st->activityDate );
    344     else if( !strcmp( key, "addedDate" ) )
     348    else if( tr_streq( key, keylen, "addedDate" ) )
    345349        tr_bencDictAddInt( d, key, st->addedDate );
    346     else if( !strcmp( key, "announceResponse" ) )
     350    else if( tr_streq( key, keylen, "announceResponse" ) )
    347351        tr_bencDictAddStr( d, key, st->announceResponse );
    348     else if( !strcmp( key, "announceURL" ) )
     352    else if( tr_streq( key, keylen, "announceURL" ) )
    349353        tr_bencDictAddStr( d, key, st->announceURL );
    350     else if( !strcmp( key, "comment" ) )
     354    else if( tr_streq( key, keylen, "comment" ) )
    351355        tr_bencDictAddStr( d, key, inf->comment ? inf->comment : "" );
    352     else if( !strcmp( key, "corruptEver" ) )
     356    else if( tr_streq( key, keylen, "corruptEver" ) )
    353357        tr_bencDictAddInt( d, key, st->corruptEver );
    354     else if( !strcmp( key, "creator" ) )
     358    else if( tr_streq( key, keylen, "creator" ) )
    355359        tr_bencDictAddStr( d, key, inf->creator ? inf->creator : "" );
    356     else if( !strcmp( key, "dateCreated" ) )
     360    else if( tr_streq( key, keylen, "dateCreated" ) )
    357361        tr_bencDictAddInt( d, key, inf->dateCreated );
    358     else if( !strcmp( key, "desiredAvailable" ) )
     362    else if( tr_streq( key, keylen, "desiredAvailable" ) )
    359363        tr_bencDictAddInt( d, key, st->desiredAvailable );
    360     else if( !strcmp( key, "doneDate" ) )
     364    else if( tr_streq( key, keylen, "doneDate" ) )
    361365        tr_bencDictAddInt( d, key, st->doneDate );
    362     else if( !strcmp( key, "downloadDir" ) )
     366    else if( tr_streq( key, keylen, "downloadDir" ) )
    363367        tr_bencDictAddStr( d, key, tr_torrentGetDownloadDir( tor ) );
    364     else if( !strcmp( key, "downloadedEver" ) )
     368    else if( tr_streq( key, keylen, "downloadedEver" ) )
    365369        tr_bencDictAddInt( d, key, st->downloadedEver );
    366     else if( !strcmp( key, "downloaders" ) )
     370    else if( tr_streq( key, keylen, "downloaders" ) )
    367371        tr_bencDictAddInt( d, key, st->downloaders );
    368     else if( !strcmp( key, "downloadLimitMode" ) )
     372    else if( tr_streq( key, keylen, "downloadLimitMode" ) )
    369373        tr_bencDictAddInt( d, key, tr_torrentGetSpeedMode( tor, TR_DOWN ) );
    370     else if( !strcmp( key, "downloadLimit" ) )
     374    else if( tr_streq( key, keylen, "downloadLimit" ) )
    371375        tr_bencDictAddInt( d, key, tr_torrentGetSpeedLimit( tor, TR_DOWN ) );
    372     else if( !strcmp( key, "error" ) )
     376    else if( tr_streq( key, keylen, "error" ) )
    373377        tr_bencDictAddInt( d, key, st->error );
    374     else if( !strcmp( key, "errorString" ) )
     378    else if( tr_streq( key, keylen, "errorString" ) )
    375379        tr_bencDictAddStr( d, key, st->errorString );
    376     else if( !strcmp( key, "eta" ) )
     380    else if( tr_streq( key, keylen, "eta" ) )
    377381        tr_bencDictAddInt( d, key, st->eta );
    378     else if( !strcmp( key, "files" ) )
     382    else if( tr_streq( key, keylen, "files" ) )
    379383        addFiles( tor, tr_bencDictAddList( d, key, inf->fileCount ) );
    380     else if( !strcmp( key, "hashString" ) )
     384    else if( tr_streq( key, keylen, "hashString" ) )
    381385        tr_bencDictAddStr( d, key, tor->info.hashString );
    382     else if( !strcmp( key, "haveUnchecked" ) )
     386    else if( tr_streq( key, keylen, "haveUnchecked" ) )
    383387        tr_bencDictAddInt( d, key, st->haveUnchecked );
    384     else if( !strcmp( key, "haveValid" ) )
     388    else if( tr_streq( key, keylen, "haveValid" ) )
    385389        tr_bencDictAddInt( d, key, st->haveValid );
    386     else if( !strcmp( key, "id" ) )
     390    else if( tr_streq( key, keylen, "id" ) )
    387391        tr_bencDictAddInt( d, key, st->id );
    388     else if( !strcmp( key, "isPrivate" ) )
     392    else if( tr_streq( key, keylen, "isPrivate" ) )
    389393        tr_bencDictAddInt( d, key, tr_torrentIsPrivate( tor ) );
    390     else if( !strcmp( key, "lastAnnounceTime" ) )
     394    else if( tr_streq( key, keylen, "lastAnnounceTime" ) )
    391395        tr_bencDictAddInt( d, key, st->lastAnnounceTime );
    392     else if( !strcmp( key, "lastScrapeTime" ) )
     396    else if( tr_streq( key, keylen, "lastScrapeTime" ) )
    393397        tr_bencDictAddInt( d, key, st->lastScrapeTime );
    394     else if( !strcmp( key, "leechers" ) )
     398    else if( tr_streq( key, keylen, "leechers" ) )
    395399        tr_bencDictAddInt( d, key, st->leechers );
    396     else if( !strcmp( key, "leftUntilDone" ) )
     400    else if( tr_streq( key, keylen, "leftUntilDone" ) )
    397401        tr_bencDictAddInt( d, key, st->leftUntilDone );
    398     else if( !strcmp( key, "manualAnnounceTime" ) )
     402    else if( tr_streq( key, keylen, "manualAnnounceTime" ) )
    399403        tr_bencDictAddInt( d, key, st->manualAnnounceTime );
    400     else if( !strcmp( key, "maxConnectedPeers" ) )
     404    else if( tr_streq( key, keylen, "maxConnectedPeers" ) )
    401405        tr_bencDictAddInt( d, key,  tr_torrentGetPeerLimit( tor ) );
    402     else if( !strcmp( key, "name" ) )
     406    else if( tr_streq( key, keylen, "name" ) )
    403407        tr_bencDictAddStr( d, key, inf->name );
    404     else if( !strcmp( key, "nextAnnounceTime" ) )
     408    else if( tr_streq( key, keylen, "nextAnnounceTime" ) )
    405409        tr_bencDictAddInt( d, key, st->nextAnnounceTime );
    406     else if( !strcmp( key, "nextScrapeTime" ) )
     410    else if( tr_streq( key, keylen, "nextScrapeTime" ) )
    407411        tr_bencDictAddInt( d, key, st->nextScrapeTime );
    408     else if( !strcmp( key, "peers" ) )
     412    else if( tr_streq( key, keylen, "peers" ) )
    409413        addPeers( tor, tr_bencDictAdd( d, key ) );
    410     else if( !strcmp( key, "peersConnected" ) )
     414    else if( tr_streq( key, keylen, "peersConnected" ) )
    411415        tr_bencDictAddInt( d, key, st->peersConnected );
    412     else if( !strcmp( key, "peersFrom" ) )
     416    else if( tr_streq( key, keylen, "peersFrom" ) )
    413417    {
    414418        tr_benc *   tmp = tr_bencDictAddDict( d, key, 4 );
     
    419423        tr_bencDictAddInt( tmp, "fromTracker",  f[TR_PEER_FROM_TRACKER] );
    420424    }
    421     else if( !strcmp( key, "peersGettingFromUs" ) )
     425    else if( tr_streq( key, keylen, "peersGettingFromUs" ) )
    422426        tr_bencDictAddInt( d, key, st->peersGettingFromUs );
    423     else if( !strcmp( key, "peersKnown" ) )
     427    else if( tr_streq( key, keylen, "peersKnown" ) )
    424428        tr_bencDictAddInt( d, key, st->peersKnown );
    425     else if( !strcmp( key, "peersSendingToUs" ) )
     429    else if( tr_streq( key, keylen, "peersSendingToUs" ) )
    426430        tr_bencDictAddInt( d, key, st->peersSendingToUs );
    427     else if( !strcmp( key, "pieceCount" ) )
     431    else if( tr_streq( key, keylen, "pieceCount" ) )
    428432        tr_bencDictAddInt( d, key, inf->pieceCount );
    429     else if( !strcmp( key, "pieceSize" ) )
     433    else if( tr_streq( key, keylen, "pieceSize" ) )
    430434        tr_bencDictAddInt( d, key, inf->pieceSize );
    431     else if( !strcmp( key, "priorities" ) )
     435    else if( tr_streq( key, keylen, "priorities" ) )
    432436    {
    433437        tr_file_index_t i;
     
    436440            tr_bencListAddInt( p, inf->files[i].priority );
    437441    }
    438     else if( !strcmp( key, "rateDownload" ) )
     442    else if( tr_streq( key, keylen, "rateDownload" ) )
    439443        tr_bencDictAddInt( d, key, (int)( st->pieceDownloadSpeed * 1024 ) );
    440     else if( !strcmp( key, "rateUpload" ) )
     444    else if( tr_streq( key, keylen, "rateUpload" ) )
    441445        tr_bencDictAddInt( d, key, (int)( st->pieceUploadSpeed * 1024 ) );
    442     else if( !strcmp( key, "recheckProgress" ) )
     446    else if( tr_streq( key, keylen, "recheckProgress" ) )
    443447        tr_bencDictAddDouble( d, key, st->recheckProgress );
    444     else if( !strcmp( key, "scrapeResponse" ) )
     448    else if( tr_streq( key, keylen, "scrapeResponse" ) )
    445449        tr_bencDictAddStr( d, key, st->scrapeResponse );
    446     else if( !strcmp( key, "scrapeURL" ) )
     450    else if( tr_streq( key, keylen, "scrapeURL" ) )
    447451        tr_bencDictAddStr( d, key, st->scrapeURL );
    448     else if( !strcmp( key, "seeders" ) )
     452    else if( tr_streq( key, keylen, "seeders" ) )
    449453        tr_bencDictAddInt( d, key, st->seeders );
    450     else if( !strcmp( key, "sizeWhenDone" ) )
     454    else if( tr_streq( key, keylen, "sizeWhenDone" ) )
    451455        tr_bencDictAddInt( d, key, st->sizeWhenDone );
    452     else if( !strcmp( key, "startDate" ) )
     456    else if( tr_streq( key, keylen, "startDate" ) )
    453457        tr_bencDictAddInt( d, key, st->startDate );
    454     else if( !strcmp( key, "status" ) )
     458    else if( tr_streq( key, keylen, "status" ) )
    455459        tr_bencDictAddInt( d, key, st->activity );
    456     else if( !strcmp( key, "swarmSpeed" ) )
     460    else if( tr_streq( key, keylen, "swarmSpeed" ) )
    457461        tr_bencDictAddInt( d, key, (int)( st->swarmSpeed * 1024 ) );
    458     else if( !strcmp( key, "timesCompleted" ) )
     462    else if( tr_streq( key, keylen, "timesCompleted" ) )
    459463        tr_bencDictAddInt( d, key, st->timesCompleted );
    460     else if( !strcmp( key, "trackers" ) )
     464    else if( tr_streq( key, keylen, "trackers" ) )
    461465        addTrackers( inf, tr_bencDictAddList( d, key, inf->trackerCount ) );
    462     else if( !strcmp( key, "totalSize" ) )
     466    else if( tr_streq( key, keylen, "totalSize" ) )
    463467        tr_bencDictAddInt( d, key, inf->totalSize );
    464     else if( !strcmp( key, "uploadedEver" ) )
     468    else if( tr_streq( key, keylen, "uploadedEver" ) )
    465469        tr_bencDictAddInt( d, key, st->uploadedEver );
    466     else if( !strcmp( key, "uploadLimitMode" ) )
     470    else if( tr_streq( key, keylen, "uploadLimitMode" ) )
    467471        tr_bencDictAddInt( d, key,   tr_torrentGetSpeedMode( tor, TR_UP ) );
    468     else if( !strcmp( key, "uploadLimit" ) )
     472    else if( tr_streq( key, keylen, "uploadLimit" ) )
    469473        tr_bencDictAddInt( d, key, tr_torrentGetSpeedLimit( tor, TR_UP ) );
    470     else if( !strcmp( key, "uploadRatio" ) )
     474    else if( tr_streq( key, keylen, "uploadRatio" ) )
    471475        tr_bencDictAddDouble( d, key,
    472476                             tr_getRatio( st->uploadedEver,
    473477                                          st->downloadedEver ) );
    474     else if( !strcmp( key, "wanted" ) )
     478    else if( tr_streq( key, keylen, "wanted" ) )
    475479    {
    476480        tr_file_index_t i;
     
    479483            tr_bencListAddInt( w, inf->files[i].dnd ? 0 : 1 );
    480484    }
    481     else if( !strcmp( key, "webseeds" ) )
     485    else if( tr_streq( key, keylen, "webseeds" ) )
    482486        addWebseeds( inf, tr_bencDictAddList( d, key, inf->trackerCount ) );
    483     else if( !strcmp( key, "webseedsSendingToUs" ) )
     487    else if( tr_streq( key, keylen, "webseedsSendingToUs" ) )
    484488        tr_bencDictAddInt( d, key, st->webseedsSendingToUs );
    485489}
  • branches/1.5x/libtransmission/verify.c

    r7813 r8455  
    188188
    189189        tr_lockLock( getVerifyLock( ) );
    190         tor->verifyState = verifyList ? TR_VERIFY_WAIT : TR_VERIFY_NOW;
     190        tor->verifyState = TR_VERIFY_WAIT;
    191191        tr_list_append( &verifyList, node );
    192192        if( verifyThread == NULL )
  • branches/1.5x/libtransmission/web.c

    r8204 r8455  
    8484getSockinfo( tr_web * web, int fd, tr_bool createIfMissing )
    8585{
    86     tr_list * l = web->fds;
     86    tr_list * l;
    8787
    8888    for( l=web->fds; l!=NULL; l=l->next ) {
  • branches/1.5x/web/javascript/torrent.js

    r8272 r8455  
    264264                if (data.creator)       this._creator       = data.creator;
    265265                if (data.dateCreated)   this._creator_date  = data.dateCreated;
    266                 if (data.leftUntilDone) this._leftUntilDone = data.leftUntilDone;
    267266                if (data.sizeWhenDone)  this._sizeWhenDone  = data.sizeWhenDone;
    268267                if (data.path)          this._torrent_file  = data.path;//FIXME
     
    276275                this._completed             = data.haveUnchecked + data.haveValid;
    277276                this._verified              = data.haveValid;
     277                this._leftUntilDone         = data.leftUntilDone;
    278278                this._download_total        = data.downloadedEver;
    279279                this._upload_total          = data.uploadedEver;
  • branches/1.5x/web/javascript/transmission.js

    r7923 r8455  
    952952
    953953                var ti = '#torrent_inspector_';
    954                 $(ti+'name')[0].innerHTML            = name;
    955                 $(ti+'size')[0].innerHTML            = torrents.length ? Math.formatBytes( total_size ) : 'N/A';
    956                 $(ti+'tracker')[0].innerHTML         = total_tracker;
    957                 $(ti+'hash')[0].innerHTML            = hash;
    958                 $(ti+'state')[0].innerHTML           = total_state;
    959                 $(ti+'download_speed')[0].innerHTML  = torrents.length ? Math.formatBytes( total_download_speed ) + '/s' : 'N/A';
    960                 $(ti+'upload_speed')[0].innerHTML    = torrents.length ? Math.formatBytes( total_upload_speed ) + '/s' : 'N/A';
    961                 $(ti+'uploaded')[0].innerHTML        = torrents.length ? Math.formatBytes( total_upload ) : 'N/A';
    962                 $(ti+'downloaded')[0].innerHTML      = torrents.length ? Math.formatBytes( total_download ) : 'N/A';
    963                 $(ti+'ratio')[0].innerHTML           = torrents.length ? Math.ratio( total_upload, total_download ) : 'N/A';
    964                 $(ti+'total_seeders')[0].innerHTML   = torrents.length ? total_seeders : 'N/A';
    965                 $(ti+'total_leechers')[0].innerHTML  = torrents.length ? total_leechers : 'N/A';
    966                 $(ti+'swarm_speed')[0].innerHTML     = torrents.length ? Math.formatBytes(total_swarm_speed) + '/s' : 'N/A';
    967                 $(ti+'have')[0].innerHTML            = torrents.length ? Math.formatBytes(total_completed) + ' (' + Math.formatBytes(total_verified) + ' verified)' : 'N/A';
    968                 $(ti+'upload_to')[0].innerHTML       = torrents.length ? total_upload_peers : 'N/A';
    969                 $(ti+'download_from')[0].innerHTML   = torrents.length ? total_download_peers : 'N/A';
    970                 $(ti+'secure')[0].innerHTML          = private_string;
    971                 $(ti+'creator_date')[0].innerHTML    = date_created;
    972                 $(ti+'progress')[0].innerHTML        = torrents.length ? Math.ratio( sizeDone*100, sizeWhenDone ) + '%' : 'N/A';
    973                 $(ti+'comment')[0].innerHTML         = comment;
    974                 $(ti+'creator')[0].innerHTML         = creator;
    975                 $(ti+'error')[0].innerHTML           = error;
     954                setInnerHTML( $(ti+'name')[0], name );
     955                setInnerHTML( $(ti+'size')[0], torrents.length ? Math.formatBytes( total_size ) : 'N/A' );
     956                setInnerHTML( $(ti+'tracker')[0], total_tracker.replace(/\//g, '/&#8203;') );
     957                setInnerHTML( $(ti+'hash')[0], hash );
     958                setInnerHTML( $(ti+'state')[0], total_state );
     959                setInnerHTML( $(ti+'download_speed')[0], torrents.length ? Math.formatBytes( total_download_speed ) + '/s' : 'N/A' );
     960                setInnerHTML( $(ti+'upload_speed')[0], torrents.length ? Math.formatBytes( total_upload_speed ) + '/s' : 'N/A' );
     961                setInnerHTML( $(ti+'uploaded')[0], torrents.length ? Math.formatBytes( total_upload ) : 'N/A' );
     962                setInnerHTML( $(ti+'downloaded')[0], torrents.length ? Math.formatBytes( total_download ) : 'N/A' );
     963                setInnerHTML( $(ti+'ratio')[0], torrents.length ? Math.ratio( total_upload, total_download ) : 'N/A' );
     964                setInnerHTML( $(ti+'total_seeders')[0], torrents.length ? total_seeders : 'N/A' );
     965                setInnerHTML( $(ti+'total_leechers')[0], torrents.length ? total_leechers : 'N/A' );
     966                setInnerHTML( $(ti+'swarm_speed')[0], torrents.length ? Math.formatBytes(total_swarm_speed) + '/s' : 'N/A' );
     967                setInnerHTML( $(ti+'have')[0], torrents.length ? Math.formatBytes(total_completed) + ' (' + Math.formatBytes(total_verified) + ' verified)' : 'N/A' );
     968                setInnerHTML( $(ti+'upload_to')[0], torrents.length ? total_upload_peers : 'N/A' );
     969                setInnerHTML( $(ti+'download_from')[0], torrents.length ? total_download_peers : 'N/A' );
     970                setInnerHTML( $(ti+'secure')[0], private_string );
     971                setInnerHTML( $(ti+'creator_date')[0], date_created );
     972                setInnerHTML( $(ti+'progress')[0], torrents.length ? Math.ratio( sizeDone*100, sizeWhenDone ) + '%' : 'N/A' );
     973                setInnerHTML( $(ti+'comment')[0], comment );
     974                setInnerHTML( $(ti+'tracker')[0], total_tracker.replace(/\//g, '/&#8203;') );
     975                setInnerHTML( $(ti+'creator')[0], creator );
     976                setInnerHTML( $(ti+'error')[0], error );
    976977               
    977978                $(".inspector_row > div:contains('N/A')").css('color', '#666');
     
    11821183                        var args = { };
    11831184                        if ('' != $('#torrent_upload_url').val()) {
    1184                                 tr.remote.addTorrentByUrl($('#torrent_upload_url').val(), { paused: !this[Prefs._Autostart] });
     1185                                tr.remote.addTorrentByUrl($('#torrent_upload_url').val(), { paused: !this[Prefs._AutoStart] });
    11851186                        } else {
    11861187                                args.url = '/transmission/upload?paused=' + (this[Prefs._AutoStart] ? 'false' : 'true');
    11871188                                args.type = 'POST';
     1189                                args.data = { 'X-Transmission-Session-Id' : tr.remote._token };
    11881190                                args.dataType = 'xml';
    11891191                                args.iframe = true;
  • branches/1.5x/web/stylesheets/common.css

    r8057 r8455  
    593593        right: 0px;
    594594        bottom: 0;
    595         z-index: 2;
     595        z-index: 3;
    596596        color: #000;
    597597        text-shadow: 0 1px 0 #ccc;
     
    640640        width: 100%;
    641641        height: 100%;
    642         z-index: 2;
    643642        text-align: center;
    644643        color: black;
     
    648647div.dialog_container div.dialog_window {
    649648        background-color: #eee;
    650         margin: -210px auto 0;
     649        margin: 0 auto;
    651650        filter: alpha(opacity=95);
    652651        -moz-opacity: .95;
     
    655654        text-align: left;
    656655        width: 420px;
     656        z-index: 4;
    657657        height: 145px;
    658658        position: relative;
    659659        -webkit-box-shadow: 0 3px 6px rgba(0,0,0,0.7);
    660         top: 50%;
     660        top: 80px;
    661661        padding-bottom: 20px;
    662662}
     
    665665                top: 0;
    666666                margin-top: 71px;
     667                z-index: 2
    667668        }
    668669}
     
    672673        height: 420px;
    673674        padding: 0 15px;
    674         line-height: 14pt;
    675675}
    676676
     
    707707        border: 1px solid #787878;
    708708        width: 50px;
     709        height: 15px;
    709710        text-align: center;
    710711        font-weight: bold;
     
    718719div.dialog_container div.dialog_window a:hover,
    719720div.dialog_container div.dialog_window a:active {
    720         background: #C0C8D6 url('../images/graphics/filter_bar_bg.png') repeat-x;
    721 }
    722 
    723 div#upload_container div.dialog_window {
    724         height: 200px !important;
    725         position: relative;
    726 }
    727 
    728 div#upload_container div.dialog_window div.dialog_message {
    729         height: 110px;
     721        background: #C0C8D6 url('../images/graphics/filter_bar.png') repeat-x;
    730722}
    731723
Note: See TracChangeset for help on using the changeset viewer.