diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2009-11-01 16:01:07 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2009-11-01 16:01:07 +0000 |
commit | 0efc756a7a1a511d5d0a95e96cdf55eec6df0cc7 (patch) | |
tree | d5d49cb1040bf1acf60f261df08186e64314c000 /amiga/misc.c | |
parent | 019eff10c1d68c80593d3fa6fedf1f6428fcff63 (diff) | |
download | netsurf-0efc756a7a1a511d5d0a95e96cdf55eec6df0cc7.tar.gz netsurf-0efc756a7a1a511d5d0a95e96cdf55eec6df0cc7.tar.bz2 |
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
Diffstat (limited to 'amiga/misc.c')
-rwxr-xr-x | amiga/misc.c | 29 |
1 files changed, 13 insertions, 16 deletions
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 <chris@unsatisfactorysoftware.co.uk> + * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk> * * 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; } } |