mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 15:52:25 +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:
parent
d021529c71
commit
1daf47f7d0
@ -22,10 +22,15 @@
|
|||||||
URL_t *url_redirect(URL_t **url, const char *redir) {
|
URL_t *url_redirect(URL_t **url, const char *redir) {
|
||||||
URL_t *u = *url;
|
URL_t *u = *url;
|
||||||
URL_t *res;
|
URL_t *res;
|
||||||
if (!strchr(redir, '/')) {
|
if (!strchr(redir, '/') || *redir == '/') {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *newurl = malloc(strlen(u->url) + strlen(redir) + 1);
|
char *newurl = malloc(strlen(u->url) + strlen(redir) + 1);
|
||||||
strcpy(newurl, u->url);
|
strcpy(newurl, u->url);
|
||||||
|
if (*redir == '/') {
|
||||||
|
redir++;
|
||||||
|
tmp = strstr(newurl, "://");
|
||||||
|
if (tmp) tmp = strchr(tmp + 3, '/');
|
||||||
|
} else
|
||||||
tmp = strrchr(newurl, '/');
|
tmp = strrchr(newurl, '/');
|
||||||
if (tmp) tmp[1] = 0;
|
if (tmp) tmp[1] = 0;
|
||||||
strcat(newurl, redir);
|
strcat(newurl, redir);
|
||||||
|
Loading…
Reference in New Issue
Block a user