Changeset 11801


Ignore:
Timestamp:
Feb 1, 2011, 1:38:58 AM (12 years ago)
Author:
jordan
Message:

(trunk gtk) #3971 "favicons do not work for IP addresses" -- fixed.

gtr_get_host_from_url() wasn't written to handle dotted-quad or IPv6 address strings, but can handle them now.

Location:
trunk/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/filter.c

    r11709 r11801  
    7171    const char * dot = strrchr( host, '.' );
    7272
    73     if( dot == NULL )
     73    if( tr_addressIsIP( host ) )
    7474        name = g_strdup( host );
     75    else if( dot )
     76        name = g_strndup( host, dot - host );
    7577    else
    76         name = g_strndup( host, dot - host );
     78        name = g_strdup( host );
    7779
    7880    *name = g_ascii_toupper( *name );
  • trunk/gtk/util.c

    r11743 r11801  
    254254    char * h = NULL;
    255255    char * name;
    256     const char * first_dot;
    257     const char * last_dot;
    258256
    259257    tr_urlParse( url, -1, NULL, &h, NULL, NULL );
    260     first_dot = strchr( h, '.' );
    261     last_dot = strrchr( h, '.' );
    262 
    263     if( ( first_dot ) && ( last_dot ) && ( first_dot != last_dot ) )
    264         name = g_strdup( first_dot + 1 );
    265     else
     258
     259    if( tr_addressIsIP( h ) )
    266260        name = g_strdup( h );
     261    else {
     262        const char * first_dot = strchr( h, '.' );
     263        const char * last_dot = strrchr( h, '.' );
     264        if( ( first_dot ) && ( last_dot ) && ( first_dot != last_dot ) )
     265            name = g_strdup( first_dot + 1 );
     266        else
     267            name = g_strdup( h );
     268    }
    267269
    268270    tr_free( h );
Note: See TracChangeset for help on using the changeset viewer.