Author: chris_y
Date: Sun Nov 1 10:01:07 2009
New Revision: 9656
URL:
http://source.netsurf-browser.org?rev=9656&view=rev
Log:
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.
Modified:
trunk/netsurf/amiga/misc.c
Modified: trunk/netsurf/amiga/misc.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/amiga/misc.c?rev=9656&...
==============================================================================
--- trunk/netsurf/amiga/misc.c (original)
+++ trunk/netsurf/amiga/misc.c Sun Nov 1 10:01:07 2009
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -51,25 +51,22 @@
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;
}
}