[vlc-devel] [PATCH] access/http: Fail for ICY, legacy HTTP module to retries

Marvin Scholz epirat07 at gmail.com
Sun Oct 29 13:14:22 CET 2017


Failing for ICY, the old HTTP module will retry and use the initially
provided URL, so auth information provided by the user in the URL is
not discarded.
---
 modules/access/http/access.c   | 10 ++++++++++
 modules/access/http/resource.c |  6 ------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/access/http/access.c b/modules/access/http/access.c
index ab72107a04..9a214bf03f 100644
--- a/modules/access/http/access.c
+++ b/modules/access/http/access.c
@@ -37,6 +37,7 @@
 #include "resource.h"
 #include "file.h"
 #include "live.h"
+#include "message.h"
 
 struct access_sys_t
 {
@@ -227,6 +228,15 @@ static int Open(vlc_object_t *obj)
         goto error;
     }
 
+    /* HACK: Seems like an ICY stream, fail, so that legacy HTTP handles it */
+    if (((status / 100) == 2 && !sys->resource->secure) &&
+        (vlc_http_msg_get_header(sys->resource->response, "Icy-Name") != NULL
+      || vlc_http_msg_get_header(sys->resource->response, "Icy-Genre") != NULL))
+    {
+        msg_Err(access, "Looks like ICY. Failing for legacy HTTP to take over.");
+        goto error;
+    }
+
     char *redir = vlc_http_res_get_redirect(sys->resource);
     if (redir != NULL)
     {
diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index 4f49a4bff6..3f57f420da 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -259,12 +259,6 @@ char *vlc_http_res_get_redirect(struct vlc_http_resource *restrict res)
         if (vlc_http_msg_get_token(res->response, "Pragma", "features") != NULL
          && asprintf(&url, "mmsh://%s%s", res->authority, res->path) >= 0)
             return url;
-
-        /* HACK: Seems like an ICY server. Redirect to ICYX scheme. */
-        if ((vlc_http_msg_get_header(res->response, "Icy-Name") != NULL
-          || vlc_http_msg_get_header(res->response, "Icy-Genre") != NULL)
-         && asprintf(&url, "icyx://%s%s", res->authority, res->path) >= 0)
-            return url;
     }
 
     /* TODO: if (status == 426 Upgrade Required) */
-- 
2.13.5 (Apple Git-94)



More information about the vlc-devel mailing list