[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. dee7acf1d89b97592479
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. dee7acf1d89b97592479159ccb9a3473c61c1b0f |
Date: |
Mon, 04 Oct 2010 15:44:07 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via dee7acf1d89b97592479159ccb9a3473c61c1b0f (commit)
from 4505e32152dfb557b8bb2ec68464e525f8ba9d09 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=dee7acf1d89b97592479159ccb9a3473c61c1b0f
commit dee7acf1d89b97592479159ccb9a3473c61c1b0f
Author: Sandro Santilli <address@hidden>
Date: Mon Oct 4 17:43:46 2010 +0200
Move cookie setup code in its own function (ready to be cloned for proxy)
diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index 56e66d8..b73ee3b 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -954,6 +954,48 @@ create_standalone_launcher(const std::string& page_url,
const std::string& swf_u
#endif
}
+void
+nsPluginInstance::setupCookies(const std::string& 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) return;
+
+ // 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);
+ }
+ NPN_MemFree(cookie);
+ } else {
+ gnash::log_debug("No stored Cookie for %s", url);
+ }
+}
+
std::vector<std::string>
nsPluginInstance::getCmdLine(int hostfd, int controlfd)
{
@@ -977,43 +1019,7 @@ nsPluginInstance::getCmdLine(int hostfd, int controlfd)
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);
- }
- NPN_MemFree(cookie);
- } else {
- gnash::log_debug("No stored Cookie for %s", url);
- }
- }
+ setupCookies(pageurl);
std::stringstream pars;
pars << "-x " << _window // X window ID to render into
diff --git a/plugin/npapi/plugin.h b/plugin/npapi/plugin.h
index 64092ad..4026be1 100644
--- a/plugin/npapi/plugin.h
+++ b/plugin/npapi/plugin.h
@@ -91,6 +91,9 @@ public:
private:
void startProc();
std::vector<std::string> getCmdLine(int hostfd, int controlfd);
+
+ void setupCookies(const std::string& pageURL);
+
static bool handlePlayerRequestsWrapper(GIOChannel* iochan, GIOCondition
cond, nsPluginInstance* plugin);
bool handlePlayerRequests(GIOChannel* iochan, GIOCondition cond);
-----------------------------------------------------------------------
Summary of changes:
plugin/npapi/plugin.cpp | 80 +++++++++++++++++++++++++---------------------
plugin/npapi/plugin.h | 3 ++
2 files changed, 46 insertions(+), 37 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. dee7acf1d89b97592479159ccb9a3473c61c1b0f,
Sandro Santilli <=