From 1c85bf04293cfba663c5170bbe762825b7e72af1 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 2 Mar 2004 18:02:41 +0000 Subject: [project @ 2004-03-02 18:02:17 by bursa] Add new url functions and modify to use them. svn path=/import/netsurf/; revision=578 --- desktop/browser.c | 19 +++++++++++++------ desktop/browser.h | 6 ++++++ desktop/loginlist.c | 7 ++++--- desktop/netsurf.c | 2 ++ 4 files changed, 25 insertions(+), 9 deletions(-) (limited to 'desktop') diff --git a/desktop/browser.c b/desktop/browser.c index d75b1c33f..6aee554ad 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -30,6 +30,7 @@ #include "netsurf/render/layout.h" #include "netsurf/utils/log.h" #include "netsurf/utils/messages.h" +#include "netsurf/utils/url.h" #include "netsurf/utils/utils.h" @@ -152,12 +153,16 @@ void browser_window_go_post(struct browser_window *bw, const char *url, browser_window_set_status(bw, messages_get("Loading")); bw->history_add = history_add; bw->time0 = clock(); - c = fetchcache(url, 0, - browser_window_callback, bw, 0, - gui_window_get_width(bw->window), 0, - false, - post_urlenc, post_multipart, - true); + if (strncmp(url, "about:", 6) == 0) + c = about_create(url, browser_window_callback, bw, 0, + gui_window_get_width(bw->window), 0); + else + c = fetchcache(url, 0, + browser_window_callback, bw, 0, + gui_window_get_width(bw->window), 0, + false, + post_urlenc, post_multipart, + true); if (!c) { browser_window_set_status(bw, messages_get("FetchFailed")); return; @@ -1743,6 +1748,8 @@ void browser_form_submit(struct browser_window *bw, struct form *form, case method_POST_MULTIPART: url = url_join(form->action, base); + if (!url) + break; browser_window_go_post(bw, url, 0, success, true); break; diff --git a/desktop/browser.h b/desktop/browser.h index e25b26fbe..072201766 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -119,4 +119,10 @@ void history_destroy(struct history *history); void history_back(struct browser_window *bw, struct history *history); void history_forward(struct browser_window *bw, struct history *history); +/* In platform specific about.c. */ +struct content *about_create(const char *url, + void (*callback)(content_msg msg, struct content *c, void *p1, + void *p2, const char *error), + void *p1, void *p2, unsigned long width, unsigned long height); + #endif diff --git a/desktop/loginlist.c b/desktop/loginlist.c index 45d4c0684..85f9e995e 100644 --- a/desktop/loginlist.c +++ b/desktop/loginlist.c @@ -12,6 +12,7 @@ #include "netsurf/utils/config.h" #include "netsurf/desktop/401login.h" #include "netsurf/utils/log.h" +#include "netsurf/utils/url.h" #include "netsurf/utils/utils.h" #ifdef WITH_AUTH @@ -30,7 +31,7 @@ static struct login *loginlist = &login; void login_list_add(char *host, char* logindets) { struct login *nli = xcalloc(1, sizeof(*nli)); - char *temp = get_host_from_url(host); + char *temp = url_host(host); char *i; assert(temp); @@ -81,7 +82,7 @@ struct login *login_list_get(char *host) { (strncasecmp(host, "https://", 8) != 0)) return NULL; - temphost = get_host_from_url(host); + temphost = url_host(host); assert(temphost); temp = xstrdup(host); @@ -89,7 +90,7 @@ struct login *login_list_get(char *host) { * So make sure we've got that at least */ if (strlen(temphost) > strlen(temp)) { - temp = get_host_from_url(host); + temp = url_host(host); assert(temp); } diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 724b57415..02a29c3f5 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -17,6 +17,7 @@ #include "netsurf/desktop/browser.h" #include "netsurf/desktop/gui.h" #include "netsurf/utils/log.h" +#include "netsurf/utils/url.h" #include "netsurf/utils/utils.h" bool netsurf_quit = false; @@ -63,6 +64,7 @@ void netsurf_init(int argc, char** argv) #ifdef WITH_GIF nsgif_init(); #endif + url_init(); } -- cgit v1.2.3