Commit 15eb1dff authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

http: correctly strip URI scheme upon redirection (fixes #6872)

Quoting the reporter:
| According to include/vlc_access.h, access_t.psz_location is "URL with
| the scheme stripped". But in http module, schema stays there after
| 302 redirection. That may cause httplive module try to access URL like
| "http://http://host/path".
Pointed-out-by: default avatarbbcallen <bbcallen@gmail.com>
parent 1e42dcf3
...@@ -574,20 +574,19 @@ connect: ...@@ -574,20 +574,19 @@ connect:
goto error; goto error;
} }
/* Do not accept redirection outside of HTTP works */
const char *psz_protocol; const char *psz_protocol;
if( !strncmp( p_sys->psz_location, "http:", 5 ) ) if( !strncmp( p_sys->psz_location, "http://", 7 ) )
psz_protocol = "http"; psz_protocol = "http";
else if( !strncmp( p_sys->psz_location, "https:", 6 ) ) else if( !strncmp( p_sys->psz_location, "https://", 8 ) )
psz_protocol = "https"; psz_protocol = "https";
else else
{ { /* Do not accept redirection outside of HTTP */
msg_Err( p_access, "insecure redirection ignored" ); msg_Err( p_access, "unsupported redirection ignored" );
goto error; goto error;
} }
free( p_access->psz_location ); free( p_access->psz_location );
p_access->psz_location = strdup( p_sys->psz_location ); p_access->psz_location = strdup( p_sys->psz_location
+ strlen( psz_protocol ) + 3 );
/* Clean up current Open() run */ /* Clean up current Open() run */
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
http_auth_Reset( &p_sys->auth ); http_auth_Reset( &p_sys->auth );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment