summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-04-02 15:16:15 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-04-02 15:16:15 +0000
commit361fcf507a3591c97890091f1e906a2ee9402462 (patch)
tree1b5c34c1da558c7c2791282b1aec509015e1a083 /desktop
parent20454498ed6dd9cb3361fc8cece0319d789dd62e (diff)
downloadnetsurf-361fcf507a3591c97890091f1e906a2ee9402462.tar.gz
netsurf-361fcf507a3591c97890091f1e906a2ee9402462.tar.bz2
[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
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c41
1 files changed, 29 insertions, 12 deletions
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 <string.h>
#include <time.h>
#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);