[vlc-commits] http: fix MMSH redirection
Rémi Denis-Courmont
git at videolan.org
Tue Mar 1 06:57:41 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 1 07:39:12 2016 +0200| [39fa337b46d1a9647afbca258fdd97dd40fe4478] | committer: Rémi Denis-Courmont
http: fix MMSH redirection
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39fa337b46d1a9647afbca258fdd97dd40fe4478
---
modules/access/http/resource.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index fe95d10..7047d2b 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -209,6 +209,16 @@ char *vlc_http_res_get_redirect(const struct vlc_http_resource *restrict res,
{
int status = vlc_http_msg_get_status(resp);
+ if ((status / 100) == 2 && !res->secure)
+ {
+ char *url;
+
+ /* HACK: Seems like an MMS server. Redirect to MMSH scheme. */
+ if (vlc_http_msg_get_token(resp, "Pragma", "features") != NULL
+ && asprintf(&url, "mmsh://%s%s", res->authority, res->path) >= 0)
+ return url;
+ }
+
/* TODO: if (status == 426 Upgrade Required) */
/* Location header is only meaningful for 201 and 3xx */
@@ -219,15 +229,6 @@ char *vlc_http_res_get_redirect(const struct vlc_http_resource *restrict res,
|| status == 306 /* Switch Proxy (former) */)
return NULL;
- if (!res->secure
- && vlc_http_msg_get_token(resp, "Pragma", "features") != NULL)
- { /* HACK: Seems like an MMS server. Redirect to MMSH scheme. */
- char *url;
-
- if (asprintf(&url, "mmsh://%s%s", res->authority, res->path) >= 0)
- return url;
- }
-
const char *location = vlc_http_msg_get_header(resp, "Location");
if (location == NULL)
return NULL;
More information about the vlc-commits
mailing list