changeset 411:009c4cf94433 release-2_0

- Changed the google search URL (UTF-8 request) - Patch to recognize IPv6 numbers in the URL's authority part
author jcid
date Tue, 14 Oct 2008 16:04:53 +0200
parents 9b19218ac813
children 029ce6dfd67b
files dillorc src/prefs.c src/url.c
diffstat 3 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dillorc	Mon Oct 13 16:53:02 2008 +0200
+++ b/dillorc	Tue Oct 14 16:04:53 2008 +0200
@@ -95,7 +95,7 @@
 # "%s" is replaced with the search keywords separated by '+'.
 # search_url="http://search.lycos.com/?query=%s"
 # search_url="http://www.alltheweb.com/search?cat=web&query=%s"
-#search_url="http://www.google.com/search?q=%s"
+#search_url="http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=%s"
 
 # Set the proxy information for http.
 # WARNING: dillo uses wget for ftp and https. To use a proxy for those
--- a/src/prefs.c	Mon Oct 13 16:53:02 2008 +0200
+++ b/src/prefs.c	Tue Oct 14 16:04:53 2008 +0200
@@ -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
--- a/src/url.c	Mon Oct 13 16:53:02 2008 +0200
+++ b/src/url.c	Tue Oct 14 16:04:53 2008 +0200
@@ -102,11 +102,23 @@
    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;