gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. 92858af20004baa52b33


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 92858af20004baa52b3345f2984acbbfa9fa658a
Date: Mon, 04 Oct 2010 20:54:15 +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  92858af20004baa52b3345f2984acbbfa9fa658a (commit)
       via  29762b933a568853f2c81f4452fbb822e8481ac0 (commit)
      from  6a856294c84ad37dea6cff9e3da5bc55a6be7752 (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=92858af20004baa52b3345f2984acbbfa9fa658a


commit 92858af20004baa52b3345f2984acbbfa9fa658a
Merge: 29762b9 6a85629
Author: Sandro Santilli <address@hidden>
Date:   Mon Oct 4 22:53:56 2010 +0200

    Merge branch 'master' of ssh://address@hidden/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=29762b933a568853f2c81f4452fbb822e8481ac0


commit 29762b933a568853f2c81f4452fbb822e8481ac0
Author: Sandro Santilli <address@hidden>
Date:   Mon Oct 4 22:53:16 2010 +0200

    Read proxy from NPAPI, when possible, and use that information to setup 
http_proxy (will be used by libcurl)

diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index a3dac9b..bad11b9 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -75,6 +75,8 @@
 
 #include <boost/tokenizer.hpp>
 #include <boost/algorithm/string/join.hpp>
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/classification.hpp>
 #include <boost/format.hpp>
 #include <sys/param.h>
 #include <csignal>
@@ -996,6 +998,46 @@ nsPluginInstance::setupCookies(const std::string& pageurl)
     }    
 }
 
+void
+nsPluginInstance::setupProxy(const std::string& url)
+{
+    // In pre xulrunner 1.9, (Firefox 3.1) this function does not exist,
+    // so we can't use it to read the proxy information.
+    if (!NPNFuncs.getvalueforurl) return;
+
+    char *proxy = 0;
+    uint32_t length = 0;
+    NPN_GetValueForURL(_instance, NPNURLVProxy, url.c_str(),
+                       &proxy, &length);
+    if (!proxy) {
+        gnash::log_debug("No proxy setting for %s", url);
+        return;
+    }
+
+    std::string nproxy (proxy, length);
+    NPN_MemFree(proxy);
+
+    gnash::log_debug("Proxy setting for %s is %s", url, nproxy);
+
+    std::vector<std::string> parts;
+    boost::split(parts, nproxy,
+        boost::is_any_of(" "), boost::token_compress_on);
+    if ( parts[0] == "DIRECT" ) {
+        // no proxy
+    }
+    else if ( parts[0] == "PROXY" ) {
+        if (setenv("http_proxy", parts[1].c_str(), 1) < 0) {
+            gnash::log_error(
+                "Couldn't set environment variable http_proxy to %s",
+                nproxy);
+        }
+    }
+    else {
+        gnash::log_error("Unknown proxy type: %s", nproxy);
+    }
+
+}
+
 std::vector<std::string>
 nsPluginInstance::getCmdLine(int hostfd, int controlfd)
 {
@@ -1020,6 +1062,7 @@ nsPluginInstance::getCmdLine(int hostfd, int controlfd)
     }
 
     setupCookies(pageurl);
+    setupProxy(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 4026be1..007df68 100644
--- a/plugin/npapi/plugin.h
+++ b/plugin/npapi/plugin.h
@@ -93,6 +93,7 @@ private:
     std::vector<std::string> getCmdLine(int hostfd, int controlfd);
 
     void setupCookies(const std::string& pageURL);
+    void setupProxy(const std::string& pageURL);
 
     static bool handlePlayerRequestsWrapper(GIOChannel* iochan, GIOCondition 
cond, nsPluginInstance* plugin);
 

-----------------------------------------------------------------------

Summary of changes:
 plugin/npapi/plugin.cpp |   43 +++++++++++++++++++++++++++++++++++++++++++
 plugin/npapi/plugin.h   |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]