Ignore:
Timestamp:
Apr 5, 2011, 10:21:18 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) fix ABR error when parsing a URL with no path and no trailing slash after the host. Error reported by livings124

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r12312 r12324  
    10311031            host_len = n;
    10321032            pch += n;
    1033             *pch++ = '\0';
     1033            if( pch && *pch )
     1034                *pch++ = '\0';
    10341035/*fprintf( stderr, "host is [%s]... what's left is [%s]\n", host, pch );*/
    10351036            if( havePort )
     
    10621063        if( setme_host ){ ( (char*)host )[-3] = ':'; *setme_host =
    10631064                              tr_strndup( host, host_len ); }
    1064         if( setme_path ){ if( path[0] == '/' ) *setme_path = tr_strdup( path );
     1065        if( setme_path ){ if( !*path ) *setme_path = tr_strdup( "/" );
     1066                          else if( path[0] == '/' ) *setme_path = tr_strdup( path );
    10651067                          else { ( (char*)path )[-1] = '/'; *setme_path = tr_strdup( path - 1 ); } }
    10661068        if( setme_port ) *setme_port = port;
Note: See TracChangeset for help on using the changeset viewer.