From 1daf47f7d0f4af639559abdd7b62652faa0fcfcc Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 21 Nov 2006 16:26:38 +0000 Subject: Also support absolute url redirection, e.g. http://www.youtube.com/v/buKaqRG2SFA (video does not play anyway though). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21141 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/url.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3