[PATCH] http: Fix HLS playback on some servers
John Cox <[email protected]> Mon, 8 Jan 2024 18:42:00 +0000
| Newsgroups | gmane.comp.video.videolan.vlc.devel |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/RPi-Distro/vlc/issues/101 The issue is that the server doesn't like the port number on the end of the Host line. This is a server fault, but it is legitimate to omit the port number if it is the default so remove it if that is the case. Signed-off-by: John Cox <[email protected]> --- This patch is against 3.0.20, I haven't tested 4.x modules/access/http/message.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/access/http/message.c b/modules/access/http/message.c index 6e10f4206e..336d50dc30 100644 --- a/modules/access/http/message.c +++ b/modules/access/http/message.c @@ -306,11 +306,17 @@ char *vlc_http_msg_format(const struct vlc_http_msg *m, size_t *restrict lenp, if (m->status < 0) { + int hlen = (int)strlen(m->authority); + if (hlen > 4 && strcmp(m->scheme, "https") == 0 && strcmp(m->authority + hlen - 4, ":443") == 0) + hlen -= 4; + else if (hlen > 3 && strcmp(m->scheme, "http") == 0 && strcmp(m->authority + hlen - 3, ":80") == 0) + hlen -= 3; + vlc_memstream_printf(&stream, "%s ", m->method); if (proxied) vlc_memstream_printf(&stream, "%s://%s", m->scheme, m->authority); - vlc_memstream_printf(&stream, "%s HTTP/1.1\r\nHost: %s\r\n", - m->path ? m->path : m->authority, m->authority); + vlc_memstream_printf(&stream, "%s HTTP/1.1\r\nHost: %.*s\r\n", + m->path ? m->path : m->authority, hlen, m->authority); } else vlc_memstream_printf(&stream, "HTTP/1.1 %03hd .\r\n", m->status); -- 2.40.1 _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: https://mailman.videolan.org/listinfo/vlc-devel