[vlc-commits] [Git][videolan/vlc][master] http (old): remove custom User-Agent and Referrer
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Tue Nov 10 14:04:39 UTC 2026
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
7712870d by Rémi Denis-Courmont at 2026-11-10T15:47:38+02:00
http (old): remove custom User-Agent and Referrer
You can do that with the normal HTTP access, which actually "owns" the
configuration items.
Fixes #30312.
- - - - -
1 changed file:
- modules/access/http.c
Changes:
=====================================
modules/access/http.c
=====================================
@@ -86,8 +86,6 @@ typedef struct
/* From uri */
vlc_url_t url;
- char *psz_user_agent;
- char *psz_referrer;
char *psz_username;
char *psz_password;
vlc_http_auth_t auth;
@@ -152,8 +150,6 @@ static int Open( vlc_object_t *p_this )
p_sys->psz_mime = NULL;
p_sys->b_icecast = false;
p_sys->psz_location = NULL;
- p_sys->psz_user_agent = NULL;
- p_sys->psz_referrer = NULL;
p_sys->psz_username = NULL;
p_sys->psz_password = NULL;
p_sys->i_icy_meta = 0;
@@ -177,46 +173,6 @@ static int Open( vlc_object_t *p_this )
vlc_credential_init( &credential, &p_sys->url );
- /* Determine the HTTP user agent */
- /* See RFC2616 §2.2 token and comment definition, and §3.8 and
- * §14.43 user-agent header */
- p_sys->psz_user_agent = var_InheritString( p_access, "http-user-agent" );
- if (p_sys->psz_user_agent)
- {
- unsigned comment_level = 0;
- for( char *p = p_sys->psz_user_agent; *p; p++ )
- {
- uint8_t c = *p;
- if (comment_level == 0)
- {
- if( c < 32 || strchr( ")<>@,;:\\\"[]?={}", c ) )
- *p = '_'; /* remove potentially harmful characters */
- }
- else
- {
- if (c == ')')
- comment_level--;
- else if( c < 32 && strchr( "\t\r\n", c ) == NULL)
- *p = '_'; /* remove potentially harmful characters */
- }
- if (c == '(')
- {
- if (comment_level == UINT_MAX)
- break;
- comment_level++;
- }
- }
- /* truncate evil unclosed comments */
- if (comment_level > 0)
- {
- char *p = strchr(p_sys->psz_user_agent, '(');
- *p = '\0';
- }
- }
-
- /* HTTP referrer */
- p_sys->psz_referrer = var_InheritString( p_access, "http-referrer" );
-
/* Check proxy */
msg_Dbg(p_access, "querying proxy for %s", psz_url);
psz = vlc_getProxyUrl(psz_url);
@@ -352,8 +308,6 @@ error:
free( p_sys->psz_proxy_passbuf );
free( p_sys->psz_mime );
free( p_sys->psz_location );
- free( p_sys->psz_user_agent );
- free( p_sys->psz_referrer );
free( p_sys->psz_username );
free( p_sys->psz_password );
@@ -379,8 +333,6 @@ static void Close( vlc_object_t *p_this )
free( p_sys->psz_icy_genre );
free( p_sys->psz_icy_title );
- free( p_sys->psz_user_agent );
- free( p_sys->psz_referrer );
free( p_sys->psz_username );
free( p_sys->psz_password );
@@ -662,11 +614,7 @@ static int Connect( stream_t *p_access )
/* User Agent */
vlc_memstream_printf( &stream, "User-Agent: %s\r\n",
- p_sys->psz_user_agent );
- /* Referrer */
- if (p_sys->psz_referrer)
- vlc_memstream_printf( &stream, "Referer: %s\r\n",
- p_sys->psz_referrer );
+ "VLC/"PACKAGE_VERSION" LibVLC/"PACKAGE_VERSION );
/* Authentication */
if( p_sys->url.psz_username != NULL && p_sys->url.psz_password != NULL )
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7712870d59426e2841f0c3518e15687c6e8ba0c6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7712870d59426e2841f0c3518e15687c6e8ba0c6
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list