[vlc-commits] lib: fix wrong user-agent and http-user-agent values at start

Rémi Denis-Courmont git at videolan.org
Sun Jun 16 10:35:00 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 16 11:29:22 2013 +0300| [9cca21d492ea19bb5a9b3b5ff2ee091b22d5e494] | committer: Rémi Denis-Courmont

lib: fix wrong user-agent and http-user-agent values at start

VLC main() initializes the values too late for interfaces and playlist.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9cca21d492ea19bb5a9b3b5ff2ee091b22d5e494
---

 lib/core.c   |    2 --
 src/libvlc.c |   10 +++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/core.c b/lib/core.c
index 411bdc5..6539f11 100644
--- a/lib/core.c
+++ b/lib/core.c
@@ -69,8 +69,6 @@ libvlc_instance_t * libvlc_new( int argc, const char *const *argv )
     p_new->ref_count = 1;
     p_new->p_callback_list = NULL;
     vlc_mutex_init(&p_new->instance_lock);
-    var_Create( p_libvlc_int, "http-user-agent",
-                VLC_VAR_STRING|VLC_VAR_DOINHERIT );
     return p_new;
 
 error:
diff --git a/src/libvlc.c b/src/libvlc.c
index 88f1562..06c69a7 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -385,8 +385,16 @@ dbus_out:
 
     /* some default internal settings */
     var_Create( p_libvlc, "window", VLC_VAR_STRING );
+    /* NOTE: Because the playlist and interfaces start before this function
+     * returns control to the application (DESIGN BUG!), all these variables
+     * must be created (in place of libvlc_new()) and set to VLC defaults
+     * (in place of VLC main()) *here*. */
     var_Create( p_libvlc, "user-agent", VLC_VAR_STRING );
-    var_SetString( p_libvlc, "user-agent", "(LibVLC "VERSION")" );
+    var_SetString( p_libvlc, "user-agent",
+                   "VLC media player (LibVLC "VERSION")" );
+    var_Create( p_libvlc, "http-user-agent", VLC_VAR_STRING );
+    var_SetString( p_libvlc, "http-user-agent",
+                   "VLC/"PACKAGE_VERSION" LibVLC/"PACKAGE_VERSION );
 
     /* System specific configuration */
     system_Configure( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind );



More information about the vlc-commits mailing list