From 361fcf507a3591c97890091f1e906a2ee9402462 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 2 Apr 2004 15:16:15 +0000 Subject: [project @ 2004-04-02 15:16:15 by jmb] Update url checking to use fetch_can_fetch Fix non null-termination of strings in URL broadcast messages. svn path=/import/netsurf/; revision=701 --- desktop/browser.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'desktop/browser.c') diff --git a/desktop/browser.c b/desktop/browser.c index 149f5a2e2..aec455fc2 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -18,6 +18,7 @@ #include #include #include "netsurf/utils/config.h" +#include "netsurf/content/fetch.h" #include "netsurf/content/fetchcache.h" #include "netsurf/css/css.h" #ifdef WITH_AUTH @@ -166,14 +167,6 @@ void browser_window_go_post(struct browser_window *bw, const char *url, c = about_create(url2, browser_window_callback, bw, 0, gui_window_get_width(bw->window), 0); } - /* check that we can handle the URL - just http/https/file for now */ - else if (strncmp(url2, "http:", 5) != 0 && strncmp(url2, "https:", 6) != 0 && - strncmp(url2, "file:", 5) != 0) { - gui_launch_url(url2); - browser_window_set_status(bw, messages_get("LaunchURL")); - free(url2); - return; - } else { c = fetchcache(url2, 0, browser_window_callback, bw, 0, @@ -1375,9 +1368,21 @@ void browser_window_follow_link(struct browser_window *bw, continue; if (click_type == 1) { - browser_window_go(bw, url); + if (fetch_can_fetch(url)) { + browser_window_go(bw, url); + } + else { + gui_launch_url(url); + done = 1; + } } else if (click_type == 2) { - browser_window_create(url); + if (fetch_can_fetch(url)) { + browser_window_create(url); + } + else { + gui_launch_url(url); + done = 1; + } } else if (click_type == 0) { browser_window_set_status(bw, url); browser_window_set_pointer(GUI_POINTER_POINT); @@ -1404,9 +1409,21 @@ void browser_window_follow_link(struct browser_window *bw, continue; if (click_type == 1) { - browser_window_go(bw, url); + if (fetch_can_fetch(url)) { + browser_window_go(bw, url); + } + else { + gui_launch_url(url); + done = 1; + } } else if (click_type == 2) { - browser_window_create(url); + if (fetch_can_fetch(url)) { + browser_window_create(url); + } + else { + gui_launch_url(url); + done = 1; + } } else if (click_type == 0) { browser_window_set_status(bw, url); browser_window_set_pointer(GUI_POINTER_POINT); -- cgit v1.2.3