summaryrefslogtreecommitdiffstats
path: root/stream/url.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-08 22:42:31 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-08 22:42:31 +0000
commitc407b9b070d57361f888228037b7b9ce712dc6e2 (patch)
tree103952aef58501e14a88affb4e4696bc0dc7a6f7 /stream/url.c
parentbb52578528a95fffaa250b756c6366452ab28477 (diff)
downloadmpv-c407b9b070d57361f888228037b7b9ce712dc6e2.tar.bz2
mpv-c407b9b070d57361f888228037b7b9ce712dc6e2.tar.xz
Support URL redirections that do not specify full URL.
Fixes crash with mplayer -playlist http://www.radioseven.se/radioseven.pls. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20800 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/url.c')
-rw-r--r--stream/url.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/stream/url.c b/stream/url.c
index 52b850609b..a198628fe1 100644
--- a/stream/url.c
+++ b/stream/url.c
@@ -19,6 +19,25 @@
#define SIZE_MAX ((size_t)-1)
#endif
+URL_t *url_redirect(URL_t **url, const char *redir) {
+ URL_t *u = *url;
+ URL_t *res;
+ if (!strchr(redir, '/')) {
+ char *tmp;
+ char *newurl = malloc(strlen(u->url) + strlen(redir) + 1);
+ strcpy(newurl, u->url);
+ tmp = strrchr(newurl, '/');
+ if (tmp) tmp[1] = 0;
+ strcat(newurl, redir);
+ res = url_new(newurl);
+ free(newurl);
+ } else
+ res = url_new(redir);
+ url_free(u);
+ *url = res;
+ return res;
+}
+
URL_t*
url_new(const char* url) {
int pos1, pos2,v6addr = 0;