summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/network
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-13 16:23:25 +0100
committerBen Murdoch <benm@google.com>2011-05-16 11:35:02 +0100
commit65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch)
treef478babb801e720de7bfaee23443ffe029f58731 /Source/WebCore/platform/network
parent47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff)
downloadexternal_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebCore/platform/network')
-rw-r--r--Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp4
-rw-r--r--Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp28
-rw-r--r--Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h44
-rw-r--r--Source/WebCore/platform/network/soup/AuthenticationChallenge.h5
-rw-r--r--Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp13
-rw-r--r--Source/WebCore/platform/network/soup/cache/soup-http-input-stream.c2
-rw-r--r--Source/WebCore/platform/network/win/ProxyServerWin.cpp37
7 files changed, 98 insertions, 35 deletions
diff --git a/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
index 959e74a..f3e7023 100644
--- a/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
+++ b/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
@@ -91,6 +91,6 @@ void NetworkStateNotifier::setNetworkAccessAllowed(bool isAllowed)
} // namespace WebCore
-#endif
-
#include "moc_NetworkStateNotifierPrivate.cpp"
+
+#endif
diff --git a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp
index 0caeb05..e0d6e69 100644
--- a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp
+++ b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp
@@ -25,10 +25,6 @@
#include <QNetworkCookieJar>
#include <QStringList>
-// Use unused variables to be able to call qRegisterMetaType statically.
-static int dummyStaticVar1 = qRegisterMetaType<QFutureInterface<bool> >("QFutureInterface<bool>");
-static int dummyStaticVar2 = qRegisterMetaType<QFutureInterface<QList<QNetworkCookie> > >("QFutureInterface<QList<QNetworkCookie> >");
-
namespace WebCore {
QtNAMThreadSafeProxy::QtNAMThreadSafeProxy(QNetworkAccessManager *manager)
@@ -37,8 +33,8 @@ QtNAMThreadSafeProxy::QtNAMThreadSafeProxy(QNetworkAccessManager *manager)
moveToThread(manager->thread());
connect(this, SIGNAL(localSetCookiesRequested(const QUrl&, const QString&)), SLOT(localSetCookies(const QUrl&, const QString&)));
- connect(this, SIGNAL(localCookiesForUrlRequested(QFutureInterface<QList<QNetworkCookie> >, const QUrl&)), SLOT(localCookiesForUrl(QFutureInterface<QList<QNetworkCookie> >, const QUrl&)));
- connect(this, SIGNAL(localWillLoadFromCacheRequested(QFutureInterface<bool>, const QUrl&)), SLOT(localWillLoadFromCache(QFutureInterface<bool>, const QUrl&)));
+ connect(this, SIGNAL(localCookiesForUrlRequested(const QUrl&, bool*, QList<QNetworkCookie>*)), SLOT(localCookiesForUrl(const QUrl&, bool*, QList<QNetworkCookie>*)));
+ connect(this, SIGNAL(localWillLoadFromCacheRequested(const QUrl&, bool*, bool*)), SLOT(localWillLoadFromCache(const QUrl&, bool*, bool*)));
}
void QtNAMThreadSafeProxy::localSetCookies(const QUrl& url, const QString& cookies)
@@ -54,19 +50,23 @@ void QtNAMThreadSafeProxy::localSetCookies(const QUrl& url, const QString& cooki
m_manager->cookieJar()->setCookiesFromUrl(cookieList, url);
}
-void QtNAMThreadSafeProxy::localCookiesForUrl(QFutureInterface<QList<QNetworkCookie> > fi, const QUrl& url)
+void QtNAMThreadSafeProxy::localCookiesForUrl(const QUrl& url, bool* done, QList<QNetworkCookie>* result)
{
- fi.reportResult(m_manager->cookieJar()->cookiesForUrl(url));
- fi.reportFinished();
+ QMutexLocker lock(&m_resultMutex);
+ *result = m_manager->cookieJar()->cookiesForUrl(url);
+ *done = true;
+ m_resultWaitCondition.wakeAll();
}
-void QtNAMThreadSafeProxy::localWillLoadFromCache(QFutureInterface<bool> fi, const QUrl& url)
+void QtNAMThreadSafeProxy::localWillLoadFromCache(const QUrl& url, bool* done, bool* result)
{
- bool retVal = false;
+ QMutexLocker lock(&m_resultMutex);
if (m_manager->cache())
- retVal = m_manager->cache()->metaData(url).isValid();
-
- fi.reportFinished(&retVal);
+ *result = m_manager->cache()->metaData(url).isValid();
+ else
+ *result = false;
+ *done = true;
+ m_resultWaitCondition.wakeAll();
}
QtNetworkReplyThreadSafeProxy::QtNetworkReplyThreadSafeProxy(QNetworkAccessManager *manager)
diff --git a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h
index a2fa4ee..ae963cf 100644
--- a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h
+++ b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h
@@ -19,11 +19,11 @@
#ifndef QtNAMThreadSafeProxy_h
#define QtNAMThreadSafeProxy_h
-#include <QFuture>
#include <QMutex>
#include <QNetworkCookie>
#include <QNetworkReply>
#include <QObject>
+#include <QWaitCondition>
QT_BEGIN_NAMESPACE
class QNetworkAccessManager;
@@ -43,34 +43,44 @@ public:
emit localSetCookiesRequested(url, cookies);
}
- QFuture<QList<QNetworkCookie> > cookiesForUrl(const QUrl& url)
+ QList<QNetworkCookie> cookiesForUrl(const QUrl& url)
{
- QFutureInterface<QList<QNetworkCookie> > fi;
- fi.reportStarted();
- emit localCookiesForUrlRequested(fi, url);
- return fi.future();
+ bool done = false;
+ QList<QNetworkCookie> result;
+ emit localCookiesForUrlRequested(url, &done, &result);
+
+ QMutexLocker lock(&m_resultMutex);
+ while (!done)
+ m_resultWaitCondition.wait(&m_resultMutex);
+ return result;
}
- QFuture<bool> willLoadFromCache(const QUrl& url)
+ bool willLoadFromCache(const QUrl& url)
{
- QFutureInterface<bool> fi;
- fi.reportStarted();
- emit localWillLoadFromCacheRequested(fi, url);
- return fi.future();
+ bool done = false;
+ bool result;
+ emit localWillLoadFromCacheRequested(url, &done, &result);
+
+ QMutexLocker lock(&m_resultMutex);
+ while (!done)
+ m_resultWaitCondition.wait(&m_resultMutex);
+ return result;
}
signals:
- void localSetCookiesRequested(const QUrl& url, const QString& cookies);
- void localCookiesForUrlRequested(QFutureInterface<QList<QNetworkCookie> > fi, const QUrl& url);
- void localWillLoadFromCacheRequested(QFutureInterface<bool> fi, const QUrl& url);
+ void localSetCookiesRequested(const QUrl&, const QString& cookies);
+ void localCookiesForUrlRequested(const QUrl&, bool* done, QList<QNetworkCookie>* result);
+ void localWillLoadFromCacheRequested(const QUrl&, bool* done, bool* result);
private slots:
- void localSetCookies(const QUrl& url, const QString& cookies);
- void localCookiesForUrl(QFutureInterface<QList<QNetworkCookie> > fi, const QUrl& url);
- void localWillLoadFromCache(QFutureInterface<bool> fi, const QUrl& url);
+ void localSetCookies(const QUrl&, const QString& cookies);
+ void localCookiesForUrl(const QUrl&, bool* done, QList<QNetworkCookie>* result);
+ void localWillLoadFromCache(const QUrl&, bool* done, bool* result);
private:
QNetworkAccessManager* m_manager;
+ QMutex m_resultMutex;
+ QWaitCondition m_resultWaitCondition;
};
diff --git a/Source/WebCore/platform/network/soup/AuthenticationChallenge.h b/Source/WebCore/platform/network/soup/AuthenticationChallenge.h
index 5177f1e..492d5c2 100644
--- a/Source/WebCore/platform/network/soup/AuthenticationChallenge.h
+++ b/Source/WebCore/platform/network/soup/AuthenticationChallenge.h
@@ -26,6 +26,7 @@
#define AuthenticationChallenge_h
#include "AuthenticationChallengeBase.h"
+#include "AuthenticationClient.h"
namespace WebCore {
@@ -39,6 +40,10 @@ public:
: AuthenticationChallengeBase(protectionSpace, proposedCredential, previousFailureCount, response, error)
{
}
+
+ AuthenticationClient* authenticationClient() const { return m_authenticationClient.get(); }
+
+ RefPtr<AuthenticationClient> m_authenticationClient;
};
}
diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index 8900b18..ebb6c5f 100644
--- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -215,6 +215,8 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
#endif
}
+static void contentSniffedCallback(SoupMessage*, const char*, GHashTable*, gpointer);
+
static void gotHeadersCallback(SoupMessage* msg, gpointer data)
{
// For 401, we will accumulate the resource body, and only use it
@@ -235,9 +237,18 @@ static void gotHeadersCallback(SoupMessage* msg, gpointer data)
// The content-sniffed callback will handle the response if WebCore
// require us to sniff.
- if (!handle || statusWillBeHandledBySoup(msg->status_code) || handle->shouldContentSniff())
+ if (!handle || statusWillBeHandledBySoup(msg->status_code))
return;
+ if (handle->shouldContentSniff()) {
+ // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
+ if (msg->status_code == SOUP_STATUS_NOT_MODIFIED) {
+ soup_message_disable_feature(msg, SOUP_TYPE_CONTENT_SNIFFER);
+ g_signal_handlers_disconnect_by_func(msg, reinterpret_cast<gpointer>(contentSniffedCallback), handle.get());
+ } else
+ return;
+ }
+
ResourceHandleInternal* d = handle->getInternal();
if (d->m_cancelled)
return;
diff --git a/Source/WebCore/platform/network/soup/cache/soup-http-input-stream.c b/Source/WebCore/platform/network/soup/cache/soup-http-input-stream.c
index 195c458..2a5d995 100644
--- a/Source/WebCore/platform/network/soup/cache/soup-http-input-stream.c
+++ b/Source/WebCore/platform/network/soup/cache/soup-http-input-stream.c
@@ -267,7 +267,7 @@ webkit_soup_http_input_stream_got_chunk (SoupMessage *msg, SoupBuffer *chunk_buf
g_warning ("webkit_soup_http_input_stream_got_chunk called again before previous chunk was processed");
/* Copy what we can into priv->caller_buffer */
- if (priv->caller_bufsize - priv->caller_nread > 0) {
+ if (priv->caller_bufsize > priv->caller_nread) {
gsize nread = MIN (chunk_size, priv->caller_bufsize - priv->caller_nread);
memcpy (priv->caller_buffer + priv->caller_nread, chunk, nread);
diff --git a/Source/WebCore/platform/network/win/ProxyServerWin.cpp b/Source/WebCore/platform/network/win/ProxyServerWin.cpp
new file mode 100644
index 0000000..c610e20
--- /dev/null
+++ b/Source/WebCore/platform/network/win/ProxyServerWin.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Brent Fulgham <bfulgham@webkit.org>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ProxyServer.h"
+
+namespace WebCore {
+
+Vector<ProxyServer> proxyServersForURL(const KURL&, const NetworkingContext*)
+{
+ // FIXME: Implement.
+ return Vector<ProxyServer>();
+}
+
+} // namespace WebCore