[vlc-devel] [PATCH] adaptive/http: Fix port insertion into URL if on default port

Rémi Denis-Courmont remi at remlab.net
Wed Jan 10 17:48:31 UTC 2024


Le keskiviikkona 10. tammikuuta 2024, 11.15.43 EET John Cox a écrit :
> Fix the URL generation code to avoid adding an explicit port if the
> port is the default for the scheme. This is fairly clearly what the
> code was originally intended to do.
> 
> This fixes the playback of some HLS streams where including the
> port number in the Host: field causes the segment fetch to fail
> with 404.
> 
> Signed-off-by: John Cox <jc at kynesim.co.uk>
> ---
> This looks like a typo in the original code which is obviously
> wrong (will only avoid adding the port with https on port 80 or
> http on port 443 which is the wrong way round)
> 
> Example of a previously failing stream:
> https://nrk-od2.telenorcdn.net/open/ps/dnpr/dnpr63701115/d0bc193d-1.smil/sc-> gaFEAQ/v4_index.m3u8
> 
>  modules/demux/adaptive/http/ConnectionParams.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/demux/adaptive/http/ConnectionParams.cpp
> b/modules/demux/adaptive/http/ConnectionParams.cpp index
> 6e3f221b66..a60239d16d 100644
> --- a/modules/demux/adaptive/http/ConnectionParams.cpp
> +++ b/modules/demux/adaptive/http/ConnectionParams.cpp
> @@ -70,8 +70,8 @@ void ConnectionParams::setPath(const std::string &path_)
>      if(!hostname.empty())
>      {
>          os << hostname;
> -        if( (port != 80 && scheme != "http") ||
> -            (port != 443 && scheme != "https") )
> +        if( (port != 80 && scheme == "http") ||
> +            (port != 443 && scheme == "https") )
>              os << ":" << port;
>      }
>      os << path;

LGTM, will push soon if no objections.

-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the vlc-devel mailing list