[totem] backend: Never use an empty User-Agent



commit 37ddeb0c2f6c63c2fd157df20b83298134124230
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 17 01:12:01 2011 +0000

    backend: Never use an empty User-Agent
    
    Or some web services will kick us out without asking.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644949

 src/backend/bacon-video-widget-gst-0.10.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index e255597..bea7283 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -85,6 +85,8 @@
 #include "gstscreenshot.h"
 #include "bacon-resize.h"
 
+#define DEFAULT_USER_AGENT "Totem/"VERSION
+
 #define FORWARD_RATE 1.0
 #define REVERSE_RATE -1.0
 #define SMALL_STREAM_WIDTH 200
@@ -2397,12 +2399,14 @@ static void
 bvw_set_user_agent_on_element (BaconVideoWidget * bvw, GstElement * element)
 {
   BaconVideoWidgetPrivate *priv = bvw->priv;
+  const char *user_agent;
 
   if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), "user-agent") == NULL)
     return;
 
-  GST_DEBUG ("Setting HTTP user-agent to '%s'", priv->user_agent ? priv->user_agent : "(default)");
-  g_object_set (element, "user-agent", priv->user_agent, NULL);
+  user_agent = priv->user_agent ? priv->user_agent : DEFAULT_USER_AGENT;
+  GST_DEBUG ("Setting HTTP user-agent to '%s'", user_agent);
+  g_object_set (element, "user-agent", user_agent, NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]