summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2010-04-17 10:43:12 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2010-04-17 10:43:12 +0000
commit98b690a900148f09299d678f2b8abb3dbff22640 (patch)
tree06efa29e0838e644f1291c769aaa718abc53df75
parenta2d204814a67483b2d86116ee82b1e58f9c72a4d (diff)
downloadnetsurf-98b690a900148f09299d678f2b8abb3dbff22640.tar.gz
netsurf-98b690a900148f09299d678f2b8abb3dbff22640.tar.bz2
Fix file://localhost/ handling
svn path=/trunk/netsurf/; revision=10422
-rwxr-xr-xamiga/misc.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/amiga/misc.c b/amiga/misc.c
index be01ea73b..17ea4c22b 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -62,20 +62,23 @@ char *url_to_path(const char *url)
char *tmps, *unesc;
CURL *curl;
- tmps = strstr(url, "///localhost/") + 13;
+ if (strncmp(url, "file://", SLEN("file://")) != 0)
+ return NULL;
+
+ url += SLEN("file://");
- if(tmps < url) tmps = strstr(url,"///") + 3;
+ if (strncmp(url, "localhost", SLEN("localhost")) == 0)
+ url += SLEN("localhost");
- if(tmps >= url)
+ url += SLEN("/");
+
+ if(curl = curl_easy_init())
{
- if(curl = curl_easy_init())
- {
- unesc = curl_easy_unescape(curl,tmps,0,NULL);
- tmps = strdup(unesc);
- curl_free(unesc);
- curl_easy_cleanup(curl);
- return tmps;
- }
+ unesc = curl_easy_unescape(curl,url,0,NULL);
+ tmps = strdup(unesc);
+ curl_free(unesc);
+ curl_easy_cleanup(curl);
+ return tmps;
}
return strdup((char *)url);
@@ -83,9 +86,9 @@ char *url_to_path(const char *url)
char *path_to_url(const char *path)
{
- char *r = malloc(strlen(path) + FILE_SCHEME_PREFIX_LEN + 1);
+ char *r = malloc(strlen(path) + SLEN("file:///") + 1);
- strcpy(r, FILE_SCHEME_PREFIX);
+ strcpy(r, "file:///");
strcat(r, path);
return r;