summaryrefslogtreecommitdiff
path: root/utils/utils.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2003-10-25 19:20:13 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2003-10-25 19:20:13 +0000
commitc9e188a4d1634d9c7d2292a8d04e02f313f37f3b (patch)
treea58742b163820d4ee839f4a035603afa50243e63 /utils/utils.c
parented449261f62cb56a9d6eb7d16f7d54d79bbea1f4 (diff)
downloadnetsurf-c9e188a4d1634d9c7d2292a8d04e02f313f37f3b.tar.gz
netsurf-c9e188a4d1634d9c7d2292a8d04e02f313f37f3b.tar.bz2
[project @ 2003-10-25 19:20:13 by jmb]
HTTP Auth login improved (greatly). Addresses all three issues in the previous version. svn path=/import/netsurf/; revision=382
Diffstat (limited to 'utils/utils.c')
-rw-r--r--utils/utils.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/utils/utils.c b/utils/utils.c
index bc912fdc7..ca7d7f2fc 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -197,14 +197,14 @@ char *url_join(const char* new, const char* base)
nn[j] = new[i];
k = j;
}
-
+
j++;
}
if(k < j){
nn[k+1] = '\0';
LOG(("before: %s after: %s", new, nn));
}
-
+
new = nn;
if (base == 0)
@@ -252,7 +252,26 @@ char *url_join(const char* new, const char* base)
strcpy(ret, new);
}
- xfree(nn);
+ xfree(nn);
return ret;
}
+char *get_host_from_url (char *url) {
+
+ char *host = xcalloc(strlen(url)+10, sizeof(char));
+ int i;
+
+ i = strspn(url, "abcdefghijklmnopqrstuvwxyz");
+ if (url[i] == ':') {
+ strcpy(host, url);
+ i += 3;
+ }
+
+ for (; host[i] != 0 && host[i] != '/'; i++)
+ host[i] = tolower(host[i]);
+
+ host[i] = '/';
+ host[i+1] = 0;
+
+ return host;
+}