[PATCH] access/http: log redirect destination and handle 308

Namit Chugh <[email protected]> Sun, 12 Apr 2026 02:22:31 +0530
Newsgroups gmane.comp.video.videolan.vlc.devel
Message-ID <CAK7qhSRB7GVS8th1SH88CxTim8ny4yuxHqq1Vahks0gjAkgdTQ@mail.gmail.com>
--===============2647413506404979329==
Content-Type: multipart/alternative; boundary="00000000000050093c064f356e3b"

--00000000000050093c064f356e3b
Content-Type: text/plain; charset="UTF-8"

modules/access/http.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index XXXXXXX..XXXXXXX 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -322,8 +322,11 @@ connect:
-    if( ( p_sys->i_code == 301 || p_sys->i_code == 302 ||
-          p_sys->i_code == 303 || p_sys->i_code == 307 ) &&
+    if( ( p_sys->i_code == 301 || p_sys->i_code == 302 ||
+          p_sys->i_code == 303 || p_sys->i_code == 307 ||
+          p_sys->i_code == 308 ) &&
         p_sys->psz_location != NULL )
     {
+        msg_Dbg( p_access, "redirecting to %s (HTTP %d)",
+                 p_sys->psz_location, p_sys->i_code );
         p_access->psz_url = p_sys->psz_location;
         p_sys->psz_location = NULL;
         ret = VLC_ACCESS_REDIRECT;

2.
access/http: log redirect destination and handle HTTP 308

Previously, the HTTP access module would return VLC_ACCESS_REDIRECT
with no log messages for redirects (301, 302, 303, 307). If a
developer tried to debug a faulty redirection chain, they had to rely
on trial-and-error because they had no way to know where VLC was
being redirected.

A msg_Dbg statement is added to provide a clue about the redirect
destination and the associated HTTP status code.

Also, there is no HTTP 308 check here; it has the same semantics as
301 but preserves the request method. It is covered by RFC 7538 and

--00000000000050093c064f356e3b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">modules/access/http.c | 4 +++-<br>=C2=A01 file changed, 3 =
insertions(+), 1 deletion(-)<br><br>diff --git a/modules/access/http.c b/mo=
dules/access/http.c<br>index XXXXXXX..XXXXXXX 100644<br>--- a/modules/acces=
s/http.c<br>+++ b/modules/access/http.c<br>@@ -322,8 +322,11 @@ connect:<br=
>- =C2=A0 =C2=A0if( ( p_sys-&gt;i_code =3D=3D 301 || p_sys-&gt;i_code =3D=
=3D 302 ||<br>- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0p_sys-&gt;i_code =3D=3D 3=
03 || p_sys-&gt;i_code =3D=3D 307 ) &amp;&amp;<br>+ =C2=A0 =C2=A0if( ( p_sy=
s-&gt;i_code =3D=3D 301 || p_sys-&gt;i_code =3D=3D 302 ||<br>+ =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0p_sys-&gt;i_code =3D=3D 303 || p_sys-&gt;i_code =3D=
=3D 307 ||<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0p_sys-&gt;i_code =3D=3D 3=
08 ) &amp;&amp;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0p_sys-&gt;psz_location=
 !=3D NULL )<br>=C2=A0 =C2=A0 =C2=A0{<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0msg_D=
bg( p_access, &quot;redirecting to %s (HTTP %d)&quot;,<br>+ =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 p_sys-&gt;psz_location, p_sys-&gt=
;i_code );<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0p_access-&gt;psz_url =3D p_=
sys-&gt;psz_location;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0p_sys-&gt;psz_lo=
cation =3D NULL;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D VLC_ACCESS_RE=
DIRECT;<div><br>2.<br>access/http: log redirect destination and handle HTTP=
 308<br><br>Previously, the HTTP access module would return VLC_ACCESS_REDI=
RECT<br>with no log messages for redirects (301, 302, 303, 307). If a<br>de=
veloper tried to debug a faulty redirection chain, they had to rely<br>on t=
rial-and-error because they had no way to know where VLC was<br>being redir=
ected.<br><br>A msg_Dbg statement is added to provide a clue about the redi=
rect<br>destination and the associated HTTP status code.<br><br>Also, there=
 is no HTTP 308 check here; it has the same semantics as<br>301 but preserv=
es the request method. It is covered by RFC 7538 and</div></div>

--00000000000050093c064f356e3b--

--===============2647413506404979329==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc-devel

--===============2647413506404979329==--