[totem] Bug 375867 - check user-agents



commit c3a784b72a70b9fae5ef9279faa15ea4dc49933c
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 2 13:17:07 2009 +0100

    Bug 375867 - check user-agents
    
    Override the HTTP user-agents for Quicktime and Windows Media Player,
    fixes playback of the Apple trailers.

 browser-plugin/totem-plugin-viewer.c |    4 +---
 browser-plugin/totemPlugin.cpp       |   21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index fd6f722..6a87635 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -2216,10 +2216,8 @@ int main (int argc, char **argv)
 
 	/* FIXME: check the UA strings of the legacy plugins themselves */
 	/* FIXME: at least hxplayer seems to send different UAs depending on the protocol!? */
-	/* FIXME: this won't work with gvfs:
-	 * http://bugzilla.gnome.org/show_bug.cgi?id=534482 */
 	if (arg_user_agent != NULL) {
-		g_setenv ("GNOME_VFS_HTTP_USER_AGENT", arg_user_agent, TRUE);
+		g_setenv ("BACON_VIDEO_WIDGET_HTTP_USER_AGENT", arg_user_agent, TRUE);
 		g_free (arg_user_agent);
 		arg_user_agent = NULL;
 	}
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index 6038f98..7745e75 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -158,6 +158,15 @@ static const char kPluginLongDescription[] =
   "The <a href=\"http://www.gnome.org/projects/totem/\";>Totem</a> " PACKAGE_VERSION " plugin handles video and audio streams.";
 #endif
 
+static const char kPluginUserAgent[] =
+#if defined(TOTEM_NARROWSPACE_PLUGIN)
+  "Quicktime/"TOTEM_NARROWSPACE_VERSION;
+#elif defined(TOTEM_GMP_PLUGIN)
+  "Windows-Media-Player/10.00.00.4019";
+#else
+  "";
+#endif
+
 #if defined(TOTEM_COMPLEX_PLUGIN) && defined(HAVE_NSTARRAY_H)
 nsTArray<totemPlugin*> *totemPlugin::sPlugins;
 
@@ -465,10 +474,14 @@ totemPlugin::ViewerFork ()
 		return NPERR_NO_ERROR;
 #endif /* TOTEM_COMPLEX_PLUGIN */
 
-	const char *userAgent = NPN_UserAgent (mNPP);
-	if (!userAgent) {
-		/* See https://bugzilla.mozilla.org/show_bug.cgi?id=328778 */
-		Dm ("User agent has more than 127 characters; fix your browser!");
+	const char *userAgent = kPluginUserAgent;
+
+	if (*kPluginUserAgent == '\0') {
+		userAgent = NPN_UserAgent (mNPP);
+		if (!userAgent) {
+			/* See https://bugzilla.mozilla.org/show_bug.cgi?id=328778 */
+			Dm ("User agent has more than 127 characters; fix your browser!");
+		}
 	}
 
         GPtrArray *arr = g_ptr_array_new ();



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