Changeset 49752 in webkit
- Timestamp:
- Oct 18, 2009 10:02:58 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49751 r49752 1 2009-09-13 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Add support for proxies in CURL. 6 7 https://bugs.webkit.org/show_bug.cgi?id=30446 8 9 * platform/network/curl/ResourceHandleManager.cpp: 10 (WebCore::ResourceHandleManager::setProxyInfo): 11 (WebCore::ResourceHandleManager::initializeHandle): 12 * platform/network/curl/ResourceHandleManager.h: 13 (WebCore::ResourceHandleManager::): 14 1 15 2009-10-18 Joanmarie Diggs <joanmarie.diggs@gmail.com> 2 16 -
trunk/WebCore/platform/network/curl/ResourceHandleManager.cpp
r49577 r49752 410 410 } 411 411 412 void ResourceHandleManager::setProxyInfo(const String& host, 413 unsigned long port, 414 ProxyType type, 415 const String& username, 416 const String& password) 417 { 418 m_proxyType = type; 419 420 if (!host.length()) { 421 m_proxy = String(""); 422 } else { 423 String userPass; 424 if (username.length() || password.length()) 425 userPass = username + ":" + password + "@"; 426 427 m_proxy = String("http://") + userPass + host + ":" + String::number(port); 428 } 429 } 430 412 431 void ResourceHandleManager::removeFromCurl(ResourceHandle* job) 413 432 { … … 754 773 d->m_customHeaders = headers; 755 774 } 775 // curl CURLOPT_USERPWD expects username:password 776 if (d->m_user.length() || d->m_pass.length()) { 777 String userpass = d->m_user + ":" + d->m_pass; 778 curl_easy_setopt(d->m_handle, CURLOPT_USERPWD, userpass.utf8().data()); 779 } 780 781 // Set proxy options if we have them. 782 if (m_proxy.length()) { 783 curl_easy_setopt(d->m_handle, CURLOPT_PROXY, m_proxy.utf8().data()); 784 curl_easy_setopt(d->m_handle, CURLOPT_PROXYTYPE, m_proxyType); 785 } 756 786 } 757 787 -
trunk/WebCore/platform/network/curl/ResourceHandleManager.h
r47071 r49752 29 29 #define ResourceHandleManager_h 30 30 31 #include "CString.h" 31 32 #include "Frame.h" 32 #include " CString.h"33 #include "String.h" 33 34 #include "Timer.h" 34 35 #include "ResourceHandleClient.h" … … 46 47 class ResourceHandleManager { 47 48 public: 49 enum ProxyType { 50 HTTP = CURLPROXY_HTTP, 51 Socks4 = CURLPROXY_SOCKS4, 52 Socks4A = CURLPROXY_SOCKS4A, 53 Socks5 = CURLPROXY_SOCKS5, 54 Socks5Hostname = CURLPROXY_SOCKS5_HOSTNAME 55 }; 48 56 static ResourceHandleManager* sharedInstance(); 49 57 void add(ResourceHandle*); … … 55 63 void setupPOST(ResourceHandle*, struct curl_slist**); 56 64 void setupPUT(ResourceHandle*, struct curl_slist**); 65 66 void setProxyInfo(const String& host = "", 67 unsigned long port = 0, 68 ProxyType type = HTTP, 69 const String& username = "", 70 const String& password = ""); 57 71 58 72 private: … … 75 89 const CString m_certificatePath; 76 90 int m_runningJobs; 91 92 String m_proxy; 93 ProxyType m_proxyType; 77 94 }; 78 95 -
trunk/WebKit/wx/ChangeLog
r49750 r49752 1 2009-10-16 Kevin Watters <kevinwatters@gmail.com> 1 2009-10-18 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Add the ability to specify a proxy for wxWebKit. 6 7 https://bugs.webkit.org/show_bug.cgi?id=30446 8 9 * WebView.cpp: 10 (curlProxyType): 11 (wxWebView::SetProxyInfo): 12 * WebView.h: 13 14 2009-10-18 Kevin Watters <kevinwatters@gmail.com> 2 15 3 16 Reviewed by Kevin Ollivier. -
trunk/WebKit/wx/WebView.cpp
r49750 r49752 51 51 #include "RenderObject.h" 52 52 #include "RenderView.h" 53 #include "ResourceHandleManager.h" 53 54 #include "Scrollbar.h" 54 55 #include "SelectionController.h" … … 925 926 #endif 926 927 } 928 929 static WebCore::ResourceHandleManager::ProxyType curlProxyType(wxProxyType type) 930 { 931 switch (type) { 932 case HTTP: return WebCore::ResourceHandleManager::HTTP; 933 case Socks4: return WebCore::ResourceHandleManager::Socks4; 934 case Socks4A: return WebCore::ResourceHandleManager::Socks4A; 935 case Socks5: return WebCore::ResourceHandleManager::Socks5; 936 case Socks5Hostname: return WebCore::ResourceHandleManager::Socks5Hostname; 937 default: 938 ASSERT_NOT_REACHED(); 939 return WebCore::ResourceHandleManager::HTTP; 940 } 941 } 942 943 /* static */ 944 void wxWebView::SetProxyInfo(const wxString& host, 945 unsigned long port, 946 wxProxyType type, 947 const wxString& username, 948 const wxString& password) 949 { 950 using WebCore::ResourceHandleManager; 951 if (ResourceHandleManager* mgr = ResourceHandleManager::sharedInstance()) 952 mgr->setProxyInfo(host, port, curlProxyType(type), username, password); 953 } -
trunk/WebKit/wx/WebView.h
r49750 r49752 106 106 }; 107 107 108 enum wxProxyType { 109 HTTP, 110 Socks4, 111 Socks4A, 112 Socks5, 113 Socks5Hostname 114 }; 115 108 116 class WXDLLIMPEXP_WEBKIT wxWebView : public wxWindow 109 117 { … … 200 208 static void SetDatabaseDirectory(const wxString& databaseDirectory); 201 209 static wxString GetDatabaseDirectory(); 210 211 static void SetProxyInfo(const wxString& host = wxEmptyString, 212 unsigned long port = 0, 213 wxProxyType type = HTTP, 214 const wxString& username = wxEmptyString, 215 const wxString& password = wxEmptyString); 202 216 203 217 protected:
Note: See TracChangeset
for help on using the changeset viewer.