1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

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
This commit is contained in:
reimar 2006-11-21 16:26:38 +00:00
parent d021529c71
commit 1daf47f7d0

View File

@ -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);