diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 9 | ||||
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 2 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 6 | ||||
-rw-r--r-- | src/network/ssl/qsslcertificate.cpp | 23 |
4 files changed, 34 insertions, 6 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 42c64fb..837cf66 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -464,6 +464,15 @@ QNetworkAccessManager::~QNetworkAccessManager() #ifndef QT_NO_NETWORKPROXY delete d_func()->proxyFactory; #endif + + // Delete the QNetworkReply children first. + // Else a QAbstractNetworkCache might get deleted in ~QObject + // before a QNetworkReply that accesses the QAbstractNetworkCache + // object in its destructor. + qDeleteAll(findChildren<QNetworkReply *>()); + // The other children will be deleted in this ~QObject + // FIXME instead of this "hack" make the QNetworkReplyImpl + // properly watch the cache deletion, e.g. via a QWeakPointer. } #ifndef QT_NO_NETWORKPROXY diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 865d338..d1bdd57 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -991,6 +991,8 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt } QString normalizedDomain = QUrl::fromAce(QUrl::toAce(QString::fromUtf8(rawDomain))); + if (normalizedDomain.isEmpty() && !rawDomain.isEmpty()) + return result; cookie.setDomain(maybeLeadingDot + normalizedDomain); } else if (field.first == "max-age") { bool ok = false; diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 471927a..5d4274f 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -483,8 +483,10 @@ void QNetworkConfigurationManagerPrivate::pollEngines() QMutexLocker locker(&mutex); for (int i = 0; i < sessionEngines.count(); ++i) { - if ((forcedPolling && sessionEngines.at(i)->requiresPolling()) || - sessionEngines.at(i)->configurationsInUse()) { + if (!sessionEngines.at(i)->requiresPolling()) + continue; + + if (forcedPolling || sessionEngines.at(i)->configurationsInUse()) { pollingEngines.insert(i); QMetaObject::invokeMethod(sessionEngines.at(i), "requestUpdate"); } diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index fd647e2..31c5ed1 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -259,13 +259,28 @@ QByteArray QSslCertificate::version() const /*! Returns the certificate's serial number string in decimal format. + In case the serial number cannot be converted to decimal format + (i.e. if it is bigger than 4294967295, which means it does not fit into 4 bytes), + its hexadecimal version is returned. */ QByteArray QSslCertificate::serialNumber() const { - if (d->serialNumberString.isEmpty() && d->x509) - d->serialNumberString = - QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber))); - + if (d->serialNumberString.isEmpty() && d->x509) { + ASN1_INTEGER *serialNumber = d->x509->cert_info->serialNumber; + // if we cannot convert to a long, just output the hexadecimal number + if (serialNumber->length > 4) { + QByteArray hexString; + hexString.reserve(serialNumber->length * 3); + for (int a = 0; a < serialNumber->length; ++a) { + hexString += QByteArray::number(serialNumber->data[a], 16).rightJustified(2, '0'); + hexString += ':'; + } + hexString.chop(1); + d->serialNumberString = hexString; + } else { + d->serialNumberString = QByteArray::number(qlonglong(q_ASN1_INTEGER_get(serialNumber))); + } + } return d->serialNumberString; } |