diff options
-rw-r--r-- | desktop/browser.c | 41 | ||||
-rw-r--r-- | riscos/uri.c | 16 | ||||
-rw-r--r-- | riscos/url_protocol.c | 27 |
3 files changed, 51 insertions, 33 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); diff --git a/riscos/uri.c b/riscos/uri.c index 4e0205391..d513af8c6 100644 --- a/riscos/uri.c +++ b/riscos/uri.c @@ -74,13 +74,13 @@ bool ro_uri_launch(char *uri) { wimp_t handle_task; uri_dispatch_flags returned; os_error *e; - + e = xuri_dispatch(0, uri, task_handle, &returned, &handle_task, &uri_handle); - + if (e || returned & 1) { return false; } - + return true; } @@ -88,15 +88,15 @@ void ro_uri_bounce(uri_full_message_return_result *message) { char uri_buf[512]; os_error *e; - + if ((message->flags & 1) == 0) return; - + e = xuri_request_uri(0, uri_buf, sizeof uri_buf, message->handle, 0); - + if (e) return; - + ro_url_load(uri_buf); - + return; } #endif diff --git a/riscos/url_protocol.c b/riscos/url_protocol.c index e1b32e691..b24e68401 100644 --- a/riscos/url_protocol.c +++ b/riscos/url_protocol.c @@ -131,20 +131,21 @@ bool ro_url_broadcast(char *url) { inetsuite_full_message_open_url_direct message; os_error *e; - int len = (strlen(url)>235) ? 235 : strlen(url); - - message.size = (((20+len-1)+3) & ~3); + int len = ((strlen(url)+1)>235) ? 235 : strlen(url)+1; + + message.size = ((20+len+3) & ~3); message.your_ref = 0; message.action = message_INET_SUITE_OPEN_URL; - + *message.url = 0; strncat(message.url, url, 235); - e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, + message.url[len-1] = 0; + e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, (wimp_message*)&message, 0); if (e) { return false; } - + return true; } @@ -153,30 +154,30 @@ bool ro_url_load(char *url) { char url_buf[512]; char *colon; os_error *e; - + colon = strchr(url, ':'); if (!colon) return false; - + strcpy(url_buf, "Alias$URLOpen_"); strncat(url_buf, url, colon-url); if (!getenv(url_buf)) return false; - + strcat(url_buf, " "); strncat(url_buf, url, 512-strlen(url_buf)-1); - + e = xwimp_start_task(url_buf+5, 0); - + if (e) { return false; } - + return true; } void ro_url_bounce(wimp_message *message) { inetsuite_message_open_url *url_message = (inetsuite_message_open_url*)&message->data; - + /* ant broadcast bounced -> try uri broadcast / load */ ro_uri_launch(url_message->url); } |