summaryrefslogtreecommitdiffstats
path: root/stream/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/url.c')
-rw-r--r--stream/url.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/stream/url.c b/stream/url.c
index a198628fe1..7a7b407c15 100644
--- a/stream/url.c
+++ b/stream/url.c
@@ -22,10 +22,15 @@
URL_t *url_redirect(URL_t **url, const char *redir) {
URL_t *u = *url;
URL_t *res;
- if (!strchr(redir, '/')) {
+ if (!strchr(redir, '/') || *redir == '/') {
char *tmp;
char *newurl = malloc(strlen(u->url) + strlen(redir) + 1);
strcpy(newurl, u->url);
+ if (*redir == '/') {
+ redir++;
+ tmp = strstr(newurl, "://");
+ if (tmp) tmp = strchr(tmp + 3, '/');
+ } else
tmp = strrchr(newurl, '/');
if (tmp) tmp[1] = 0;
strcat(newurl, redir);