summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/network
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/network')
-rw-r--r--WebCore/platform/network/CredentialStorage.cpp3
-rw-r--r--WebCore/platform/network/NetworkStateNotifier.h21
-rw-r--r--WebCore/platform/network/ProtectionSpaceHash.h1
-rw-r--r--WebCore/platform/network/ResourceRequestBase.cpp4
-rw-r--r--WebCore/platform/network/ResourceRequestBase.h2
-rw-r--r--WebCore/platform/network/ResourceResponseBase.h4
-rw-r--r--WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp3
-rw-r--r--WebCore/platform/network/cf/DNSCFNet.cpp1
-rw-r--r--WebCore/platform/network/chromium/CookieJarChromium.cpp5
-rw-r--r--WebCore/platform/network/chromium/ResourceRequest.h20
-rw-r--r--WebCore/platform/network/chromium/ResourceResponse.h10
-rw-r--r--WebCore/platform/network/curl/ResourceHandleCurl.cpp6
-rw-r--r--WebCore/platform/network/curl/ResourceHandleManager.cpp4
-rw-r--r--WebCore/platform/network/mac/ResourceHandleMac.mm11
-rw-r--r--WebCore/platform/network/qt/NetworkStateNotifierPrivate.h51
-rw-r--r--WebCore/platform/network/qt/NetworkStateNotifierQt.cpp90
-rw-r--r--WebCore/platform/network/qt/QNetworkReplyHandler.cpp43
-rw-r--r--WebCore/platform/network/qt/QNetworkReplyHandler.h1
-rw-r--r--WebCore/platform/network/qt/ResourceRequestQt.cpp16
-rw-r--r--WebCore/platform/network/qt/SocketStreamHandle.h4
-rw-r--r--WebCore/platform/network/qt/SocketStreamHandlePrivate.h (renamed from WebCore/platform/network/qt/SocketStreamHandleSoup.cpp)82
-rw-r--r--WebCore/platform/network/qt/SocketStreamHandleQt.cpp196
-rw-r--r--WebCore/platform/network/soup/ResourceHandleSoup.cpp8
23 files changed, 486 insertions, 100 deletions
diff --git a/WebCore/platform/network/CredentialStorage.cpp b/WebCore/platform/network/CredentialStorage.cpp
index a401751..2c78e3c 100644
--- a/WebCore/platform/network/CredentialStorage.cpp
+++ b/WebCore/platform/network/CredentialStorage.cpp
@@ -31,7 +31,8 @@
#include "KURL.h"
#include "ProtectionSpaceHash.h"
#include "StringHash.h"
-
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
diff --git a/WebCore/platform/network/NetworkStateNotifier.h b/WebCore/platform/network/NetworkStateNotifier.h
index d0463d4..77235b8 100644
--- a/WebCore/platform/network/NetworkStateNotifier.h
+++ b/WebCore/platform/network/NetworkStateNotifier.h
@@ -51,16 +51,28 @@ typedef const struct __SCDynamicStore * SCDynamicStoreRef;
namespace WebCore {
+#if (PLATFORM(QT) && ENABLE(QT_BEARER))
+class NetworkStateNotifierPrivate;
+#endif
+
class NetworkStateNotifier : public Noncopyable {
public:
NetworkStateNotifier();
void setNetworkStateChangedFunction(void (*)());
bool onLine() const { return m_isOnLine; }
+<<<<<<< HEAD
#if PLATFORM(ANDROID)
Connection::ConnectionType type() const { return m_type; }
#endif
+=======
+
+#if (PLATFORM(QT) && ENABLE(QT_BEARER))
+ void setNetworkAccessAllowed(bool);
+#endif
+
+>>>>>>> webkit.org at r54127
private:
bool m_isOnLine;
#if PLATFORM(ANDROID)
@@ -93,11 +105,18 @@ private:
#elif PLATFORM(ANDROID)
public:
void networkStateChange(bool online);
+<<<<<<< HEAD
void networkTypeChange(Connection::ConnectionType type);
+=======
+
+#elif PLATFORM(QT) && ENABLE(QT_BEARER)
+ friend class NetworkStateNotifierPrivate;
+ NetworkStateNotifierPrivate* p;
+>>>>>>> webkit.org at r54127
#endif
};
-#if !PLATFORM(MAC) && !PLATFORM(WIN) && !PLATFORM(CHROMIUM)
+#if !PLATFORM(MAC) && !PLATFORM(WIN) && !PLATFORM(CHROMIUM) && !(PLATFORM(QT) && ENABLE(QT_BEARER))
inline NetworkStateNotifier::NetworkStateNotifier()
: m_isOnLine(true)
diff --git a/WebCore/platform/network/ProtectionSpaceHash.h b/WebCore/platform/network/ProtectionSpaceHash.h
index f8c84e8..08716b5 100644
--- a/WebCore/platform/network/ProtectionSpaceHash.h
+++ b/WebCore/platform/network/ProtectionSpaceHash.h
@@ -27,6 +27,7 @@
#define ProtectionSpaceHash_h
#include "ProtectionSpace.h"
+#include <wtf/HashTraits.h>
namespace WebCore {
diff --git a/WebCore/platform/network/ResourceRequestBase.cpp b/WebCore/platform/network/ResourceRequestBase.cpp
index 41afb92..adf635c 100644
--- a/WebCore/platform/network/ResourceRequestBase.cpp
+++ b/WebCore/platform/network/ResourceRequestBase.cpp
@@ -390,7 +390,11 @@ void ResourceRequestBase::updateResourceRequest() const
m_resourceRequestUpdated = true;
}
+<<<<<<< HEAD
#if !PLATFORM(MAC) && !USE(CFNETWORK) && !USE(SOUP) && !PLATFORM(CHROMIUM) && !PLATFORM(ANDROID)
+=======
+#if !PLATFORM(MAC) && !USE(CFNETWORK) && !USE(SOUP) && !PLATFORM(CHROMIUM) && !PLATFORM(ANDROID) && !PLATFORM(QT)
+>>>>>>> webkit.org at r54127
unsigned initializeMaximumHTTPConnectionCountPerHost()
{
// This is used by the loader to control the number of issued parallel load requests.
diff --git a/WebCore/platform/network/ResourceRequestBase.h b/WebCore/platform/network/ResourceRequestBase.h
index 931a9de..adf8327 100644
--- a/WebCore/platform/network/ResourceRequestBase.h
+++ b/WebCore/platform/network/ResourceRequestBase.h
@@ -50,7 +50,7 @@ namespace WebCore {
struct CrossThreadResourceRequestData;
// Do not use this type directly. Use ResourceRequest instead.
- class ResourceRequestBase {
+ class ResourceRequestBase : public FastAllocBase {
public:
// The type of this ResourceRequest, based on how the resource will be used.
enum TargetType {
diff --git a/WebCore/platform/network/ResourceResponseBase.h b/WebCore/platform/network/ResourceResponseBase.h
index e06c6f8..bf197a7 100644
--- a/WebCore/platform/network/ResourceResponseBase.h
+++ b/WebCore/platform/network/ResourceResponseBase.h
@@ -38,7 +38,7 @@ class ResourceResponse;
struct CrossThreadResourceResponseData;
// Do not use this class directly, use the class ResponseResponse instead
-class ResourceResponseBase {
+class ResourceResponseBase : public FastAllocBase {
public:
static std::auto_ptr<ResourceResponse> adopt(std::auto_ptr<CrossThreadResourceResponseData>);
@@ -151,7 +151,7 @@ private:
inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); }
inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); }
-struct CrossThreadResourceResponseData {
+struct CrossThreadResourceResponseData : Noncopyable {
KURL m_url;
String m_mimeType;
long long m_expectedContentLength;
diff --git a/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp b/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp
index 3ade2ed..177ba75 100644
--- a/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp
+++ b/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp
@@ -39,6 +39,7 @@ void NetworkStateNotifier::networkStateChange(bool online)
m_networkStateChangedFunction();
}
+<<<<<<< HEAD
void NetworkStateNotifier::networkTypeChange(Connection::ConnectionType type)
{
if (m_type == type)
@@ -50,4 +51,6 @@ void NetworkStateNotifier::networkTypeChange(Connection::ConnectionType type)
m_networkStateChangedFunction();
}
+=======
+>>>>>>> webkit.org at r54127
}
diff --git a/WebCore/platform/network/cf/DNSCFNet.cpp b/WebCore/platform/network/cf/DNSCFNet.cpp
index 6311baf..c17b59f 100644
--- a/WebCore/platform/network/cf/DNSCFNet.cpp
+++ b/WebCore/platform/network/cf/DNSCFNet.cpp
@@ -29,6 +29,7 @@
#include "StringHash.h"
#include "Timer.h"
+#include <wtf/HashSet.h>
#include <wtf/RetainPtr.h>
#include <wtf/StdLibExtras.h>
diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp
index 279d9b0..35f1c3f 100644
--- a/WebCore/platform/network/chromium/CookieJarChromium.cpp
+++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp
@@ -47,10 +47,9 @@ String cookies(const Document* document, const KURL& url)
return ChromiumBridge::cookies(url, document->firstPartyForCookies());
}
-bool cookiesEnabled(const Document*)
+bool cookiesEnabled(const Document* document)
{
- // FIXME: For now just assume cookies are always on.
- return true;
+ return ChromiumBridge::cookiesEnabled(document->cookieURL(), document->firstPartyForCookies());
}
bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
diff --git a/WebCore/platform/network/chromium/ResourceRequest.h b/WebCore/platform/network/chromium/ResourceRequest.h
index 176f923..8ef0c5e 100644
--- a/WebCore/platform/network/chromium/ResourceRequest.h
+++ b/WebCore/platform/network/chromium/ResourceRequest.h
@@ -28,7 +28,6 @@
#ifndef ResourceRequest_h
#define ResourceRequest_h
-#include "CString.h"
#include "ResourceRequestBase.h"
namespace WebCore {
@@ -45,15 +44,6 @@ namespace WebCore {
{
}
- ResourceRequest(const KURL& url, const CString& securityInfo)
- : ResourceRequestBase(url, UseProtocolCachePolicy)
- , m_requestorID(0)
- , m_requestorProcessID(0)
- , m_appCacheHostID(0)
- , m_securityInfo(securityInfo)
- {
- }
-
ResourceRequest(const KURL& url)
: ResourceRequestBase(url, UseProtocolCachePolicy)
, m_requestorID(0)
@@ -94,15 +84,6 @@ namespace WebCore {
int appCacheHostID() const { return m_appCacheHostID; }
void setAppCacheHostID(int id) { m_appCacheHostID = id; }
- // Opaque buffer that describes the security state (including SSL
- // connection state) for the resource that should be reported when the
- // resource has been loaded. This is used to simulate secure
- // connection for request (typically when showing error page, so the
- // error page has the errors of the page that actually failed). Empty
- // string if not a secure connection.
- CString securityInfo() const { return m_securityInfo; }
- void setSecurityInfo(const CString& value) { m_securityInfo = value; }
-
private:
friend class ResourceRequestBase;
@@ -112,7 +93,6 @@ namespace WebCore {
int m_requestorID;
int m_requestorProcessID;
int m_appCacheHostID;
- CString m_securityInfo;
};
} // namespace WebCore
diff --git a/WebCore/platform/network/chromium/ResourceResponse.h b/WebCore/platform/network/chromium/ResourceResponse.h
index 0c2b5d9..1b9de04 100644
--- a/WebCore/platform/network/chromium/ResourceResponse.h
+++ b/WebCore/platform/network/chromium/ResourceResponse.h
@@ -38,6 +38,7 @@ namespace WebCore {
ResourceResponse()
: m_isContentFiltered(false)
, m_appCacheID(0)
+ , m_wasFetchedViaSPDY(false)
{
}
@@ -45,6 +46,7 @@ namespace WebCore {
: ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
, m_isContentFiltered(false)
, m_appCacheID(0)
+ , m_wasFetchedViaSPDY(false)
{
}
@@ -72,6 +74,12 @@ namespace WebCore {
m_appCacheManifestURL = url;
}
+ bool wasFetchedViaSPDY() const { return m_wasFetchedViaSPDY; }
+ void setWasFetchedViaSPDY(bool value)
+ {
+ m_wasFetchedViaSPDY = value;
+ }
+
private:
friend class ResourceResponseBase;
@@ -96,6 +104,8 @@ namespace WebCore {
// The manifest url of the appcache this response was retrieved from, if any.
// Note: only valid for main resource responses.
KURL m_appCacheManifestURL;
+
+ bool m_wasFetchedViaSPDY;
};
} // namespace WebCore
diff --git a/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
index 5464e07..81ac1a3 100644
--- a/WebCore/platform/network/curl/ResourceHandleCurl.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
@@ -156,7 +156,7 @@ void ResourceHandle::setDefersLoading(bool defers)
if (d->m_defersLoading == defers)
return;
-#if LIBCURL_VERSION_NUM > 0x071800
+#if LIBCURL_VERSION_NUM > 0x071200
if (!d->m_handle)
d->m_defersLoading = defers;
else if (defers) {
@@ -179,9 +179,7 @@ void ResourceHandle::setDefersLoading(bool defers)
}
#else
d->m_defersLoading = defers;
-#ifndef NDEBUG
- printf("Deferred loading is implemented if libcURL version is above 7.18.0");
-#endif
+ LOG_ERROR("Deferred loading is implemented if libcURL version is above 7.18.0");
#endif
}
diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp
index a006a14..bcae67f 100644
--- a/WebCore/platform/network/curl/ResourceHandleManager.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp
@@ -49,7 +49,7 @@
#include <wtf/Threading.h>
#include <wtf/Vector.h>
-#if !PLATFORM(WIN_OS)
+#if !OS(WINDOWS)
#include <sys/param.h>
#define MAX_PATH MAXPATHLEN
#endif
@@ -702,7 +702,7 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job)
d->m_handle = curl_easy_init();
-#if LIBCURL_VERSION_NUM > 0x071800
+#if LIBCURL_VERSION_NUM > 0x071200
if (d->m_defersLoading) {
CURLcode error = curl_easy_pause(d->m_handle, CURLPAUSE_ALL);
// If we did not pause the handle, we would ASSERT in the
diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm
index 360425e..923a631 100644
--- a/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -610,10 +610,15 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
// See <rdar://problem/5380697> . This is a workaround for a behavior change in CFNetwork where willSendRequest gets called more often.
if (!redirectResponse)
return newRequest;
-
- LOG(Network, "Handle %p delegate connection:%p willSendRequest:%@ redirectResponse:%p", m_handle, connection, [newRequest description], redirectResponse);
- if (redirectResponse && [redirectResponse isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse *)redirectResponse statusCode] == 307) {
+#if !LOG_DISABLED
+ if ([redirectResponse isKindOfClass:[NSHTTPURLResponse class]])
+ LOG(Network, "Handle %p delegate connection:%p willSendRequest:%@ redirectResponse:%d, Location:<%@>", m_handle, connection, [newRequest description], static_cast<int>([(id)redirectResponse statusCode]), [[(id)redirectResponse allHeaderFields] objectForKey:@"Location"]);
+ else
+ LOG(Network, "Handle %p delegate connection:%p willSendRequest:%@ redirectResponse:non-HTTP", m_handle, connection, [newRequest description]);
+#endif
+
+ if ([redirectResponse isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse *)redirectResponse statusCode] == 307) {
String originalMethod = m_handle->request().httpMethod();
if (!equalIgnoringCase(originalMethod, String([newRequest HTTPMethod]))) {
NSMutableURLRequest *mutableRequest = [newRequest mutableCopy];
diff --git a/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h b/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
new file mode 100644
index 0000000..536b06a
--- /dev/null
+++ b/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef NetworkStateNotifierPrivate_h
+#define NetworkStateNotifierPrivate_h
+
+#include <QObject>
+
+namespace QtMobility {
+class QNetworkConfigurationManager;
+}
+
+namespace WebCore {
+
+class NetworkStateNotifier;
+
+class NetworkStateNotifierPrivate : public QObject {
+ Q_OBJECT
+public:
+ NetworkStateNotifierPrivate(NetworkStateNotifier* notifier);
+ ~NetworkStateNotifierPrivate();
+public slots:
+ void onlineStateChanged(bool);
+ void networkAccessPermissionChanged(bool);
+
+public:
+ QtMobility::QNetworkConfigurationManager* m_configurationManager;
+ bool m_online;
+ bool m_networkAccessAllowed;
+ NetworkStateNotifier* m_notifier;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
new file mode 100644
index 0000000..e694264
--- /dev/null
+++ b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "NetworkStateNotifier.h"
+
+#include "NetworkStateNotifierPrivate.h"
+#include "qnetworkconfigmanager.h"
+
+using namespace QtMobility;
+
+namespace WebCore {
+
+NetworkStateNotifierPrivate::NetworkStateNotifierPrivate(NetworkStateNotifier* notifier)
+ : m_configurationManager(new QNetworkConfigurationManager())
+ , m_online(m_configurationManager->isOnline())
+ , m_networkAccessAllowed(true)
+ , m_notifier(notifier)
+{
+ Q_ASSERT(notifier);
+ connect(m_configurationManager, SIGNAL(onlineStateChanged(bool)), this, SLOT(onlineStateChanged(bool)));
+}
+
+void NetworkStateNotifierPrivate::onlineStateChanged(bool isOnline)
+{
+ if (m_online == isOnline)
+ return;
+
+ m_online = isOnline;
+ if (m_networkAccessAllowed)
+ m_notifier->updateState();
+}
+
+void NetworkStateNotifierPrivate::networkAccessPermissionChanged(bool isAllowed)
+{
+ if (isAllowed == m_networkAccessAllowed)
+ return;
+
+ m_networkAccessAllowed = isAllowed;
+ if (m_online)
+ m_notifier->updateState();
+}
+
+NetworkStateNotifierPrivate::~NetworkStateNotifierPrivate()
+{
+ delete m_configurationManager;
+}
+
+void NetworkStateNotifier::updateState()
+{
+ if (m_isOnLine == (p->m_online && p->m_networkAccessAllowed))
+ return;
+
+ m_isOnLine = p->m_online && p->m_networkAccessAllowed;
+ if (m_networkStateChangedFunction)
+ m_networkStateChangedFunction();
+}
+
+NetworkStateNotifier::NetworkStateNotifier()
+ : m_isOnLine(true)
+ , m_networkStateChangedFunction(0)
+{
+ p = new NetworkStateNotifierPrivate(this);
+ m_isOnLine = p->m_online && p->m_networkAccessAllowed;
+}
+
+void NetworkStateNotifier::setNetworkAccessAllowed(bool isAllowed)
+{
+ p->networkAccessPermissionChanged(isAllowed);
+}
+
+} // namespace WebCore
+
+#include "moc_NetworkStateNotifierPrivate.cpp"
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index f7bbb9d..559ef84 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -38,6 +38,16 @@
#include <QDebug>
#include <QCoreApplication>
+// What type of connection should be used for the signals of the
+// QNetworkReply? This depends on if Qt has a bugfix for this or not.
+// It is fixed in Qt 4.6.1. See https://bugs.webkit.org/show_bug.cgi?id=32113
+#if QT_VERSION > QT_VERSION_CHECK(4, 6, 0)
+#define SIGNAL_CONN Qt::DirectConnection
+#else
+#define SIGNAL_CONN Qt::QueuedConnection
+#endif
+
+
namespace WebCore {
// Take a deep copy of the FormDataElement
@@ -320,6 +330,8 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
QUrl redirection = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
if (redirection.isValid()) {
+ m_redirected = true;
+
QUrl newUrl = m_reply->url().resolved(redirection);
ResourceRequest newRequest = m_resourceHandle->request();
newRequest.setURL(newUrl);
@@ -334,7 +346,9 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
newRequest.clearHTTPReferrer();
client->willSendRequest(m_resourceHandle, newRequest, response);
- m_redirected = true;
+ if (!m_resourceHandle) // network error did cancel the request
+ return;
+
m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
return;
}
@@ -369,6 +383,18 @@ void QNetworkReplyHandler::forwardData()
}
}
+void QNetworkReplyHandler::uploadProgress(qint64 bytesSent, qint64 bytesTotal)
+{
+ if (!m_resourceHandle)
+ return;
+
+ ResourceHandleClient* client = m_resourceHandle->client();
+ if (!client)
+ return;
+
+ client->didSendData(m_resourceHandle, bytesSent, bytesTotal);
+}
+
void QNetworkReplyHandler::start()
{
m_shouldStart = false;
@@ -427,18 +453,25 @@ void QNetworkReplyHandler::start()
m_reply->setParent(this);
connect(m_reply, SIGNAL(finished()),
- this, SLOT(finish()), Qt::QueuedConnection);
+ this, SLOT(finish()), SIGNAL_CONN);
// For http(s) we know that the headers are complete upon metaDataChanged() emission, so we
// can send the response as early as possible
if (scheme == QLatin1String("http") || scheme == QLatin1String("https"))
connect(m_reply, SIGNAL(metaDataChanged()),
- this, SLOT(sendResponseIfNeeded()), Qt::QueuedConnection);
+ this, SLOT(sendResponseIfNeeded()), SIGNAL_CONN);
connect(m_reply, SIGNAL(readyRead()),
- this, SLOT(forwardData()), Qt::QueuedConnection);
+ this, SLOT(forwardData()), SIGNAL_CONN);
+
+ if (m_resourceHandle->request().reportUploadProgress()) {
+ connect(m_reply, SIGNAL(uploadProgress(qint64, qint64)),
+ this, SLOT(uploadProgress(qint64, qint64)), SIGNAL_CONN);
+ }
+
+ // Make this a direct function call once we require 4.6.1+.
connect(this, SIGNAL(processQueuedItems()),
- this, SLOT(sendQueuedItems()), Qt::QueuedConnection);
+ this, SLOT(sendQueuedItems()), SIGNAL_CONN);
}
void QNetworkReplyHandler::resetState()
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.h b/WebCore/platform/network/qt/QNetworkReplyHandler.h
index 2171083..eb5ae3c 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.h
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.h
@@ -62,6 +62,7 @@ private slots:
void sendResponseIfNeeded();
void forwardData();
void sendQueuedItems();
+ void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
private:
void start();
diff --git a/WebCore/platform/network/qt/ResourceRequestQt.cpp b/WebCore/platform/network/qt/ResourceRequestQt.cpp
index 752abfe..341e6ae 100644
--- a/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -27,6 +27,20 @@
namespace WebCore {
+// Currently Qt allows three connections per host on symbian and six
+// for everyone else. The limit can be found in qhttpnetworkconnection.cpp.
+// To achieve the best result we want WebKit to schedule the jobs so we
+// are using the limit as found in Qt. To allow Qt to fill its queue
+// and prepare jobs we will schedule two more downloads.
+unsigned initializeMaximumHTTPConnectionCountPerHost()
+{
+#ifdef Q_OS_SYMBIAN
+ return 3 + 2;
+#else
+ return 6 + 2;
+#endif
+}
+
QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) const
{
QNetworkRequest request;
diff --git a/WebCore/platform/network/qt/SocketStreamHandle.h b/WebCore/platform/network/qt/SocketStreamHandle.h
index 64139e5..5c55749 100644
--- a/WebCore/platform/network/qt/SocketStreamHandle.h
+++ b/WebCore/platform/network/qt/SocketStreamHandle.h
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2010 Nokia Inc. All rights reserved.
* Copyright (C) 2009 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
*
@@ -42,6 +43,7 @@ namespace WebCore {
class AuthenticationChallenge;
class Credential;
class SocketStreamHandleClient;
+ class SocketStreamHandlePrivate;
class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase {
public:
@@ -61,6 +63,8 @@ namespace WebCore {
void receivedCredential(const AuthenticationChallenge&, const Credential&);
void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
void receivedCancellation(const AuthenticationChallenge&);
+ SocketStreamHandlePrivate* m_p;
+ friend class SocketStreamHandlePrivate;
};
} // namespace WebCore
diff --git a/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
index 6aa33fc..9433d3f 100644
--- a/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp
+++ b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,61 +28,43 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "SocketStreamHandle.h"
+#ifndef SocketStreamHandlePrivate_h
+#define SocketStreamHandlePrivate_h
-#include "KURL.h"
-#include "Logging.h"
-#include "NotImplemented.h"
-#include "SocketStreamHandleClient.h"
+#include "SocketStreamHandleBase.h"
-namespace WebCore {
-
-SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
- : SocketStreamHandleBase(url, client)
-{
- LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);
- notImplemented();
-}
-
-SocketStreamHandle::~SocketStreamHandle()
-{
- LOG(Network, "SocketStreamHandle %p delete", this);
- setClient(0);
- notImplemented();
-}
-
-int SocketStreamHandle::platformSend(const char*, int)
-{
- LOG(Network, "SocketStreamHandle %p platformSend", this);
- notImplemented();
- return 0;
-}
+#include <QSslSocket>
+#include <QTcpSocket>
-void SocketStreamHandle::platformClose()
-{
- LOG(Network, "SocketStreamHandle %p platformClose", this);
- notImplemented();
-}
+namespace WebCore {
-void SocketStreamHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge&)
-{
- notImplemented();
-}
+class AuthenticationChallenge;
+class Credential;
+class SocketStreamHandleClient;
+class SocketStreamHandlePrivate;
-void SocketStreamHandle::receivedCredential(const AuthenticationChallenge&, const Credential&)
-{
- notImplemented();
-}
+class SocketStreamHandlePrivate : public QObject {
+ Q_OBJECT
+public:
+ SocketStreamHandlePrivate(SocketStreamHandle*, const KURL&);
+ ~SocketStreamHandlePrivate();
-void SocketStreamHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&)
-{
- notImplemented();
-}
+public slots:
+ void socketConnected();
+ void socketReadyRead();
+ int send(const char* data, int len);
+ void close();
+ void socketSentdata();
+ void socketClosed();
+ void socketError(QAbstractSocket::SocketError);
+ void socketClosedCallback();
+ void socketErrorCallback(int);
+ void socketSslErrors(const QList<QSslError>&);
+public:
+ QTcpSocket* m_socket;
+ SocketStreamHandle* m_streamHandle;
+};
-void SocketStreamHandle::receivedCancellation(const AuthenticationChallenge&)
-{
- notImplemented();
}
-} // namespace WebCore
+#endif
diff --git a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
new file mode 100644
index 0000000..d61d901
--- /dev/null
+++ b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2010 Nokia Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "SocketStreamHandle.h"
+
+#include "KURL.h"
+#include "Logging.h"
+#include "NotImplemented.h"
+#include "SocketStreamHandleClient.h"
+#include "SocketStreamHandlePrivate.h"
+
+namespace WebCore {
+
+SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamHandle, const KURL& url) : QObject()
+{
+ m_streamHandle = streamHandle;
+ m_socket = 0;
+ bool isSecure = url.protocolIs("wss");
+ if (isSecure)
+ m_socket = new QSslSocket(this);
+ else
+ m_socket = new QTcpSocket(this);
+ connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected()));
+ connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
+ connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketClosed()));
+ connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
+ if (isSecure)
+ connect(m_socket, SIGNAL(sslErrors(const QList<QSslError>&)), this, SLOT(socketSslErrors(const QList<QSslError>&)));
+
+ unsigned int port = url.hasPort() ? url.port() : (isSecure ? 443 : 80);
+
+ QString host = url.host();
+ if (isSecure)
+ static_cast<QSslSocket*>(m_socket)->connectToHostEncrypted(host, port);
+ else
+ m_socket->connectToHost(host, port);
+}
+
+SocketStreamHandlePrivate::~SocketStreamHandlePrivate()
+{
+ Q_ASSERT(!(m_socket && m_socket->state() == QAbstractSocket::ConnectedState));
+}
+
+void SocketStreamHandlePrivate::socketConnected()
+{
+ if (m_streamHandle && m_streamHandle->client()) {
+ m_streamHandle->m_state = SocketStreamHandleBase::Open;
+ m_streamHandle->client()->didOpen(m_streamHandle);
+ }
+}
+
+void SocketStreamHandlePrivate::socketReadyRead()
+{
+ if (m_streamHandle && m_streamHandle->client()) {
+ QByteArray data = m_socket->read(m_socket->bytesAvailable());
+ m_streamHandle->client()->didReceiveData(m_streamHandle, data.constData(), data.size());
+ }
+}
+
+int SocketStreamHandlePrivate::send(const char* data, int len)
+{
+ if (m_socket->state() != QAbstractSocket::ConnectedState)
+ return 0;
+ quint64 sentSize = m_socket->write(data, len);
+ QMetaObject::invokeMethod(this, "socketSentData", Qt::QueuedConnection);
+ return sentSize;
+}
+
+void SocketStreamHandlePrivate::close()
+{
+ if (m_socket && m_socket->state() == QAbstractSocket::ConnectedState)
+ m_socket->close();
+}
+
+void SocketStreamHandlePrivate::socketSentdata()
+{
+ if (m_streamHandle)
+ m_streamHandle->sendPendingData();
+}
+
+void SocketStreamHandlePrivate::socketClosed()
+{
+ QMetaObject::invokeMethod(this, "socketClosedCallback", Qt::QueuedConnection);
+}
+
+void SocketStreamHandlePrivate::socketError(QAbstractSocket::SocketError error)
+{
+ QMetaObject::invokeMethod(this, "socketErrorCallback", Qt::QueuedConnection, Q_ARG(int, error));
+}
+
+void SocketStreamHandlePrivate::socketClosedCallback()
+{
+ if (m_streamHandle && m_streamHandle->client()) {
+ SocketStreamHandle* streamHandle = m_streamHandle;
+ m_streamHandle = 0;
+ // This following call deletes _this_. Nothing should be after it.
+ streamHandle->client()->didClose(streamHandle);
+ }
+}
+
+void SocketStreamHandlePrivate::socketErrorCallback(int error)
+{
+ // FIXME - in the future, we might not want to treat all errors as fatal.
+ if (m_streamHandle && m_streamHandle->client()) {
+ SocketStreamHandle* streamHandle = m_streamHandle;
+ m_streamHandle = 0;
+ // This following call deletes _this_. Nothing should be after it.
+ streamHandle->client()->didClose(streamHandle);
+ }
+}
+
+void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>&)
+{
+ // FIXME: based on http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-68#page-15
+ // we should abort on certificate errors.
+ // We don't abort while this is still work in progress.
+ static_cast<QSslSocket*>(m_socket)->ignoreSslErrors();
+}
+SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
+ : SocketStreamHandleBase(url, client)
+{
+ LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);
+ m_p = new SocketStreamHandlePrivate(this, url);
+}
+
+SocketStreamHandle::~SocketStreamHandle()
+{
+ LOG(Network, "SocketStreamHandle %p delete", this);
+ setClient(0);
+ delete m_p;
+}
+
+int SocketStreamHandle::platformSend(const char* data, int len)
+{
+ LOG(Network, "SocketStreamHandle %p platformSend", this);
+ return m_p->send(data, len);
+}
+
+void SocketStreamHandle::platformClose()
+{
+ LOG(Network, "SocketStreamHandle %p platformClose", this);
+ m_p->close();
+}
+
+void SocketStreamHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+void SocketStreamHandle::receivedCredential(const AuthenticationChallenge&, const Credential&)
+{
+ notImplemented();
+}
+
+void SocketStreamHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+void SocketStreamHandle::receivedCancellation(const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
+
+#include "moc_SocketStreamHandlePrivate.cpp"
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index 6367a3e..da16f4a 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -548,12 +548,6 @@ static bool startHttp(ResourceHandle* handle)
// balanced by a deref() in finishedCallback, which should always run
handle->ref();
- // FIXME: For now, we cannot accept content encoded in anything
- // other than identity, so force servers to do it our way. When
- // libsoup gets proper Content-Encoding support we will want to
- // use it here instead.
- soup_message_headers_replace(d->m_msg->request_headers, "Accept-Encoding", "identity");
-
// Balanced in ResourceHandleInternal's destructor; we need to
// keep our own ref, because after queueing the message, the
// session owns the initial reference.
@@ -882,7 +876,7 @@ static bool startGio(ResourceHandle* handle, KURL url)
url.setQuery(String());
url.removePort();
-#if !PLATFORM(WIN_OS)
+#if !OS(WINDOWS)
// we avoid the escaping for local files, because
// g_filename_from_uri (used internally by GFile) has problems
// decoding strings with arbitrary percent signs