[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
kevino at webkit.org
kevino at webkit.org
Thu Oct 29 20:47:07 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 492a774de3bd91d3a79caedc98e6969643fa5a45
Author: kevino at webkit.org <kevino at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Oct 18 17:02:58 2009 +0000
Reviewed by Kevin Ollivier.
Add the ability to specify a proxy for wxWebKit.
https://bugs.webkit.org/show_bug.cgi?id=30446
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c5c4c78..ed3ec36 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-09-13 Kevin Watters <kevinwatters at gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ Add support for proxies in CURL.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30446
+
+ * platform/network/curl/ResourceHandleManager.cpp:
+ (WebCore::ResourceHandleManager::setProxyInfo):
+ (WebCore::ResourceHandleManager::initializeHandle):
+ * platform/network/curl/ResourceHandleManager.h:
+ (WebCore::ResourceHandleManager::):
+
2009-10-18 Joanmarie Diggs <joanmarie.diggs at gmail.com>
Reviewed by Xan Lopez
diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp
index 68d73c6..d8a812f 100644
--- a/WebCore/platform/network/curl/ResourceHandleManager.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp
@@ -409,6 +409,25 @@ void ResourceHandleManager::downloadTimerCallback(Timer<ResourceHandleManager>*
m_downloadTimer.startOneShot(pollTimeSeconds);
}
+void ResourceHandleManager::setProxyInfo(const String& host,
+ unsigned long port,
+ ProxyType type,
+ const String& username,
+ const String& password)
+{
+ m_proxyType = type;
+
+ if (!host.length()) {
+ m_proxy = String("");
+ } else {
+ String userPass;
+ if (username.length() || password.length())
+ userPass = username + ":" + password + "@";
+
+ m_proxy = String("http://") + userPass + host + ":" + String::number(port);
+ }
+}
+
void ResourceHandleManager::removeFromCurl(ResourceHandle* job)
{
ResourceHandleInternal* d = job->getInternal();
@@ -753,6 +772,17 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job)
curl_easy_setopt(d->m_handle, CURLOPT_HTTPHEADER, headers);
d->m_customHeaders = headers;
}
+ // curl CURLOPT_USERPWD expects username:password
+ if (d->m_user.length() || d->m_pass.length()) {
+ String userpass = d->m_user + ":" + d->m_pass;
+ curl_easy_setopt(d->m_handle, CURLOPT_USERPWD, userpass.utf8().data());
+ }
+
+ // Set proxy options if we have them.
+ if (m_proxy.length()) {
+ curl_easy_setopt(d->m_handle, CURLOPT_PROXY, m_proxy.utf8().data());
+ curl_easy_setopt(d->m_handle, CURLOPT_PROXYTYPE, m_proxyType);
+ }
}
void ResourceHandleManager::cancel(ResourceHandle* job)
diff --git a/WebCore/platform/network/curl/ResourceHandleManager.h b/WebCore/platform/network/curl/ResourceHandleManager.h
index 89b27d7..864c403 100644
--- a/WebCore/platform/network/curl/ResourceHandleManager.h
+++ b/WebCore/platform/network/curl/ResourceHandleManager.h
@@ -28,8 +28,9 @@
#ifndef ResourceHandleManager_h
#define ResourceHandleManager_h
-#include "Frame.h"
#include "CString.h"
+#include "Frame.h"
+#include "String.h"
#include "Timer.h"
#include "ResourceHandleClient.h"
@@ -45,6 +46,13 @@ namespace WebCore {
class ResourceHandleManager {
public:
+ enum ProxyType {
+ HTTP = CURLPROXY_HTTP,
+ Socks4 = CURLPROXY_SOCKS4,
+ Socks4A = CURLPROXY_SOCKS4A,
+ Socks5 = CURLPROXY_SOCKS5,
+ Socks5Hostname = CURLPROXY_SOCKS5_HOSTNAME
+ };
static ResourceHandleManager* sharedInstance();
void add(ResourceHandle*);
void cancel(ResourceHandle*);
@@ -55,6 +63,12 @@ public:
void setupPOST(ResourceHandle*, struct curl_slist**);
void setupPUT(ResourceHandle*, struct curl_slist**);
+ void setProxyInfo(const String& host = "",
+ unsigned long port = 0,
+ ProxyType type = HTTP,
+ const String& username = "",
+ const String& password = "");
+
private:
ResourceHandleManager();
~ResourceHandleManager();
@@ -74,6 +88,9 @@ private:
Vector<ResourceHandle*> m_resourceHandleList;
const CString m_certificatePath;
int m_runningJobs;
+
+ String m_proxy;
+ ProxyType m_proxyType;
};
}
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 8ab1fb9..042c468 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,4 +1,17 @@
-2009-10-16 Kevin Watters <kevinwatters at gmail.com>
+2009-10-18 Kevin Watters <kevinwatters at gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ Add the ability to specify a proxy for wxWebKit.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30446
+
+ * WebView.cpp:
+ (curlProxyType):
+ (wxWebView::SetProxyInfo):
+ * WebView.h:
+
+2009-10-18 Kevin Watters <kevinwatters at gmail.com>
Reviewed by Kevin Ollivier.
diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp
index 615b66f..1b27cde 100644
--- a/WebKit/wx/WebView.cpp
+++ b/WebKit/wx/WebView.cpp
@@ -50,6 +50,7 @@
#include "PluginHalterClient.h"
#include "RenderObject.h"
#include "RenderView.h"
+#include "ResourceHandleManager.h"
#include "Scrollbar.h"
#include "SelectionController.h"
#include "Settings.h"
@@ -924,3 +925,29 @@ wxString wxWebView::GetDatabaseDirectory()
return wxEmptyString;
#endif
}
+
+static WebCore::ResourceHandleManager::ProxyType curlProxyType(wxProxyType type)
+{
+ switch (type) {
+ case HTTP: return WebCore::ResourceHandleManager::HTTP;
+ case Socks4: return WebCore::ResourceHandleManager::Socks4;
+ case Socks4A: return WebCore::ResourceHandleManager::Socks4A;
+ case Socks5: return WebCore::ResourceHandleManager::Socks5;
+ case Socks5Hostname: return WebCore::ResourceHandleManager::Socks5Hostname;
+ default:
+ ASSERT_NOT_REACHED();
+ return WebCore::ResourceHandleManager::HTTP;
+ }
+}
+
+/* static */
+void wxWebView::SetProxyInfo(const wxString& host,
+ unsigned long port,
+ wxProxyType type,
+ const wxString& username,
+ const wxString& password)
+{
+ using WebCore::ResourceHandleManager;
+ if (ResourceHandleManager* mgr = ResourceHandleManager::sharedInstance())
+ mgr->setProxyInfo(host, port, curlProxyType(type), username, password);
+}
diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h
index 01c23dd..9b1cfab 100644
--- a/WebKit/wx/WebView.h
+++ b/WebKit/wx/WebView.h
@@ -105,6 +105,14 @@ enum {
WebKitErrorJavaUnavailable = 202,
};
+enum wxProxyType {
+ HTTP,
+ Socks4,
+ Socks4A,
+ Socks5,
+ Socks5Hostname
+};
+
class WXDLLIMPEXP_WEBKIT wxWebView : public wxWindow
{
// ChromeClientWx needs to get the Page* stored by the wxWebView
@@ -200,6 +208,12 @@ public:
static void SetDatabaseDirectory(const wxString& databaseDirectory);
static wxString GetDatabaseDirectory();
+ static void SetProxyInfo(const wxString& host = wxEmptyString,
+ unsigned long port = 0,
+ wxProxyType type = HTTP,
+ const wxString& username = wxEmptyString,
+ const wxString& password = wxEmptyString);
+
protected:
// event handlers (these functions should _not_ be virtual)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list