From: RĂ©mi Denis-Courmont Date: Fri, 17 Sep 2010 02:25:13 +0000 (+0300) Subject: Restore LibVLC/VERSION at the end of the HTTP user agent X-Git-Tag: 1.2.0-pre1~5258 X-Git-Url: https://git.sesse.net/?p=vlc;a=commitdiff_plain;h=dadb0622e6244456f7b5576ab2f9aa0c6582c683 Restore LibVLC/VERSION at the end of the HTTP user agent --- diff --git a/bin/vlc.c b/bin/vlc.c index 7a84ab7944..085aa3afda 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 398c38b0d7..8485044568 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 942212db77..1411e9c082 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)