summaryrefslogtreecommitdiffstats
path: root/stream/url.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-21 16:26:38 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-21 16:26:38 +0000
commit1daf47f7d0f4af639559abdd7b62652faa0fcfcc (patch)
tree1a528b5157f166e2ff5a990654935aa43a98b2a7 /stream/url.c
parentd021529c7168b8fd62bd175d6e866d4835de0dc4 (diff)
downloadmpv-1daf47f7d0f4af639559abdd7b62652faa0fcfcc.tar.bz2
mpv-1daf47f7d0f4af639559abdd7b62652faa0fcfcc.tar.xz
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
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);