summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2023-08-25 12:32:03 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-08-29 22:21:13 +0000
commit50944017746206a1280c15d46d732c58a2a4c94b (patch)
treea4d597ea3ecfb7bfd7571e32f0558bf672ba1fee /src
parent66d7a5b2bfbe1f92622e1186568ee36e85a3726e (diff)
Switch response headers to QMultiMap
To allow duplicate key values and preserve order within multi key duplicates Change-Id: I8da0a3441255c9b72256d63f4ede10491c96c2dc Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> (cherry picked from commit a6263a5e8d95dad6e3523f87d416a573e0420881) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/api/qwebengineloadinginfo.cpp9
-rw-r--r--src/core/api/qwebengineloadinginfo.h8
-rw-r--r--src/core/web_contents_delegate_qt.cpp1
-rw-r--r--src/core/web_contents_delegate_qt.h2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/core/api/qwebengineloadinginfo.cpp b/src/core/api/qwebengineloadinginfo.cpp
index ed9618f49..a72117e9d 100644
--- a/src/core/api/qwebengineloadinginfo.cpp
+++ b/src/core/api/qwebengineloadinginfo.cpp
@@ -23,7 +23,7 @@ class QWebEngineLoadingInfo::QWebEngineLoadingInfoPrivate : public QSharedData {
public:
QWebEngineLoadingInfoPrivate(const QUrl& url, LoadStatus status, bool isErrorPage,
const QString& errorString, int errorCode, ErrorDomain errorDomain,
- const QHash<QByteArray,QByteArray>& responseHeaders)
+ const QMultiMap<QByteArray,QByteArray>& responseHeaders)
: url(url)
, status(status)
, isErrorPage(isErrorPage)
@@ -40,7 +40,7 @@ public:
QString errorString;
int errorCode;
ErrorDomain errorDomain;
- QHash<QByteArray,QByteArray> responseHeaders;
+ QMultiMap<QByteArray,QByteArray> responseHeaders;
};
/*!
@@ -56,7 +56,7 @@ public:
*/
QWebEngineLoadingInfo::QWebEngineLoadingInfo(const QUrl& url, LoadStatus status, bool isErrorPage,
const QString& errorString, int errorCode, ErrorDomain errorDomain,
- const QHash<QByteArray,QByteArray>& responseHeaders)
+ const QMultiMap<QByteArray,QByteArray>& responseHeaders)
: d_ptr(new QWebEngineLoadingInfoPrivate(url, status, isErrorPage, errorString, errorCode, errorDomain,
responseHeaders))
{
@@ -164,11 +164,12 @@ int QWebEngineLoadingInfo::errorCode() const
/*!
\property QWebEngineLoadingInfo::responseHeaders
+ \since 6.6
\brief Holds the response headers when \c QWebEngineLoadingInfo::status()
is equal to \c QWebEngineLoadingInfo::LoadSucceededStatus or
\c QWebEngineLoadingInfo::LoadFailedStatus.
*/
-QHash<QByteArray,QByteArray> QWebEngineLoadingInfo::responseHeaders() const
+QMultiMap<QByteArray,QByteArray> QWebEngineLoadingInfo::responseHeaders() const
{
Q_D(const QWebEngineLoadingInfo);
return d->responseHeaders;
diff --git a/src/core/api/qwebengineloadinginfo.h b/src/core/api/qwebengineloadinginfo.h
index 86d9dba46..5dce8879c 100644
--- a/src/core/api/qwebengineloadinginfo.h
+++ b/src/core/api/qwebengineloadinginfo.h
@@ -6,7 +6,7 @@
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
-#include <QtCore/qhash.h>
+#include <QtCore/qmap.h>
#include <QtCore/qobject.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qurl.h>
@@ -27,7 +27,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineLoadingInfo
Q_PROPERTY(QString errorString READ errorString CONSTANT FINAL)
Q_PROPERTY(ErrorDomain errorDomain READ errorDomain CONSTANT FINAL)
Q_PROPERTY(int errorCode READ errorCode CONSTANT FINAL)
- Q_PROPERTY(QHash<QByteArray,QByteArray> responseHeaders READ responseHeaders CONSTANT FINAL)
+ Q_PROPERTY(QMultiMap<QByteArray,QByteArray> responseHeaders READ responseHeaders CONSTANT FINAL)
public:
enum LoadStatus {
@@ -62,13 +62,13 @@ public:
QString errorString() const;
ErrorDomain errorDomain() const;
int errorCode() const;
- QHash<QByteArray,QByteArray> responseHeaders() const;
+ QMultiMap<QByteArray,QByteArray> responseHeaders() const;
private:
QWebEngineLoadingInfo(const QUrl &url, LoadStatus status, bool isErrorPage = false,
const QString &errorString = QString(), int errorCode = 0,
ErrorDomain errorDomain = NoErrorDomain,
- const QHash<QByteArray, QByteArray> &responseHeaders = {});
+ const QMultiMap<QByteArray,QByteArray> &responseHeaders = {});
class QWebEngineLoadingInfoPrivate;
Q_DECLARE_PRIVATE(QWebEngineLoadingInfo)
QExplicitlySharedDataPointer<QWebEngineLoadingInfoPrivate> d_ptr;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index ab41483a9..64ccd529d 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -413,7 +413,6 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig
}
const net::HttpResponseHeaders * const responseHeaders = navigation_handle->GetResponseHeaders();
- QHash<QByteArray, QByteArray> responseHeadersMap;
if (responseHeaders != nullptr) {
m_loadingInfo.responseHeaders.clear();
std::size_t iter = 0;
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 68649eaa8..d49380471 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -201,7 +201,7 @@ private:
int errorCode = 0, errorDomain = 0;
QString errorDescription;
bool triggersErrorPage = false;
- QHash<QByteArray, QByteArray> responseHeaders;
+ QMultiMap<QByteArray, QByteArray> responseHeaders;
void clear() { *this = LoadingInfo(); }
} m_loadingInfo;