[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12199: write the cookie file and us
From: |
Rob Savoye |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12199: write the cookie file and use NPAPI to read the cookie if it's a recent enough version. |
Date: |
Thu, 27 May 2010 13:11:10 -0600 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12199 [merge]
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Thu 2010-05-27 13:11:10 -0600
message:
write the cookie file and use NPAPI to read the cookie if it's a recent
enough version.
modified:
plugin/npapi/mozilla-sdk/np_entry.cpp
plugin/npapi/mozilla-sdk/npn_gate.cpp
plugin/npapi/plugin.cpp
=== modified file 'plugin/npapi/mozilla-sdk/np_entry.cpp'
--- a/plugin/npapi/mozilla-sdk/np_entry.cpp 2010-03-24 23:33:22 +0000
+++ b/plugin/npapi/mozilla-sdk/np_entry.cpp 2010-05-27 19:11:10 +0000
@@ -152,6 +152,8 @@
if (++i <= n) NPNFuncs.enumerate = aNPNFuncs->enumerate;
if (++i <= n) NPNFuncs.pluginthreadasynccall =
aNPNFuncs->pluginthreadasynccall;
if (++i <= n) NPNFuncs.construct = aNPNFuncs->construct;
+ if (++i <= n) NPNFuncs.getvalueforurl = aNPNFuncs->getvalueforurl;
+ if (++i <= n) NPNFuncs.setvalueforurl = aNPNFuncs->setvalueforurl;
return NPERR_NO_ERROR;
}
=== modified file 'plugin/npapi/mozilla-sdk/npn_gate.cpp'
--- a/plugin/npapi/mozilla-sdk/npn_gate.cpp 2010-03-24 23:33:22 +0000
+++ b/plugin/npapi/mozilla-sdk/npn_gate.cpp 2010-05-27 19:11:10 +0000
@@ -318,3 +318,33 @@
{
NPNFuncs.setexception(obj, message);
}
+
+NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
+ const char *url, char **value, uint32_t *len)
+{
+ return NPNFuncs.getvalueforurl(instance, variable, url, value, len);
+}
+
+NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
+ const char *url, const char *value, uint32_t len)
+{
+ return NPNFuncs.setvalueforurl(instance, variable, url, value, len);
+}
+
+NPError NPN_GetAuthenticationInfo(NPP instance, const char *protocol,
+ const char *host, int32_t port,
+ const char *scheme, const char *realm,
+ char **username, uint32_t *ulen,
+ char **password, uint32_t *plen)
+{
+ return NPNFuncs.getauthenticationinfo(instance, protocol, host, port,
+ scheme, realm, username, ulen,
+ password, plen);
+}
+
+void NPN_PluginThreadAsyncCall(NPP plugin, void (*func)(void *), void
*userData)
+{
+ NPNFuncs.pluginthreadasynccall(plugin, func, userData);
+}
+
+
=== modified file 'plugin/npapi/plugin.cpp'
--- a/plugin/npapi/plugin.cpp 2010-05-20 21:57:50 +0000
+++ b/plugin/npapi/plugin.cpp 2010-05-27 19:11:10 +0000
@@ -159,7 +159,6 @@
// First, check for XEmbed support. The NPAPI Gnash plugin
// only works with XEmbed, so tell the plugin API to fail if
// XEmbed is not found.
-
err = NPN_GetValue(NULL,NPNVSupportsXEmbedBool,
(void *)&supportsXEmbed);
@@ -282,6 +281,15 @@
case NPPVpluginDescriptionString:
*static_cast<const char **>(aValue) = getPluginDescription();
break;
+
+ case NPPVpluginWindowBool:
+ break;
+
+ case NPPVpluginTimerInterval:
+ break;
+
+ case NPPVpluginKeepLibraryInMemory:
+ break;
case NPPVpluginNeedsXEmbed:
#ifdef HAVE_GTK2
@@ -291,9 +299,13 @@
#endif
break;
- case NPPVpluginTimerInterval:
-
- case NPPVpluginKeepLibraryInMemory:
+ case NPPVpluginScriptableNPObject:
+ break;
+
+ case NPPVpluginUrlRequestsDisplayedBool:
+ break;
+ case NPPVpluginWantsAllNetworkStreams:
+ break;
default:
err = NPERR_INVALID_PARAM;
@@ -348,8 +360,6 @@
_filefd(-1),
_name()
{
- // gnash::log_debug(__PRETTY_FUNCTION__);
-
for (size_t i=0, n=data->argc; i<n; ++i) {
std::string name, val;
gnash::StringNoCaseEqual noCaseCompare;
@@ -561,7 +571,7 @@
} else {
gnash::log_debug("_scriptObject is not assigned");
}
- }
+ }
return NS_PluginGetValue(aVariable, aValue);
}
@@ -572,14 +582,6 @@
{
gnash::log_debug("Here I am!!!\n");
}
-
-void
-NPN_PluginThreadAsyncCall(NPP plugin, void (*func)(void *), void *userData)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) >= 20)
- return (*NPNFuncs.pluginthreadasynccall)(plugin, func, userData);
-#endif
-}
#endif
/// \brief Open a new data stream
@@ -610,8 +612,6 @@
// gnash::log_debug("FIXME: %s", getEmbedURL());
#endif
- gnash::log_debug("The full URL is %s", _swf_url);
-
if (!_swf_url.empty() && _window) {
startProc();
}
@@ -923,6 +923,44 @@
arg_vec.push_back(pageurl);
}
+ // In pre xulrunner 1.9, (Firefox 3.1) this function does not exist,
+ // so we can't use it to read the cookie file. For older browsers
+ // like IceWeasel on Debian lenny, which pre dates the cookie support
+ // in NPAPI, you have to block all Cookie for sites like YouTube to
+ // allow Gnash to work.
+ if (NPNFuncs.getvalueforurl) {
+ // Cookie appear to drop anything past the domain, so we strip
+ // that off.
+ std::string::size_type pos;
+ pos = pageurl.find("/", pageurl.find("//", 0) + 2) + 1;
+ std::string url = pageurl.substr(0, pos);
+
+ char *cookie = 0;
+ uint32_t length = 0;
+ NPN_GetValueForURL(_instance, NPNURLVCookie, url.c_str(),
+ &cookie, &length);
+ std::string ncookie (cookie, length);
+ if (cookie) {
+ gnash::log_debug("The Cookie for %s is %s", url, ncookie);
+ std::ofstream cookiefile;
+ std::stringstream ss;
+ ss << "/tmp/gnash-cookies." << getpid();
+
+ cookiefile.open(ss.str().c_str(), std::ios::out | std::ios::trunc);
+ cookiefile << "Set-Cookie: " << ncookie << std::endl;
+ cookiefile.close();
+
+ if (setenv("GNASH_COOKIES_IN", ss.str().c_str(), 1) < 0) {
+ gnash::log_error(
+ "Couldn't set environment variable GNASH_COOKIES_IN to %s",
+ ncookie);
+ }
+ } else {
+ gnash::log_debug("No stored Cookie for %s", url);
+ }
+ NPN_MemFree(cookie);
+ }
+
std::stringstream pars;
pars << "-x " << _window // X window ID to render into
<< " -j " << _width // Width of window
@@ -1002,6 +1040,7 @@
void
nsPluginInstance::startProc()
{
+
int p2c_pipe[2];
int c2p_pipe[2];
int p2c_controlpipe[2];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12199: write the cookie file and use NPAPI to read the cookie if it's a recent enough version.,
Rob Savoye <=