[vlc-commits] http: parse redirection correctly

Rémi Denis-Courmont git at videolan.org
Sun Jul 17 16:13:57 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 17 17:12:59 2016 +0300| [8db2ea575772345f5ff1f76b8f0cb18039b28d45] | committer: Rémi Denis-Courmont

http: parse redirection correctly

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8db2ea575772345f5ff1f76b8f0cb18039b28d45
---

 modules/access/http/access.c   |    4 +++-
 modules/access/http/resource.c |   12 ------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/modules/access/http/access.c b/modules/access/http/access.c
index dd0192e..ce274a3 100644
--- a/modules/access/http/access.c
+++ b/modules/access/http/access.c
@@ -202,7 +202,9 @@ static int Open(vlc_object_t *obj)
             free(redir);
             redir = fixed;
         }
-        access->psz_url = redir;
+
+        access->psz_url = vlc_uri_resolve(access->psz_url, redir);
+        free(redir);
         ret = VLC_ACCESS_REDIRECT;
         goto error;
     }
diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index e666df6..e092a4f 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -278,18 +278,6 @@ char *vlc_http_res_get_redirect(struct vlc_http_resource *restrict res)
     /* NOTE: The anchor is discard if it is present as VLC does not support
      * HTML anchors so far. */
     size_t len = strcspn(location, "#");
-
-    /* FIXME: resolve relative URL _correctly_ */
-    if (location[0] == '/')
-    {
-        char *url;
-
-        if (unlikely(asprintf(&url, "%s://%s%.*s",
-                              res->secure ? "https" : "http", res->authority,
-                              (int)len, location) < 0))
-            return NULL;
-        return url;
-    }
     return strndup(location, len);
 }
 



More information about the vlc-commits mailing list