[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
ap at apple.com
ap at apple.com
Thu Dec 3 13:42:50 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b9befde20bd02434ff22125d107d8c7708cf0a25
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 23 21:00:27 2009 +0000
Reviewed by Brady Eidson.
https://bugs.webkit.org/show_bug.cgi?id=31748
Make WebSocketHandleCFNet respect proxy auto-configuration files via CFProxySupport
* platform/network/cf/SocketStreamHandle.h: Removed names from some void* arguments, since
they didn't carry useful information.
* platform/network/cf/SocketStreamHandleCFNet.cpp:
(WebCore::SocketStreamHandle::SocketStreamHandle): When we need an http-style URL, we actually
always need https.
(WebCore::SocketStreamHandle::scheduleStreams): Factored out from constructor, since streams
only get scheduled after PAC is fetched and executed asynchronously.
(WebCore::SocketStreamHandle::copyPACExecutionDescription): Return a description for event
source.
(WebCore::MainThreadPACCallbackInfo::MainThreadPACCallbackInfo): Forward callback to main thread.
(WebCore::SocketStreamHandle::pacExecutionCallback): Ditto.
(WebCore::SocketStreamHandle::pacExecutionCallbackMainThread): Ditto. To avoid code duplication,
we make the call even on Mac.
(WebCore::SocketStreamHandle::executePACFileURL): Make an async call to CFNetworkExecuteProxyAutoConfigurationURL.
(WebCore::SocketStreamHandle::removePACRunLoopSource): Once PAC execution is done or aborted,
we need to get rid of the event source.
(WebCore::SocketStreamHandle::chooseProxy): Use stored m_httpsURL.get.
(WebCore::SocketStreamHandle::chooseProxyFromArray): Factored out from chooseProxy - the
array may come directly from system configuration, or from PAC.
(WebCore::SocketStreamHandle::chooseProxy): Tiger version of this function is now completely
separate.
(WebCore::SocketStreamHandle::~SocketStreamHandle): Run loop source should be destroyed
before we get to the destructor.
(WebCore::SocketStreamHandle::platformClose): Destroy the run loop source, if PAC execution
is still in progress.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index b51f245..dd4493a 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-23 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Brady Eidson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31748
+ Make WebSocketHandleCFNet respect proxy auto-configuration files via CFProxySupport
+
+ * JavaScriptCore.exp: Export callOnMainThreadAndWait.
+
2009-11-23 Laszlo Gombos <laszlo.1.gombos at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 231fddd..d2f6035 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -319,6 +319,7 @@ __ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd
__ZN3WTF15ThreadConditionC1Ev
__ZN3WTF15ThreadConditionD1Ev
__ZN3WTF16callOnMainThreadEPFvPvES0_
+__ZN3WTF23callOnMainThreadAndWaitEPFvPvES0_
__ZN3WTF16fastZeroedMallocEm
__ZN3WTF19initializeThreadingEv
__ZN3WTF20fastMallocStatisticsEv
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 60d0ff1..098cbf2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2009-11-23 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Brady Eidson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31748
+ Make WebSocketHandleCFNet respect proxy auto-configuration files via CFProxySupport
+
+ * platform/network/cf/SocketStreamHandle.h: Removed names from some void* arguments, since
+ they didn't carry useful information.
+
+ * platform/network/cf/SocketStreamHandleCFNet.cpp:
+ (WebCore::SocketStreamHandle::SocketStreamHandle): When we need an http-style URL, we actually
+ always need https.
+ (WebCore::SocketStreamHandle::scheduleStreams): Factored out from constructor, since streams
+ only get scheduled after PAC is fetched and executed asynchronously.
+ (WebCore::SocketStreamHandle::copyPACExecutionDescription): Return a description for event
+ source.
+ (WebCore::MainThreadPACCallbackInfo::MainThreadPACCallbackInfo): Forward callback to main thread.
+ (WebCore::SocketStreamHandle::pacExecutionCallback): Ditto.
+ (WebCore::SocketStreamHandle::pacExecutionCallbackMainThread): Ditto. To avoid code duplication,
+ we make the call even on Mac.
+ (WebCore::SocketStreamHandle::executePACFileURL): Make an async call to CFNetworkExecuteProxyAutoConfigurationURL.
+ (WebCore::SocketStreamHandle::removePACRunLoopSource): Once PAC execution is done or aborted,
+ we need to get rid of the event source.
+ (WebCore::SocketStreamHandle::chooseProxy): Use stored m_httpsURL.get.
+ (WebCore::SocketStreamHandle::chooseProxyFromArray): Factored out from chooseProxy - the
+ array may come directly from system configuration, or from PAC.
+ (WebCore::SocketStreamHandle::chooseProxy): Tiger version of this function is now completely
+ separate.
+ (WebCore::SocketStreamHandle::~SocketStreamHandle): Run loop source should be destroyed
+ before we get to the destructor.
+ (WebCore::SocketStreamHandle::platformClose): Destroy the run loop source, if PAC execution
+ is still in progress.
+
2009-11-23 Oliver Hunt <oliver at apple.com>
Reviewed by Geoff Garen.
diff --git a/WebCore/platform/network/cf/SocketStreamHandle.h b/WebCore/platform/network/cf/SocketStreamHandle.h
index aaba523..4cd10ca 100644
--- a/WebCore/platform/network/cf/SocketStreamHandle.h
+++ b/WebCore/platform/network/cf/SocketStreamHandle.h
@@ -57,16 +57,26 @@ namespace WebCore {
SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
void createStreams();
+ void scheduleStreams();
void chooseProxy();
+#ifndef BUILDING_ON_TIGER
+ void chooseProxyFromArray(CFArrayRef);
+ void executePACFileURL(CFURLRef);
+ void removePACRunLoopSource();
+ RetainPtr<CFRunLoopSourceRef> m_pacRunLoopSource;
+ static void pacExecutionCallback(void* client, CFArrayRef proxyList, CFErrorRef error);
+ static void pacExecutionCallbackMainThread(void*);
+ static CFStringRef copyPACExecutionDescription(void*);
+#endif
bool shouldUseSSL() const { return m_url.protocolIs("wss"); }
- static CFStringRef copyCFStreamDescription(void* streamInfo);
- static void readStreamCallback(CFReadStreamRef, CFStreamEventType, void* clientCallBackInfo);
- static void writeStreamCallback(CFWriteStreamRef, CFStreamEventType, void* clientCallBackInfo);
+ static CFStringRef copyCFStreamDescription(void* );
+ static void readStreamCallback(CFReadStreamRef, CFStreamEventType, void*);
+ static void writeStreamCallback(CFWriteStreamRef, CFStreamEventType, void*);
#if PLATFORM(WIN)
- static void readStreamCallbackMainThread(void* invocation);
- static void writeStreamCallbackMainThread(void* invocation);
+ static void readStreamCallbackMainThread(void*);
+ static void writeStreamCallbackMainThread(void*);
#endif
void readStreamCallback(CFStreamEventType);
void writeStreamCallback(CFStreamEventType);
@@ -79,7 +89,7 @@ namespace WebCore {
virtual void refAuthenticationClient() { ref(); }
virtual void derefAuthenticationClient() { deref(); }
- enum ConnectingSubstate { New, FetchingProxyAutoConfigurationFile, WaitingForCredentials, WaitingForConnect, Connected };
+ enum ConnectingSubstate { New, ExecutingPACFile, WaitingForCredentials, WaitingForConnect, Connected };
ConnectingSubstate m_connectingSubstate;
enum ConnectionType { Unknown, Direct, SOCKSProxy, CONNECTProxy };
@@ -91,7 +101,7 @@ namespace WebCore {
RetainPtr<CFReadStreamRef> m_readStream;
RetainPtr<CFWriteStreamRef> m_writeStream;
- RetainPtr<CFURLRef> m_httpURL; // ws(s): replaced with http(s):
+ RetainPtr<CFURLRef> m_httpsURL; // ws(s): replaced with https:
};
} // namespace WebCore
diff --git a/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp b/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
index 932fac4..8980ef4 100644
--- a/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
+++ b/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
@@ -69,14 +69,22 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
if (!m_url.port())
m_url.setPort(shouldUseSSL() ? 443 : 80);
- KURL httpURL(KURL(), (shouldUseSSL() ? "https://" : "http://") + m_url.host());
- m_httpURL.adoptCF(httpURL.createCFURL());
+ KURL httpsURL(KURL(), "https://" + m_url.host());
+ m_httpsURL.adoptCF(httpsURL.createCFURL());
createStreams();
ASSERT(!m_readStream == !m_writeStream);
if (!m_readStream) // Doing asynchronous PAC file processing, streams will be created later.
return;
+ scheduleStreams();
+}
+
+void SocketStreamHandle::scheduleStreams()
+{
+ ASSERT(m_readStream);
+ ASSERT(m_writeStream);
+
CFStreamClientContext clientContext = { 0, this, 0, 0, copyCFStreamDescription };
// FIXME: Pass specific events we're interested in instead of -1.
CFReadStreamSetClient(m_readStream.get(), static_cast<CFOptionFlags>(-1), readStreamCallback, &clientContext);
@@ -93,12 +101,74 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
CFReadStreamOpen(m_readStream.get());
CFWriteStreamOpen(m_writeStream.get());
+#ifndef BUILDING_ON_TIGER
+ if (m_pacRunLoopSource)
+ removePACRunLoopSource();
+#endif
+
m_connectingSubstate = WaitingForConnect;
}
+#ifndef BUILDING_ON_TIGER
+CFStringRef SocketStreamHandle::copyPACExecutionDescription(void*)
+{
+ return CFSTR("WebSocket proxy PAC file execution");
+}
+
+struct MainThreadPACCallbackInfo {
+ MainThreadPACCallbackInfo(SocketStreamHandle* handle, CFArrayRef proxyList) : handle(handle), proxyList(proxyList) { }
+ SocketStreamHandle* handle;
+ CFArrayRef proxyList;
+};
+
+void SocketStreamHandle::pacExecutionCallback(void* client, CFArrayRef proxyList, CFErrorRef)
+{
+ SocketStreamHandle* handle = static_cast<SocketStreamHandle*>(client);
+ MainThreadPACCallbackInfo info(handle, proxyList);
+ // If we're already on main thread (e.g. on Mac), callOnMainThreadAndWait() will be just a function call.
+ callOnMainThreadAndWait(pacExecutionCallbackMainThread, &info);
+}
+
+void SocketStreamHandle::pacExecutionCallbackMainThread(void* invocation)
+{
+ ASSERT(m_connectingSubstate == ExecutingPACFile);
+
+ MainThreadPACCallbackInfo* info = static_cast<MainThreadPACCallbackInfo*>(invocation);
+ // This time, the array won't have PAC as a first entry.
+ info->handle->chooseProxyFromArray(info->proxyList);
+ info->handle->createStreams();
+ info->handle->scheduleStreams();
+}
+
+void SocketStreamHandle::executePACFileURL(CFURLRef pacFileURL)
+{
+ // CFNetwork returns an empty proxy array for WebScoket schemes, so use m_httpsURL.
+ CFStreamClientContext clientContext = { 0, this, 0, 0, copyPACExecutionDescription };
+ m_pacRunLoopSource.adoptCF(CFNetworkExecuteProxyAutoConfigurationURL(pacFileURL, m_httpsURL.get(), pacExecutionCallback, &clientContext));
+#if PLATFORM(WIN)
+ CFRunLoopAddSource(loaderRunLoop(), m_pacRunLoopSource.get(), kCFRunLoopDefaultMode);
+#else
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), m_pacRunLoopSource.get(), kCFRunLoopCommonModes);
+#endif
+ m_connectingSubstate = ExecutingPACFile;
+}
+
+void SocketStreamHandle::removePACRunLoopSource()
+{
+ ASSERT(m_pacRunLoopSource);
+
+ CFRunLoopSourceInvalidate(m_pacRunLoopSource.get());
+#if PLATFORM(WIN)
+ CFRunLoopRemoveSource(loaderRunLoop(), m_pacRunLoopSource.get(), kCFRunLoopDefaultMode);
+#else
+ CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_pacRunLoopSource.get(), kCFRunLoopCommonModes);
+#endif
+ m_pacRunLoopSource = 0;
+}
+
void SocketStreamHandle::chooseProxy()
{
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#ifndef BUILDING_ON_LEOPARD
RetainPtr<CFDictionaryRef> proxyDictionary(AdoptCF, CFNetworkCopySystemProxySettings());
#else
// We don't need proxy information often, so there is no need to set up a permanent dynamic store session.
@@ -115,20 +185,38 @@ void SocketStreamHandle::chooseProxy()
return;
}
-#ifndef BUILDING_ON_TIGER
// CFNetworkCopyProxiesForURL doesn't know about WebSocket schemes, so pretend to use http.
- // Always use "https" to get HTTPS proxies in result - we'll try to use those for ws:. even though many are configured to reject connections to ports other than 443.
- KURL httpsURL(KURL(), "https://" + m_url.host());
- RetainPtr<CFURLRef> httpsURLCF(AdoptCF, httpsURL.createCFURL());
+ // Always use "https" to get HTTPS proxies in result - we'll try to use those for ws:// even though many are configured to reject connections to ports other than 443.
+ RetainPtr<CFArrayRef> proxyArray(AdoptCF, CFNetworkCopyProxiesForURL(m_httpsURL.get(), proxyDictionary.get()));
- RetainPtr<CFArrayRef> proxyArray(AdoptCF, CFNetworkCopyProxiesForURL(httpsURLCF.get(), proxyDictionary.get()));
- CFIndex proxyArrayCount = CFArrayGetCount(proxyArray.get());
+ chooseProxyFromArray(proxyArray.get());
+}
+
+void SocketStreamHandle::chooseProxyFromArray(CFArrayRef proxyArray)
+{
+ if (!proxyArray)
+ m_connectionType = Direct;
- // FIXME: Support PAC files (always the preferred entry).
+ CFIndex proxyArrayCount = CFArrayGetCount(proxyArray);
+
+ // PAC is always the first entry, if present.
+ if (proxyArrayCount) {
+ CFDictionaryRef proxyInfo = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(proxyArray, 0));
+ CFTypeRef proxyType = CFDictionaryGetValue(proxyInfo, kCFProxyTypeKey);
+ if (proxyType && CFGetTypeID(proxyType) == CFStringGetTypeID()) {
+ if (CFEqual(proxyType, kCFProxyTypeAutoConfigurationURL)) {
+ CFTypeRef pacFileURL = CFDictionaryGetValue(proxyInfo, kCFProxyAutoConfigurationURLKey);
+ if (pacFileURL && CFGetTypeID(pacFileURL) == CFURLGetTypeID()) {
+ executePACFileURL(static_cast<CFURLRef>(pacFileURL));
+ return;
+ }
+ }
+ }
+ }
CFDictionaryRef chosenProxy = 0;
for (CFIndex i = 0; i < proxyArrayCount; ++i) {
- CFDictionaryRef proxyInfo = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(proxyArray.get(), i));
+ CFDictionaryRef proxyInfo = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(proxyArray, i));
CFTypeRef proxyType = CFDictionaryGetValue(proxyInfo, kCFProxyTypeKey);
if (proxyType && CFGetTypeID(proxyType) == CFStringGetTypeID()) {
if (CFEqual(proxyType, kCFProxyTypeSOCKS)) {
@@ -157,7 +245,27 @@ void SocketStreamHandle::chooseProxy()
return;
}
}
+
+ m_connectionType = Direct;
+}
+
#else // BUILDING_ON_TIGER
+
+void SocketStreamHandle::chooseProxy()
+{
+ // We don't need proxy information often, so there is no need to set up a permanent dynamic store session.
+ RetainPtr<CFDictionaryRef> proxyDictionary(AdoptCF, SCDynamicStoreCopyProxies(0));
+
+ // SOCKS or HTTPS (AKA CONNECT) proxies are supported.
+ // WebSocket protocol relies on handshake being transferred unchanged, so we need a proxy that will not modify headers.
+ // Since HTTP proxies must add Via headers, they are highly unlikely to work.
+ // Many CONNECT proxies limit connectivity to port 443, so we prefer SOCKS, if configured.
+
+ if (!proxyDictionary) {
+ m_connectionType = Direct;
+ return;
+ }
+
// FIXME: check proxy bypass list and ExcludeSimpleHostnames.
// FIXME: Support PAC files.
@@ -187,10 +295,10 @@ void SocketStreamHandle::chooseProxy()
return;
}
}
-#endif
m_connectionType = Direct;
}
+#endif // BUILDING_ON_TIGER
void SocketStreamHandle::createStreams()
{
@@ -250,11 +358,11 @@ CFStringRef SocketStreamHandle::copyCFStreamDescription(void* info)
return ("WebKit socket stream, " + handle->m_url.string()).createCFString();
}
-struct MainThreadEventCallbackInfo {
- MainThreadEventCallbackInfo(CFStreamEventType type, SocketStreamHandle* handle) : type(type), handle(handle) { }
- CFStreamEventType type;
- SocketStreamHandle* handle;
-};
+struct MainThreadEventCallbackInfo {
+ MainThreadEventCallbackInfo(CFStreamEventType type, SocketStreamHandle* handle) : type(type), handle(handle) { }
+ CFStreamEventType type;
+ SocketStreamHandle* handle;
+};
void SocketStreamHandle::readStreamCallback(CFReadStreamRef stream, CFStreamEventType type, void* clientCallBackInfo)
{
@@ -283,17 +391,17 @@ void SocketStreamHandle::writeStreamCallback(CFWriteStreamRef stream, CFStreamEv
}
#if PLATFORM(WIN)
-void SocketStreamHandle::readStreamCallbackMainThread(void* invocation)
-{
- MainThreadEventCallbackInfo* info = static_cast<MainThreadEventCallbackInfo*>(invocation);
- info->handle->readStreamCallback(info->type);
-}
-
-void SocketStreamHandle::writeStreamCallbackMainThread(void* invocation)
-{
- MainThreadEventCallbackInfo* info = static_cast<MainThreadEventCallbackInfo*>(invocation);
- info->handle->writeStreamCallback(info->type);
-}
+void SocketStreamHandle::readStreamCallbackMainThread(void* invocation)
+{
+ MainThreadEventCallbackInfo* info = static_cast<MainThreadEventCallbackInfo*>(invocation);
+ info->handle->readStreamCallback(info->type);
+}
+
+void SocketStreamHandle::writeStreamCallbackMainThread(void* invocation)
+{
+ MainThreadEventCallbackInfo* info = static_cast<MainThreadEventCallbackInfo*>(invocation);
+ info->handle->writeStreamCallback(info->type);
+}
#endif // PLATFORM(WIN)
void SocketStreamHandle::readStreamCallback(CFStreamEventType type)
@@ -391,6 +499,10 @@ void SocketStreamHandle::writeStreamCallback(CFStreamEventType type)
SocketStreamHandle::~SocketStreamHandle()
{
LOG(Network, "SocketStreamHandle %p dtor", this);
+
+#ifndef BUILDING_ON_TIGER
+ ASSERT(!m_pacRunLoopSource);
+#endif
}
int SocketStreamHandle::platformSend(const char* data, int length)
@@ -405,6 +517,11 @@ void SocketStreamHandle::platformClose()
{
LOG(Network, "SocketStreamHandle %p platformClose", this);
+#ifndef BUILDING_ON_TIGER
+ if (m_pacRunLoopSource)
+ removePACRunLoopSource();
+#endif
+
ASSERT(!m_readStream == !m_writeStream);
if (!m_readStream)
return;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list