[vlc-commits] http: redirect to icyx:// if Icy-Name or Icy-Genre present

Rémi Denis-Courmont git at videolan.org
Tue Mar 1 06:57:42 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar  1 07:37:30 2016 +0200| [3425a6c2f6b38c6fbfca9c936410dfd5c2215ede] | committer: Rémi Denis-Courmont

http: redirect to icyx:// if Icy-Name or Icy-Genre present

If an ICY server returns an HTTP response (instead of an non-HTTP ICY
response), rewrite the URL to use icyx:// explicitly.

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

 modules/access/http/resource.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index 7047d2b..34f0cc9 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -217,6 +217,12 @@ char *vlc_http_res_get_redirect(const struct vlc_http_resource *restrict res,
         if (vlc_http_msg_get_token(resp, "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(resp, "Icy-Name") != NULL
+          || vlc_http_msg_get_header(resp, "Icy-Genre") != NULL)
+         && asprintf(&url, "icyx://%s%s", res->authority, res->path) >= 0)
+            return url;
     }
 
     /* TODO: if (status == 426 Upgrade Required) */



More information about the vlc-commits mailing list