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
This commit is contained in:
Chris Young 2009-11-01 16:01:07 +00:00
parent 019eff10c1
commit 0efc756a7a

View File

@ -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/
*
@ -54,22 +54,19 @@ char *url_to_path(const char *url)
char *tmps, *unesc;
CURL *curl;
if(tmps = strchr(url,'/'))
{
if(tmps = strchr(tmps+1,'/'))
{
if(tmps = strchr(tmps+1,'/'))
tmps = strstr(url, "///localhost/") + 13;
if(tmps < url) tmps = strstr(url,"///") + 3;
if(tmps >= url)
{
if(curl = curl_easy_init())
{
unesc = curl_easy_unescape(curl,tmps+1,0,NULL);
unesc = curl_easy_unescape(curl,tmps,0,NULL);
tmps = strdup(unesc);
curl_free(unesc);
curl_easy_cleanup(curl);
return tmps;
}
}
}
}