From f373b275ddb7bc7973a9075b071a4320c30b682f Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 25 Dec 2002 20:17:18 +0000 Subject: [project @ 2002-12-25 20:17:18 by bursa] Fix reloads and links. svn path=/import/netsurf/; revision=54 --- desktop/browser.c | 11 +++++++---- desktop/fetch.c | 28 ++++++++++------------------ 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'desktop') diff --git a/desktop/browser.c b/desktop/browser.c index 8ecf9eec8..8ff634fae 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1,5 +1,5 @@ /** - * $Id: browser.c,v 1.10 2002/12/23 21:19:01 bursa Exp $ + * $Id: browser.c,v 1.11 2002/12/25 20:17:18 bursa Exp $ */ #include "netsurf/riscos/font.h" @@ -412,9 +412,12 @@ void browser_window_open_location_historical(struct browser_window* bw, char* ur browser_window_start_throbber(bw); /* TODO: factor out code shared with browser_window_message(), case msg_FETCH_FINISHED */ - if (bw->url != NULL) - xfree(bw->url); - bw->url = xstrdup(url); + if (url != bw->url) /* reload <=> url == bw->url */ + { + if (bw->url != NULL) + xfree(bw->url); + bw->url = xstrdup(url); + } gmsg.type = msg_SET_URL; gmsg.data.set_url.url = bw->url; diff --git a/desktop/fetch.c b/desktop/fetch.c index 02a74585b..4eabeb653 100644 --- a/desktop/fetch.c +++ b/desktop/fetch.c @@ -1,5 +1,5 @@ /** - * $Id: fetch.c,v 1.2 2002/09/18 19:30:19 bursa Exp $ + * $Id: fetch.c,v 1.3 2002/12/25 20:17:18 bursa Exp $ */ #include "libxml/HTMLparser.h" @@ -10,19 +10,20 @@ #include "netsurf/desktop/fetch.h" #include "netsurf/render/utils.h" #include "curl/curl.h" +#include "libxml/uri.h" #include #include #include void fetch_identify_location(struct fetch* f, char* location, char* previous) { - FILE* ff = fopen("identify", "a"); +/* FILE* ff = fopen("identify", "a"); fprintf(ff, "identify: '%s' '%s'", location, previous); if (f->location != NULL) fprintf(ff, " '%s'\n", f->location); else fprintf(ff, "\n"); - fclose(ff); + fclose(ff);*/ if (f->location != NULL) xfree(f->location); @@ -41,19 +42,10 @@ void fetch_identify_location(struct fetch* f, char* location, char* previous) } else if (previous != NULL) { - char* ext = strrchr(previous, '/'); - - if (ext != NULL && ext != previous) - { - int len = (int)(ext - previous) + strlen(location) + 2; - char* combined = xcalloc(len, sizeof(char)); - strncpy(combined, previous, (int)(ext - previous)); - strcpy(combined + (ext - previous), "/"); - strcpy(combined + (ext - previous) + 1, location); - fetch_identify_location(f, combined, NULL); - xfree(combined); - return; - } + f->location = xmlBuildURI(location, previous); + assert(f->location != NULL); + f->type = fetch_CURL; + return; } f->location = xcalloc(strlen(location) + strlen("http://") + 1, sizeof(char)); @@ -253,9 +245,9 @@ struct fetch* fetch_poll(struct fetch* f) FILE* in; gui_file_to_filename(f->location, actual_filename, 1024); - in = fopen("files","a"); +/* in = fopen("files","a"); fprintf(in, "%s\n%s\n\n",f->location, actual_filename); - fclose(in); + fclose(in);*/ in = fopen(actual_filename, "r"); if (in == NULL) -- cgit v1.2.3