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

John Cox jc at kynesim.co.uk
Fri Feb 2 12:58:43 UTC 2024


>Le keskiviikkona 10. tammikuuta 2024, 19.48.31 EET Rémi Denis-Courmont a écrit 
>:
>> 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/s
>> > c-> 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.
>
>Or not. Does not apply.

Sorry - the issue was fixed on master (which I stupidly failed to check
before posting) - my patch was against 3.0.20 which is what I was
debugging.  Any chance you could apply my patch to the 3.x branch
please?

Regards

JC


More information about the vlc-devel mailing list