[vlc-commits] commit: Restore LibVLC/VERSION at the end of the HTTP user agent ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Fri Sep 17 04:26:18 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 17 05:25:13 2010 +0300| [dadb0622e6244456f7b5576ab2f9aa0c6582c683] | committer: Rémi Denis-Courmont 

Restore LibVLC/VERSION at the end of the HTTP user agent

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

 bin/vlc.c             |    2 +-
 modules/access/http.c |    2 +-
 src/control/core.c    |    9 +++++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bin/vlc.c b/bin/vlc.c
index 7a84ab7..085aa3a 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -203,7 +203,7 @@ int main( int i_argc, const char *ppsz_argv[] )
     if (vlc == NULL)
         goto out;
 
-    libvlc_set_user_agent (vlc, "VLC media player", NULL);
+    libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);
 
 #if !defined (HAVE_MAEMO) && !defined __APPLE__
     libvlc_add_intf (vlc, "globalhotkeys,none");
diff --git a/modules/access/http.c b/modules/access/http.c
index 398c38b..8485044 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -123,7 +123,7 @@ vlc_module_begin ()
     add_integer( "http-caching", 4 * DEFAULT_PTS_DELAY / 1000, NULL,
                  CACHING_TEXT, CACHING_LONGTEXT, true )
         change_safe()
-    add_string( "http-user-agent", PACKAGE_NAME"/"PACKAGE_VERSION, NULL,
+    add_string( "http-user-agent", NULL, NULL,
                 AGENT_TEXT, AGENT_LONGTEXT, true )
         change_safe()
         change_need_restart()
diff --git a/src/control/core.c b/src/control/core.c
index 942212d..1411e9c 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -133,10 +133,15 @@ void libvlc_set_user_agent (libvlc_instance_t *p_i,
                             const char *name, const char *http)
 {
     libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
+    char *str;
 
     var_SetString (p_libvlc, "user-agent", name);
-    if (http != NULL)
-        var_SetString (p_libvlc, "http-user-agent", http);
+    if ((http != NULL)
+     && (asprintf (&str, "%s LibVLC/"PACKAGE_VERSION, http) != -1))
+    {
+        var_SetString (p_libvlc, "http-user-agent", str);
+        free (str);
+    }
 }
 
 const char * libvlc_get_version(void)



More information about the vlc-commits mailing list