Changeset 5159

Show
Ignore:
Timestamp:
01/07/08 00:25:15 (8 months ago)
Author:
morris
Message:

Fix URL parsing of IPv6 addresses

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libwired/trunk/libwired/data/wi-url.c

    r4797 r5159  
    126126        range = wi_string_range_of_string(string, WI_STR(":"), 0); 
    127127         
    128         if(range.location == WI_NOT_FOUND) { 
     128        if(range.location == WI_NOT_FOUND || 
     129           range.location + range.length >= wi_string_length(string) || 
     130           wi_string_contains_string(wi_string_substring_from_index(string, range.location + 1), WI_STR(":"), 0)) { 
    129131                url->host = wi_copy(string); 
    130132        } else { 
    131133                url->host = wi_retain(wi_string_substring_to_index(string, range.location)); 
    132                  
    133                 if(range.location + range.length < wi_string_length(string)) { 
    134                         string          = wi_string_substring_from_index(string, range.location + 1); 
    135                         url->port       = wi_string_uint32(string); 
    136                 } 
     134                url->port = wi_string_uint32(wi_string_substring_from_index(string, range.location + 1)); 
    137135        } 
    138136