From 2916b0749902ee51a3deab982e53189e72c3b693 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 23 Aug 2010 09:07:11 +0200 Subject: Added encoding conversion functions to QStringRef. Reviewed-by: Olivier Goffart --- src/corelib/tools/qstring.cpp | 160 ++++++++++++++++++++++++++++++------- src/corelib/tools/qstring.h | 6 ++ tests/auto/qstring/tst_qstring.cpp | 66 +++++++++++++++ 3 files changed, 203 insertions(+), 29 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 7ea9877..de45a63 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -927,6 +927,24 @@ QString QString::fromWCharArray(const wchar_t *string, int size) \sa utf16(), toAscii(), toLatin1(), toUtf8(), toLocal8Bit() */ +template int toUcs4_helper(const unsigned short *uc, int length, T *out) +{ + int i = 0; + for (; i < length; ++i) { + uint u = uc[i]; + if (QChar::isHighSurrogate(u) && i < length-1) { + ushort low = uc[i+1]; + if (QChar::isLowSurrogate(low)) { + ++i; + u = QChar::surrogateToUcs4(u, low); + } + } + *out = T(u); + ++out; + } + return i; +} + /*! \since 4.2 @@ -951,21 +969,7 @@ int QString::toWCharArray(wchar_t *array) const memcpy(array, utf16(), sizeof(wchar_t)*length()); return length(); } else { - wchar_t *a = array; - const unsigned short *uc = utf16(); - for (int i = 0; i < length(); ++i) { - uint u = uc[i]; - if (QChar::isHighSurrogate(u) && i + 1 < length()) { - ushort low = uc[i+1]; - if (QChar::isLowSurrogate(low)) { - u = QChar::surrogateToUcs4(u, low); - ++i; - } - } - *a = wchar_t(u); - ++a; - } - return a - array; + return toUcs4_helper(utf16(), length(), array); } } @@ -3709,20 +3713,8 @@ QVector QString::toUcs4() const { QVector v(length()); uint *a = v.data(); - const unsigned short *uc = utf16(); - for (int i = 0; i < length(); ++i) { - uint u = uc[i]; - if (QChar(u).isHighSurrogate() && i < length()-1) { - ushort low = uc[i+1]; - if (QChar(low).isLowSurrogate()) { - ++i; - u = QChar::surrogateToUcs4(u, low); - } - } - *a = u; - ++a; - } - v.resize(a - v.data()); + int len = toUcs4_helper(utf16(), length(), a); + v.resize(len); return v; } @@ -8961,4 +8953,114 @@ static inline bool qt_ends_with(const QChar *haystack, int haystackLen, return true; } +/*! + \since 4.8 + + Returns a Latin-1 representation of the string as a QByteArray. + + The returned byte array is undefined if the string contains non-Latin1 + characters. Those characters may be suppressed or replaced with a + question mark. + + \sa toAscii(), toUtf8(), toLocal8Bit(), QTextCodec +*/ +QByteArray QStringRef::toLatin1() const +{ + return toLatin1_helper(unicode(), length()); +} + +/*! + \since 4.8 + + Returns an 8-bit representation of the string as a QByteArray. + + If a codec has been set using QTextCodec::setCodecForCStrings(), + it is used to convert Unicode to 8-bit char; otherwise this + function does the same as toLatin1(). + + Note that, despite the name, this function does not necessarily return an US-ASCII + (ANSI X3.4-1986) string and its result may not be US-ASCII compatible. + + \sa toLatin1(), toUtf8(), toLocal8Bit(), QTextCodec +*/ +QByteArray QStringRef::toAscii() const +{ +#ifndef QT_NO_TEXTCODEC + if (QString::codecForCStrings) + return QString::codecForCStrings->fromUnicode(unicode(), length()); +#endif // QT_NO_TEXTCODEC + return toLatin1(); +} + +/*! + \since 4.8 + + Returns the local 8-bit representation of the string as a + QByteArray. The returned byte array is undefined if the string + contains characters not supported by the local 8-bit encoding. + + QTextCodec::codecForLocale() is used to perform the conversion from + Unicode. If the locale encoding could not be determined, this function + does the same as toLatin1(). + + If this string contains any characters that cannot be encoded in the + locale, the returned byte array is undefined. Those characters may be + suppressed or replaced by another. + + \sa toAscii(), toLatin1(), toUtf8(), QTextCodec +*/ +QByteArray QStringRef::toLocal8Bit() const +{ +#ifndef QT_NO_TEXTCODEC + if (QTextCodec::codecForLocale()) + return QTextCodec::codecForLocale()->fromUnicode(unicode(), length()); +#endif // QT_NO_TEXTCODEC + return toLatin1(); +} + +/*! + \since 4.8 + + Returns a UTF-8 representation of the string as a QByteArray. + + UTF-8 is a Unicode codec and can represent all characters in a Unicode + string like QString. + + However, in the Unicode range, there are certain codepoints that are not + considered characters. The Unicode standard reserves the last two + codepoints in each Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, + U+2FFFE, etc.), as well as 16 codepoints in the range U+FDD0..U+FDDF, + inclusive, as non-characters. If any of those appear in the string, they + may be discarded and will not appear in the UTF-8 representation, or they + may be replaced by one or more replacement characters. + + \sa toAscii(), toLatin1(), toLocal8Bit(), QTextCodec +*/ +QByteArray QStringRef::toUtf8() const +{ + if (isNull()) + return QByteArray(); + + return QUtf8::convertFromUnicode(constData(), length(), 0); +} + +/*! + \since 4.8 + + Returns a UCS-4/UTF-32 representation of the string as a QVector. + + UCS-4 is a Unicode codec and is lossless. All characters from this string + can be encoded in UCS-4. + + \sa fromUtf8(), toAscii(), toLatin1(), toLocal8Bit(), QTextCodec, fromUcs4(), toWCharArray() +*/ +QVector QStringRef::toUcs4() const +{ + QVector v(length()); + uint *a = v.data(); + int len = toUcs4_helper(reinterpret_cast(unicode()), length(), a); + v.resize(len); + return v; +} + QT_END_NAMESPACE diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 7f7e475..2252353 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -1161,6 +1161,12 @@ public: inline const QChar *data() const { return unicode(); } inline const QChar *constData() const { return unicode(); } + QByteArray toAscii() const Q_REQUIRED_RESULT; + QByteArray toLatin1() const Q_REQUIRED_RESULT; + QByteArray toUtf8() const Q_REQUIRED_RESULT; + QByteArray toLocal8Bit() const Q_REQUIRED_RESULT; + QVector toUcs4() const Q_REQUIRED_RESULT; + inline void clear() { m_string = 0; m_position = m_size = 0; } QString toString() const; inline bool isEmpty() const { return m_size == 0; } diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index a3f7f15..af6b371 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -174,6 +174,12 @@ private slots: void fromLatin1Roundtrip(); void toLatin1Roundtrip_data(); void toLatin1Roundtrip(); + void stringRef_toLatin1Roundtrip_data(); + void stringRef_toLatin1Roundtrip(); + void stringRef_utf8_data(); + void stringRef_utf8(); + void stringRef_local8Bit_data(); + void stringRef_local8Bit(); void fromLatin1(); void fromAscii(); void arg(); @@ -3128,6 +3134,20 @@ void tst_QString::utf8() QCOMPARE( utf8, QByteArray(res.toUtf8()) ); } +void tst_QString::stringRef_utf8_data() +{ + utf8_data(); +} + +void tst_QString::stringRef_utf8() +{ + QFETCH( QByteArray, utf8 ); + QFETCH( QString, res ); + + QStringRef ref(&res, 0, res.length()); + QCOMPARE( utf8, QByteArray(ref.toUtf8()) ); +} + // copied to tst_QTextCodec::utf8Codec_data() void tst_QString::fromUtf8_data() { @@ -3307,6 +3327,20 @@ void tst_QString::local8Bit() QCOMPARE(local8Bit.toLocal8Bit(), QByteArray(result)); } +void tst_QString::stringRef_local8Bit_data() +{ + local8Bit_data(); +} + +void tst_QString::stringRef_local8Bit() +{ + QFETCH(QString, local8Bit); + QFETCH(QByteArray, result); + + QStringRef ref(&local8Bit, 0, local8Bit.length()); + QCOMPARE(ref.toLocal8Bit(), QByteArray(result)); +} + void tst_QString::fromLatin1Roundtrip_data() { QTest::addColumn("latin1"); @@ -3410,6 +3444,38 @@ void tst_QString::toLatin1Roundtrip() QCOMPARE(QString::fromLatin1(latin1, latin1.length()), unicodedst); } +void tst_QString::stringRef_toLatin1Roundtrip_data() +{ + toLatin1Roundtrip_data(); +} + +void tst_QString::stringRef_toLatin1Roundtrip() +{ + QFETCH(QByteArray, latin1); + QFETCH(QString, unicodesrc); + QFETCH(QString, unicodedst); + + // QtTest safety check: + Q_ASSERT(latin1.isNull() == unicodesrc.isNull()); + Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty()); + Q_ASSERT(latin1.length() == unicodesrc.length()); + Q_ASSERT(latin1.isNull() == unicodedst.isNull()); + Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty()); + Q_ASSERT(latin1.length() == unicodedst.length()); + + if (!latin1.isEmpty()) + while (latin1.length() < 128) { + latin1 += latin1; + unicodesrc += unicodesrc; + unicodedst += unicodedst; + } + + // toLatin1 + QStringRef src(&unicodesrc, 0, unicodesrc.length()); + QCOMPARE(src.toLatin1().length(), latin1.length()); + QCOMPARE(src.toLatin1(), latin1); +} + void tst_QString::fromLatin1() { QString a; -- cgit v0.12 From 1ed1079ad84c093101a6ad97ef49635ca12f7c08 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 23 Aug 2010 09:10:28 +0200 Subject: A few tiny improvements to the QDeclarativeXMLHTTPRequest. Just make use of the new api that was added in previous commits. Reviewed-by: Olivier Goffart --- src/declarative/qml/qdeclarativexmlhttprequest.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp index 8c97e29..ef2798c 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp +++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp @@ -1080,10 +1080,9 @@ QString QDeclarativeXMLHttpRequest::headers() foreach (const HeaderPair &header, m_headersList) { if (ret.length()) - ret.append(QString::fromUtf8("\r\n")); - ret.append(QString::fromUtf8(header.first)); - ret.append(QString::fromUtf8(": ")); - ret.append(QString::fromUtf8(header.second)); + ret.append(QLatin1String("\r\n")); + ret = ret % QString::fromUtf8(header.first) % QLatin1String(": ") + % QString::fromUtf8(header.second); } return ret; } @@ -1095,8 +1094,8 @@ void QDeclarativeXMLHttpRequest::fillHeadersList() m_headersList.clear(); foreach (const QByteArray &header, headerList) { HeaderPair pair (header.toLower(), m_network->rawHeader(header)); - if (pair.first == "set-cookie" || - pair.first == "set-cookie2") + if (pair.first == "set-cookie" || + pair.first == "set-cookie2") continue; m_headersList << pair; @@ -1307,7 +1306,7 @@ QString QDeclarativeXMLHttpRequest::responseBody() const QXmlStreamReader reader(m_responseEntityBody); reader.readNext(); #ifndef QT_NO_TEXTCODEC - QTextCodec *codec = QTextCodec::codecForName(reader.documentEncoding().toString().toUtf8()); + QTextCodec *codec = QTextCodec::codecForName(reader.documentEncoding().toUtf8()); if (codec) return codec->toUnicode(m_responseEntityBody); #endif -- cgit v0.12 From 727eacdc226873f61a5a546ab81ff11181fe9bb5 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Aug 2010 13:10:23 +0200 Subject: QNAM: New QNetworkReply::setFinished() protected function This function custom allows subclasses of QNetworkReply to also use the behaviour that is enabled by having isFinished(). Task-Number: QTBUG-11737 Reviewed-by: Peter Hartmann --- src/network/access/qfilenetworkreply.cpp | 7 +------ src/network/access/qfilenetworkreply_p.h | 2 -- src/network/access/qnetworkaccessbackend.cpp | 2 +- src/network/access/qnetworkreply.cpp | 18 +++++++++++++++++- src/network/access/qnetworkreply.h | 1 + src/network/access/qnetworkreply_p.h | 3 +-- src/network/access/qnetworkreplyimpl.cpp | 11 ++++------- src/network/access/qnetworkreplyimpl_p.h | 2 -- 8 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp index 4ac9a8c..c6715e6 100644 --- a/src/network/access/qfilenetworkreply.cpp +++ b/src/network/access/qfilenetworkreply.cpp @@ -68,6 +68,7 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req setRequest(req); setUrl(req.url()); setOperation(op); + setFinished(true); QNetworkReply::open(QIODevice::ReadOnly); qRegisterMetaType("QNetworkReply::NetworkError"); @@ -141,12 +142,6 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); } - -bool QFileNetworkReplyPrivate::isFinished() const -{ - return true; -} - void QFileNetworkReply::close() { Q_D(QFileNetworkReply); diff --git a/src/network/access/qfilenetworkreply_p.h b/src/network/access/qfilenetworkreply_p.h index 710ec9f..227c775 100644 --- a/src/network/access/qfilenetworkreply_p.h +++ b/src/network/access/qfilenetworkreply_p.h @@ -92,8 +92,6 @@ public: qint64 fileSize; qint64 filePos; - virtual bool isFinished() const; - Q_DECLARE_PUBLIC(QFileNetworkReply) }; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 45495f7..c3d765b 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -146,7 +146,7 @@ QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() // and the special backends need to access this. void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) { - if (reply->isFinished()) + if (reply->isFinished) return; reply->emitUploadProgress(bytesSent, bytesTotal); } diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index c8b8c1f..b40ee3c 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -49,6 +49,7 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() : readBufferMaxSize(0), operation(QNetworkAccessManager::UnknownOperation), errorCode(QNetworkReply::NoError) + , isFinished(false) { // set the default attribute values attributes.insert(QNetworkRequest::ConnectionEncryptedAttribute, false); @@ -468,7 +469,7 @@ QNetworkReply::NetworkError QNetworkReply::error() const */ bool QNetworkReply::isFinished() const { - return d_func()->isFinished(); + return d_func()->isFinished; } /*! @@ -724,6 +725,21 @@ void QNetworkReply::setError(NetworkError errorCode, const QString &errorString) } /*! + \since 4.8 + Sets the reply as \a finished. + + After having this set the replies data must not change. + + \sa isFinished() +*/ +void QNetworkReply::setFinished(bool finished) +{ + Q_D(QNetworkReply); + d->isFinished = finished; +} + + +/*! Sets the URL being processed to be \a url. Normally, the URL matches that of the request that was posted, but for a variety of reasons it can be different (for example, a file path being made diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index acb7379..b39fd32 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -163,6 +163,7 @@ protected: void setOperation(QNetworkAccessManager::Operation operation); void setRequest(const QNetworkRequest &request); void setError(NetworkError errorCode, const QString &errorString); + void setFinished(bool); void setUrl(const QUrl &url); void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); void setRawHeader(const QByteArray &headerName, const QByteArray &value); diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h index d7b8ab0..2e2e0bc 100644 --- a/src/network/access/qnetworkreply_p.h +++ b/src/network/access/qnetworkreply_p.h @@ -71,12 +71,11 @@ public: qint64 readBufferMaxSize; QNetworkAccessManager::Operation operation; QNetworkReply::NetworkError errorCode; + bool isFinished; static inline void setManager(QNetworkReply *reply, QNetworkAccessManager *manager) { reply->d_func()->manager = manager; } - virtual bool isFinished() const { return false; } - Q_DECLARE_PUBLIC(QNetworkReply) }; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 5345d63..70418e9 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -689,6 +689,8 @@ void QNetworkReplyImplPrivate::finished() resumeNotificationHandling(); state = Finished; + q->setFinished(true); + pendingNotifications.clear(); pauseNotificationHandling(); @@ -759,11 +761,6 @@ void QNetworkReplyImplPrivate::sslErrors(const QList &errors) #endif } -bool QNetworkReplyImplPrivate::isFinished() const -{ - return (state == Finished || state == Aborted); -} - QNetworkReplyImpl::QNetworkReplyImpl(QObject *parent) : QNetworkReply(*new QNetworkReplyImplPrivate, parent) { @@ -798,7 +795,7 @@ void QNetworkReplyImpl::abort() QNetworkReply::close(); if (d->state != QNetworkReplyImplPrivate::Finished) { - // emit signals + // call finished which will emit signals d->error(OperationCanceledError, tr("Operation canceled")); d->finished(); } @@ -826,7 +823,7 @@ void QNetworkReplyImpl::close() QNetworkReply::close(); - // emit signals + // call finished which will emit signals d->error(OperationCanceledError, tr("Operation canceled")); d->finished(); } diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index ab11ebe..2cb3082 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -173,8 +173,6 @@ public: void redirectionRequested(const QUrl &target); void sslErrors(const QList &errors); - bool isFinished() const; - QNetworkAccessBackend *backend; QIODevice *outgoingData; QRingBuffer *outgoingDataBuffer; -- cgit v0.12 From 1ec7300d8695e98ec8921624a7938719894a8d6f Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Aug 2010 13:54:10 +0200 Subject: QNAM: Move a qRegisterMetaType --- src/network/access/qfilenetworkreply.cpp | 2 -- src/network/access/qnetworkaccessmanager.cpp | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp index c6715e6..8c0fd17 100644 --- a/src/network/access/qfilenetworkreply.cpp +++ b/src/network/access/qfilenetworkreply.cpp @@ -71,8 +71,6 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req setFinished(true); QNetworkReply::open(QIODevice::ReadOnly); - qRegisterMetaType("QNetworkReply::NetworkError"); - QFileNetworkReplyPrivate *d = (QFileNetworkReplyPrivate*) d_func(); QUrl url = req.url(); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index f1054bd..615793a 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -450,6 +450,8 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) : QObject(*new QNetworkAccessManagerPrivate, parent) { ensureInitialized(); + + qRegisterMetaType("QNetworkReply::NetworkError"); } /*! -- cgit v0.12 From fa175169b40735461f9647857143196679858724 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Aug 2010 15:30:45 +0200 Subject: QNAM HTTP: Fix a warning tst_qnetworkreply:getAndThenDeleteObject had a QNativeSocketEngine warning that is now not coming anymore. --- src/network/access/qhttpnetworkconnectionchannel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index fe5532e..e39f9ed 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -883,7 +883,9 @@ void QHttpNetworkConnectionChannel::_q_readyRead() { // We got a readyRead but no bytes are available.. // This happens for the Unbuffered QTcpSocket - if (socket->bytesAvailable() == 0) { + // Also check if socket is in ConnectedState since + // this function may also be invoked via the event loop. + if (socket->state() == QAbstractSocket::ConnectedState && socket->bytesAvailable() == 0) { char c; qint64 ret = socket->peek(&c, 1); if (ret < 0) { -- cgit v0.12 From a30ad513df3af7e558d079df405a90e8601d2e74 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 24 Aug 2010 15:57:46 +0200 Subject: Fixed a compile error on Mac. On some platforms/compilers QStringBuilder is not included by default, so we explicitly include it. Reviewed-by: Olivier Goffart --- src/declarative/qml/qdeclarativexmlhttprequest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp index ef2798c..eb37dd8 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp +++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp @@ -58,6 +58,8 @@ #include #include +#include + #ifndef QT_NO_XMLSTREAMREADER // From DOM-Level-3-Core spec @@ -1094,9 +1096,9 @@ void QDeclarativeXMLHttpRequest::fillHeadersList() m_headersList.clear(); foreach (const QByteArray &header, headerList) { HeaderPair pair (header.toLower(), m_network->rawHeader(header)); - if (pair.first == "set-cookie" || - pair.first == "set-cookie2") - continue; + if (pair.first == "set-cookie" || + pair.first == "set-cookie2") + continue; m_headersList << pair; } -- cgit v0.12