[MPlayer-cvslog] r21141 - trunk/stream/url.c

reimar subversion at mplayerhq.hu
Tue Nov 21 17:26:39 CET 2006


Author: reimar
Date: Tue Nov 21 17:26:38 2006
New Revision: 21141

Modified:
   trunk/stream/url.c

Log:
Also support absolute url redirection, e.g. http://www.youtube.com/v/buKaqRG2SFA
(video does not play anyway though).


Modified: trunk/stream/url.c
==============================================================================
--- trunk/stream/url.c	(original)
+++ trunk/stream/url.c	Tue Nov 21 17:26:38 2006
@@ -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);



More information about the MPlayer-cvslog mailing list