summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorSami Lempinen <sami.lempinen@nokia.com>2011-10-14 06:18:15 (GMT)
committerSami Lempinen <sami.lempinen@nokia.com>2011-10-14 06:18:15 (GMT)
commit01057867c3e5e97fc8b58601e3cee6dfef0df205 (patch)
tree96125e444f32691c73bc87f0bc938993b7737899 /src/network
parent138b9d7349d5daa1808d8bd891c5ecf817f98c52 (diff)
parent77563a2e63562e4e010e53dd79a707d9d7ed3f3d (diff)
downloadQt-01057867c3e5e97fc8b58601e3cee6dfef0df205.zip
Qt-01057867c3e5e97fc8b58601e3cee6dfef0df205.tar.gz
Qt-01057867c3e5e97fc8b58601e3cee6dfef0df205.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h2
-rw-r--r--src/network/access/qnetworkcookie.cpp18
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp23
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h2
-rw-r--r--src/network/kernel/qhostinfo_win.cpp5
5 files changed, 29 insertions, 21 deletions
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index ff05306..7f6aff9 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -110,9 +110,7 @@ public:
// socket).
virtual void open() = 0;
-#ifndef QT_NO_BEARERMANAGEMENT
virtual bool start();
-#endif
virtual void closeDownstreamChannel() = 0;
// slot-like:
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 0670738..a9bb318 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -372,7 +372,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
// parse the first part, before the equal sign
for (i = position; i < length; ++i) {
register char c = text.at(i);
- if (c == ';' || c == ',' || c == '=')
+ if (c == ';' || c == '=')
break;
}
@@ -423,7 +423,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
for ( ; i < length; ++i) {
register char c = text.at(i);
- if (c == ',' || c == ';')
+ if (c == ';')
break;
}
position = i;
@@ -434,7 +434,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
register char c = text.at(i);
// for name value pairs, we want to parse until reaching the next ';'
// and not break when reaching a space char
- if (c == ',' || c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c))))
+ if (c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c))))
break;
}
@@ -461,8 +461,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
\value Full makes toRawForm() return the full
cookie contents, as suitable for sending to a client in a
- server's "Set-Cookie:" header. Multiple cookies are separated
- by commas in a "Set-Cookie:" header.
+ server's "Set-Cookie:" header.
Note that only the Full form of the cookie can be parsed back into
its original contents.
@@ -488,7 +487,6 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const
result = d->name;
result += '=';
if ((d->value.contains(';') ||
- d->value.contains(',') ||
d->value.contains('"')) &&
(!d->value.startsWith('"') &&
!d->value.endsWith('"'))) {
@@ -967,14 +965,8 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt
cookie.setValue(field.second);
position = nextNonWhitespace(cookieString, position);
- bool endOfCookie = false;
- while (!endOfCookie && position < length) {
+ while (position < length) {
switch (cookieString.at(position++)) {
- case ',':
- // end of the cookie
- endOfCookie = true;
- break;
-
case ';':
// new field in the cookie
field = nextField(cookieString, position, false);
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 0b568d4..6f2daec 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -471,6 +471,7 @@ bool QNetworkReplyImplPrivate::isCachingEnabled() const
void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
{
+ Q_Q(QNetworkReplyImpl);
if (!enable && !cacheEnabled)
return; // nothing to do
if (enable && cacheEnabled)
@@ -493,15 +494,27 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
+ QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed()));
}
}
+void QNetworkReplyImplPrivate::_q_cacheDestroyed()
+{
+ //destruction of cache invalidates cacheSaveDevice
+ cacheSaveDevice = 0;
+ cacheEnabled = false;
+}
+
void QNetworkReplyImplPrivate::completeCacheSave()
{
- if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) {
- networkCache()->remove(url);
- } else if (cacheEnabled && cacheSaveDevice) {
- networkCache()->insert(cacheSaveDevice);
+ Q_Q(QNetworkReplyImpl);
+ if (cacheEnabled) {
+ if (errorCode != QNetworkReplyImpl::NoError) {
+ networkCache()->remove(url);
+ } else if (cacheSaveDevice) {
+ networkCache()->insert(cacheSaveDevice);
+ }
+ QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed()));
}
cacheSaveDevice = 0;
cacheEnabled = false;
@@ -561,6 +574,8 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice()
networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
+ } else {
+ q->connect(networkCache(), SIGNAL(destroyed()), SLOT(_q_cacheDestroyed()));
}
}
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 089c87e..286d8ea 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -104,6 +104,7 @@ public:
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
#endif
+ Q_PRIVATE_SLOT(d_func(), void _q_cacheDestroyed())
};
class QNetworkReplyImplPrivate: public QNetworkReplyPrivate
@@ -140,6 +141,7 @@ public:
void _q_networkSessionConnected();
void _q_networkSessionFailed();
#endif
+ void _q_cacheDestroyed();
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
QIODevice *outgoingData);
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 6fc5b7b..1052863 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -97,14 +97,15 @@ static void resolveLibrary()
#if defined(Q_OS_WINCE)
#include <qmutex.h>
-QMutex qPrivCEMutex;
+Q_GLOBAL_STATIC(QMutex, qPrivCEMutex)
#endif
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
{
#if defined(Q_OS_WINCE)
- QMutexLocker locker(&qPrivCEMutex);
+ QMutexLocker locker(qPrivCEMutex());
#endif
+
QWindowsSockInit winSock;
// Load res_init on demand.