-
Bug
-
Resolution: Out of scope
-
P1: Critical
-
None
-
6.6.0 Beta3
-
None
- Added/modified headers do not appear in the dev tools
(maybe it is expected as chrome extensions that change headers have the same behavior?) - Modified headers do not have observable effects. For instance forcing Content-Type to text/plain has no effect while it should force chromium to display the HTML source as plain text. Similarly after removing the Content-Security-Policy headers, chromium still enforce them.
For reference here is the code I wrote to test using the simplebrowser demo:
// webpage.cpp class Interceptor : public QWebEngineUrlResponseInterceptor { public: void interceptResponseHeaders(QWebEngineUrlResponseInfo &info) override; }; void Interceptor::interceptResponseHeaders(QWebEngineUrlResponseInfo &info) { // only modify headers for the main request if (info.requestUrl() != QUrl("https://www.qt.io/")) return; qDebug() << "Changing headers"; auto headers = info.responseHeaders(); headers.insert("x-foo", "foobar"); headers.insert("content-security-policy", "f"); headers.insert("content-type", "text/plain"); info.setResponseHeaders(headers); } WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) : QWebEnginePage(profile, parent) { connect(this, &QWebEnginePage::selectClientCertificate, this, &WebPage::handleSelectClientCertificate); connect(this, &QWebEnginePage::certificateError, this, &WebPage::handleCertificateError); setUrlResponseInterceptor(new Interceptor); }
Note that if I do change the content-type header of all requests, the webpage does appear broken. So at least for some resources (JS or CSS ?) the modified content-type header is recognized.
- depends on
-
QTBUG-61071 Need intercept and change traffic.
-
- Open
-