From zxcvbn4038 at gmail.com Mon May 11 22:49:43 2015 From: zxcvbn4038 at gmail.com (CJ Ess) Date: Mon, 11 May 2015 16:49:43 -0400 Subject: [Qtwebengine] Proof of concept - changing the order of http request headers Message-ID: Hello, I originally sent this to the downstream PhantomJS project, but they thought it was more of a QT issue so I should send it here. I would like to change the order of the HTTP request headers - technically the order doesn't matter, however because the order which PhantomJS sends them (which is the way that QTWeb sends them) is fairly unique, it's one of the things that Web Application Firewalls (layer 7 firewalls) key off of to keep out screen scrapers. The attached diff demonstrates that the order of the headers can be controlled reliably at the point they are serialized to the outgoing buffer. The next step would be to make the order configurable and expose that in the API someplace however I think thats beyond what I can contribute. I'm hoping someone else can run with it from here. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- --- a/src/qt/qtbase/src/network/access/qhttpnetworkrequest.cpp +++ b/src/qt/qtbase/src/network/access/qhttpnetworkrequest.cpp @@ -137,6 +137,7 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request { QList > fields = request.header(); QByteArray ba; + QByteArray value; ba.reserve(40 + fields.length()*25); // very rough lower bound estimation ba += request.methodName(); @@ -149,14 +150,34 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request ba += QByteArray::number(request.minorVersion()); ba += "\r\n"; - QList >::const_iterator it = fields.constBegin(); - QList >::const_iterator endIt = fields.constEnd(); - for (; it != endIt; ++it) { + QList hdrord; + hdrord << "Host" << "Connection" << "Accept" << "User-Agent" << "Accept-Encoding" << "Accept-Language"; + // Headers with preferred order, allowing duplicates + foreach(QByteArray item, hdrord) { + QList >::const_iterator it = fields.constBegin(); + QList >::const_iterator endIt = fields.constEnd(); + for (; it != endIt; ++it) { + if (it->first != item) + continue; ba += it->first; ba += ": "; ba += it->second; ba += "\r\n"; + } + } + // Custom Headers or w/o preferred order, allowing duplicates + QList >::const_iterator it = fields.constBegin(); + QList >::const_iterator endIt = fields.constEnd(); + for (; it != endIt; ++it) { + if (hdrord.indexOf(it->first) > -1) + continue; + ba += it->first; + ba += ": "; + ba += it->second; + ba += "\r\n"; } + hdrord.clear(); + if (request.d->operation == QHttpNetworkRequest::Post) { // add content type, if not set in the request if (request.headerField("content-type").isEmpty()) { From zxcvbn4038 at gmail.com Mon May 11 22:59:49 2015 From: zxcvbn4038 at gmail.com (CJ Ess) Date: Mon, 11 May 2015 16:59:49 -0400 Subject: [Qtwebengine] Controlling the default language of QtWeb Message-ID: What is the best way to control the default language of the browser? Working with a downstream project, PhantomJS, their best solution seems to be overwriting the accept-langage headers with the language desired - however that refers to an old version of Phantom using an old version of QtWeb, and doesn't address javascript, storage engine, and other components that seem to be language aware. Taking PhantomJS out of the picture, whats the best way to do it with the current QtWeb? -------------- next part -------------- An HTML attachment was scrubbed... URL: From me at the-compiler.org Mon May 11 23:13:36 2015 From: me at the-compiler.org (Florian Bruhin) Date: Mon, 11 May 2015 23:13:36 +0200 Subject: [Qtwebengine] Controlling the default language of QtWeb In-Reply-To: References: Message-ID: <20150511211336.GD448@tonks> Hi, * CJ Ess [2015-05-11 16:59:49 -0400]: > What is the best way to control the default language of the browser? This list is intended for the development of QtWebEngine - there's QtWebKit and QtWebEngine, and no "QtWeb" (not from the Qt project at least). QtWebEngine is a rather new project based on Chromium. I think you're talking about QtWebKit, where the more appropriate list would be: https://lists.webkit.org/mailman/listinfo/webkit-qt Note that list is mainly intended for development *of* QtWebKit, not *with*. > Working with a downstream project, PhantomJS, their best solution seems to > be overwriting the accept-langage headers with the language desired - > however that refers to an old version of Phantom using an old version of > QtWeb, and doesn't address javascript, storage engine, and other components > that seem to be language aware. I don't know of any other project doing more than sending Accept-Language - what about JS/storage is language-aware? Florian -- http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From me at the-compiler.org Mon May 11 23:15:49 2015 From: me at the-compiler.org (Florian Bruhin) Date: Mon, 11 May 2015 23:15:49 +0200 Subject: [Qtwebengine] Proof of concept - changing the order of http request headers In-Reply-To: References: Message-ID: <20150511211549.GE448@tonks> Hi, * CJ Ess [2015-05-11 16:49:43 -0400]: > Hello, > > I originally sent this to the downstream PhantomJS project, but they > thought it was more of a QT issue so I should send it here. I would like to > change the order of the HTTP request headers - technically the order > doesn't matter, however because the order which PhantomJS sends them (which > is the way that QTWeb sends them) is fairly unique, it's one of the things > that Web Application Firewalls (layer 7 firewalls) key off of to keep out > screen scrapers. As mentioned in my other mail already, this list is for QtWebEngine, which doesn't use QNetworkAccessManager. But in this case, as QtWebKit isn't directly related to that diff either, you might want to write to the Qt development ML instead: http://lists.qt-project.org/mailman/listinfo/development Florian -- http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From allan.jensen at theqtcompany.com Tue May 12 18:02:20 2015 From: allan.jensen at theqtcompany.com (Allan Sandfeld Jensen) Date: Tue, 12 May 2015 18:02:20 +0200 Subject: [Qtwebengine] Proof of concept - changing the order of http request headers In-Reply-To: References: Message-ID: <201505121802.20774.allan.jensen@theqtcompany.com> On Monday 11 May 2015, CJ Ess wrote: > Hello, > > I originally sent this to the downstream PhantomJS project, but they > thought it was more of a QT issue so I should send it here. I would like to > change the order of the HTTP request headers - technically the order > doesn't matter, however because the order which PhantomJS sends them (which > is the way that QTWeb sends them) is fairly unique, it's one of the things > that Web Application Firewalls (layer 7 firewalls) key off of to keep out > screen scrapers. > > The attached diff demonstrates that the order of the headers can be > controlled reliably at the point they are serialized to the outgoing > buffer. The next step would be to make the order configurable and expose > that in the API someplace however I think thats beyond what I can > contribute. I'm hoping someone else can run with it from here. This is a qtnetwork change. I would suggest open a suggestion bug-report on it, and if you want to discuss it on a mailing list, it probably belongs on development at qt-project.org. `Allan -- The Qt Company Rudower Chausse 13, 12489 D-Berlin The Qt Company is a group company of Digia Plc, Valimotie 21, FI-00380 Helsinki Finland From macepeda_99 at yahoo.com Wed May 20 15:15:21 2015 From: macepeda_99 at yahoo.com (Miguel Cepeda) Date: Wed, 20 May 2015 13:15:21 +0000 (UTC) Subject: [Qtwebengine] WebEngineView and WebRTC Message-ID: <225313533.3378822.1432127721431.JavaMail.yahoo@mail.yahoo.com> Hello everybody, I'd like to know whether WebRTC is fully functional in WebEngineView after loading an html5 file which uses the object navigator to getUserMedia. I know it uses a branch of Chrome, what partially answer my question, but I've been trying and it seems not to work (I'm using the new Qt5.5.0 Beta). I would greatly appreciate all answers. Regards, Miguel -------------- next part -------------- An HTML attachment was scrubbed... URL: