diff options
Diffstat (limited to 'src/core/api/qwebengineloadinginfo.cpp')
-rw-r--r-- | src/core/api/qwebengineloadinginfo.cpp | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/src/core/api/qwebengineloadinginfo.cpp b/src/core/api/qwebengineloadinginfo.cpp index ce6e57d5c..a72117e9d 100644 --- a/src/core/api/qwebengineloadinginfo.cpp +++ b/src/core/api/qwebengineloadinginfo.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qwebengineloadinginfo.h> @@ -53,17 +17,20 @@ Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == stat Q_STATIC_ASSERT(static_cast<int>(WebEngineError::HttpErrorDomain) == static_cast<int>(ErrorDomain::HttpErrorDomain)); Q_STATIC_ASSERT(static_cast<int>(WebEngineError::FtpErrorDomain) == static_cast<int>(ErrorDomain::FtpErrorDomain)); Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(ErrorDomain::DnsErrorDomain)); +Q_STATIC_ASSERT(static_cast<int>(WebEngineError::HttpStatusCodeDomain) == static_cast<int>(ErrorDomain::HttpStatusCodeDomain)); class QWebEngineLoadingInfo::QWebEngineLoadingInfoPrivate : public QSharedData { public: QWebEngineLoadingInfoPrivate(const QUrl& url, LoadStatus status, bool isErrorPage, - const QString& errorString, int errorCode, ErrorDomain errorDomain) + const QString& errorString, int errorCode, ErrorDomain errorDomain, + const QMultiMap<QByteArray,QByteArray>& responseHeaders) : url(url) , status(status) , isErrorPage(isErrorPage) , errorString(errorString) , errorCode(errorCode) , errorDomain(errorDomain) + , responseHeaders(responseHeaders) { } @@ -73,6 +40,7 @@ public: QString errorString; int errorCode; ErrorDomain errorDomain; + QMultiMap<QByteArray,QByteArray> responseHeaders; }; /*! @@ -87,8 +55,10 @@ public: \sa QWebEnginePage::loadStarted, QWebEnginePage::loadFinished, WebEngineView::loadingChanged */ QWebEngineLoadingInfo::QWebEngineLoadingInfo(const QUrl& url, LoadStatus status, bool isErrorPage, - const QString& errorString, int errorCode, ErrorDomain errorDomain) - : d_ptr(new QWebEngineLoadingInfoPrivate(url, status, isErrorPage, errorString, errorCode, errorDomain)) + const QString& errorString, int errorCode, ErrorDomain errorDomain, + const QMultiMap<QByteArray,QByteArray>& responseHeaders) + : d_ptr(new QWebEngineLoadingInfoPrivate(url, status, isErrorPage, errorString, errorCode, errorDomain, + responseHeaders)) { } @@ -169,6 +139,8 @@ QString QWebEngineLoadingInfo::errorString() const Error is related to the FTP connection. \value DnsErrorDomain Error is related to the DNS connection. + \value HttpStatusCodeDomain + Error is the HTTP response status code, even in case of success e.g. the server replied with status 200. */ /* \property QWebEngineLoadingInfo::errorDomain @@ -190,4 +162,19 @@ int QWebEngineLoadingInfo::errorCode() const return d->errorCode; } +/*! + \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. +*/ +QMultiMap<QByteArray,QByteArray> QWebEngineLoadingInfo::responseHeaders() const +{ + Q_D(const QWebEngineLoadingInfo); + return d->responseHeaders; +} + QT_END_NAMESPACE + +#include "moc_qwebengineloadinginfo.cpp" |