diff options
Diffstat (limited to 'src/core/net')
-rw-r--r-- | src/core/net/network_delegate_qt.cpp | 16 | ||||
-rw-r--r-- | src/core/net/url_request_custom_job.cpp | 3 | ||||
-rw-r--r-- | src/core/net/url_request_custom_job.h | 1 | ||||
-rw-r--r-- | src/core/net/url_request_custom_job_proxy.cpp | 3 | ||||
-rw-r--r-- | src/core/net/url_request_notification.cpp | 2 |
5 files changed, 11 insertions, 14 deletions
diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp index 68bf34d31..772ef06aa 100644 --- a/src/core/net/network_delegate_qt.cpp +++ b/src/core/net/network_delegate_qt.cpp @@ -139,11 +139,11 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet // Deprecated =begin // quick peek if deprecated - QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->requestInterceptor(); - if (profileInterceptor && profileInterceptor->property("deprecated").toBool()) { - profileInterceptor = nullptr; - if (QWebEngineUrlRequestInterceptor* interceptor = m_profileIOData->acquireInterceptor()) { - interceptor->interceptRequest(requestInfo); + + if (m_profileIOData->isInterceptorDeprecated()) { + QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->acquireInterceptor(); + if (profileInterceptor && m_profileIOData->isInterceptorDeprecated()) { + profileInterceptor->interceptRequest(requestInfo); m_profileIOData->releaseInterceptor(); if (requestInfo.changed()) { int result = infoPrivate->shouldBlockRequest ? net::ERR_BLOCKED_BY_CLIENT : net::OK; @@ -177,7 +177,9 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet if (!resourceInfo) return net::OK; - if (!m_profileIOData->hasPageInterceptors() && !profileInterceptor && !content::IsResourceTypeFrame(resourceType)) + // try to bail out + if (!m_profileIOData->hasPageInterceptors() && (!m_profileIOData->requestInterceptor() || m_profileIOData->isInterceptorDeprecated()) && + !content::IsResourceTypeFrame(resourceType)) return net::OK; auto webContentsGetter = resourceInfo->GetWebContentsGetterForRequest(); @@ -188,7 +190,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet std::move(requestInfo), webContentsGetter, std::move(callback), - profileInterceptor ? m_profileIOData->profileAdapter() : nullptr + m_profileIOData->profileAdapter() ); // We'll run the callback after we notified the UI thread. diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index 8f0fada57..37f7de256 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -68,7 +68,6 @@ URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, , m_pendingReadBuffer(nullptr) , m_corsEnabled(QWebEngineUrlScheme::schemeByName(QByteArray::fromStdString(scheme)) .flags().testFlag(QWebEngineUrlScheme::CorsEnabled)) - , m_httpStatusCode(500) { } @@ -155,7 +154,7 @@ void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) headers += "HTTP/1.1 303 See Other\n"; headers += base::StringPrintf("Location: %s\n", m_redirect.spec().c_str()); } else { - headers += base::StringPrintf("HTTP/1.1 %i OK\n", m_httpStatusCode); + headers += base::StringPrintf("HTTP/1.1 %i OK\n", 200); if (m_mimeType.size() > 0) { headers += base::StringPrintf("Content-Type: %s", m_mimeType.c_str()); if (m_charset.size() > 0) diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h index e1e8e9fba..19a1a5776 100644 --- a/src/core/net/url_request_custom_job.h +++ b/src/core/net/url_request_custom_job.h @@ -82,7 +82,6 @@ private: int m_pendingReadPos; net::IOBuffer *m_pendingReadBuffer; const bool m_corsEnabled; - int m_httpStatusCode; friend class URLRequestCustomJobProxy; diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index b9ccf7ea4..72d14450e 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -100,7 +100,6 @@ void URLRequestCustomJobProxy::reply(std::string mimeType, QIODevice *device) m_job->set_expected_content_size(size); if (m_job->m_device && m_job->m_device->isReadable()) { m_started = true; - m_job->m_httpStatusCode = 200; m_job->NotifyHeadersComplete(); } else { fail(ERR_INVALID_URL); @@ -115,7 +114,6 @@ void URLRequestCustomJobProxy::redirect(GURL url) if (m_job->m_device || m_job->m_error) return; m_job->m_redirect = url; - m_job->m_httpStatusCode = 303; m_started = true; m_job->NotifyHeadersComplete(); } @@ -140,7 +138,6 @@ void URLRequestCustomJobProxy::fail(int error) if (!m_job) return; m_job->m_error = error; - m_job->m_httpStatusCode = 500; if (m_job->m_device) m_job->m_device->close(); if (!m_started) diff --git a/src/core/net/url_request_notification.cpp b/src/core/net/url_request_notification.cpp index e37ad35bc..9d309e314 100644 --- a/src/core/net/url_request_notification.cpp +++ b/src/core/net/url_request_notification.cpp @@ -107,7 +107,7 @@ void URLRequestNotification::notify() if (webContents) { - if (m_profileAdapter) { + if (m_profileAdapter && m_profileAdapter->requestInterceptor()) { QWebEngineUrlRequestInterceptor* interceptor = m_profileAdapter->requestInterceptor(); if (!interceptor->property("deprecated").toBool()) interceptor->interceptRequest(m_requestInfo); |