From 0efc756a7a1a511d5d0a95e96cdf55eec6df0cc7 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 1 Nov 2009 16:01:07 +0000 Subject: Support file://(/)localhost/ as well as file://(/) As NetSurf insists on adding a third slash after file://, it is not possible to open any local files which are in subdirectory "localhost" of the current directory. Workaround is to type the "localhost" part in something other than fully lowercase. In practice it is incredibly unlikely that even the workaround will need to be used. svn path=/trunk/netsurf/; revision=9656 --- amiga/misc.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'amiga/misc.c') diff --git a/amiga/misc.c b/amiga/misc.c index c77788eae..cedff5d77 100755 --- a/amiga/misc.c +++ b/amiga/misc.c @@ -1,5 +1,5 @@ /* - * Copyright 2008 Chris Young + * Copyright 2008, 2009 Chris Young * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -51,25 +51,22 @@ void die(const char *error) char *url_to_path(const char *url) { - char *tmps,*unesc; + char *tmps, *unesc; CURL *curl; - if(tmps = strchr(url,'/')) + tmps = strstr(url, "///localhost/") + 13; + + if(tmps < url) tmps = strstr(url,"///") + 3; + + if(tmps >= url) { - if(tmps = strchr(tmps+1,'/')) + if(curl = curl_easy_init()) { - if(tmps = strchr(tmps+1,'/')) - { - if(curl = curl_easy_init()) - { - unesc = curl_easy_unescape(curl,tmps+1,0,NULL); - tmps = strdup(unesc); - curl_free(unesc); - curl_easy_cleanup(curl); - return tmps; - - } - } + unesc = curl_easy_unescape(curl,tmps,0,NULL); + tmps = strdup(unesc); + curl_free(unesc); + curl_easy_cleanup(curl); + return tmps; } } -- cgit v1.2.3