diff options
author | jcid <devnull@localhost> | 2008-10-14 16:04:53 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-10-14 16:04:53 +0200 |
commit | ce8e972a10c9340312f21511de053242dad3f5db (patch) | |
tree | 47de2fc9a2df5eaba14ba10186de9be1323db458 /src | |
parent | 3a7e1c18f27a0b1cd49c3b44c291fae886310b70 (diff) |
- Changed the google search URL (UTF-8 request)release-2_0
- Patch to recognize IPv6 numbers in the URL's authority part
Diffstat (limited to 'src')
-rw-r--r-- | src/prefs.c | 2 | ||||
-rw-r--r-- | src/url.c | 22 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/prefs.c b/src/prefs.c index 48fe2a86..10e87d0c 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -42,7 +42,7 @@ #define D_VW_FONTNAME "DejaVu Sans" #define D_FW_FONTNAME "DejaVu Sans Mono" -#define D_SEARCH_URL "http://www.google.com/search?q=%s" +#define D_SEARCH_URL "http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=%s" #define D_SAVE_DIR "/tmp/" #define DW_COLOR_DEFAULT_BGND 0xdcd1ba @@ -102,11 +102,23 @@ const char *a_Url_hostname(const DilloUrl *u) DilloUrl *url = (DilloUrl *) u; if (!url->hostname && url->authority) { - if ((p = strchr(url->authority, ':'))) { - url->port = strtol(p + 1, NULL, 10); - url->hostname = dStrndup(url->authority,(uint_t)(p - url->authority)); - } else - url->hostname = url->authority; + if (url->authority[0] == '[' && (p = strchr(url->authority, ']'))) { + /* numeric ipv6 address, strip the brackets */ + url->hostname = dStrndup(url->authority + 1, + (uint_t)(p - url->authority - 1)); + if ((p = strchr(p, ':'))) { + url->port = strtol(p + 1, NULL, 10); + } + } else { + /* numeric ipv4 or hostname */ + if ((p = strchr(url->authority, ':'))) { + url->port = strtol(p + 1, NULL, 10); + url->hostname = dStrndup(url->authority, + (uint_t)(p - url->authority)); + } else { + url->hostname = url->authority; + } + } } return url->hostname; |