diff options
Diffstat (limited to 'src/core/net/url_request_custom_job_proxy.cpp')
-rw-r--r-- | src/core/net/url_request_custom_job_proxy.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index d7adcc7e8..0f41a3670 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -6,6 +6,7 @@ #include "content/public/browser/browser_thread.h" #include "net/base/net_errors.h" +#include "services/network/public/cpp/resource_request_body.h" #include "api/qwebengineurlrequestjob.h" #include "profile_adapter.h" @@ -41,7 +42,7 @@ void URLRequestCustomJobProxy::release() } void URLRequestCustomJobProxy::reply(std::string contentType, QIODevice *device, - QMap<QByteArray, QByteArray> additionalResponseHeaders) + QMultiMap<QByteArray, QByteArray> additionalResponseHeaders) { if (!m_client) return; @@ -51,15 +52,15 @@ void URLRequestCustomJobProxy::reply(std::string contentType, QIODevice *device, if (sidx > 0) { const int cidx = qcontentType.indexOf("charset=", sidx); if (cidx > 0) { - m_client->m_charset = qcontentType.mid(cidx + 8).toStdString(); + m_client->m_charset = qcontentType.mid(cidx + 8).trimmed().toStdString(); qcontentType = qcontentType.first(sidx); } else { qWarning() << "QWebEngineUrlRequestJob::reply(): Unrecognized content-type format with ';'" << qcontentType; } } - m_client->m_mimeType = qcontentType.toStdString(); + m_client->m_mimeType = qcontentType.trimmed().toStdString(); m_client->m_device = device; - m_client->m_additionalResponseHeaders = additionalResponseHeaders; + m_client->m_additionalResponseHeaders = std::move(additionalResponseHeaders); if (m_client->m_device && !m_client->m_device->isReadable()) m_client->m_device->open(QIODevice::ReadOnly); @@ -126,7 +127,8 @@ void URLRequestCustomJobProxy::readyRead() void URLRequestCustomJobProxy::initialize(GURL url, std::string method, absl::optional<url::Origin> initiator, - std::map<std::string, std::string> headers) + std::map<std::string, std::string> headers, + scoped_refptr<network::ResourceRequestBody> requestBody) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); Q_ASSERT(!m_delegate); @@ -144,10 +146,9 @@ void URLRequestCustomJobProxy::initialize(GURL url, std::string method, qHeaders.insert(toQByteArray(it->first), toQByteArray(it->second)); if (schemeHandler) { - m_delegate = new URLRequestCustomJobDelegate(this, toQt(url), - QByteArray::fromStdString(method), - initiatorOrigin, - qHeaders); + m_delegate = + new URLRequestCustomJobDelegate(this, toQt(url), QByteArray::fromStdString(method), + initiatorOrigin, qHeaders, requestBody.get()); QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(m_delegate); schemeHandler->requestStarted(requestJob); } |