[Qtwebengine] Add way to override host resolution

Manuel Peinado manuel.peinado at gmail.com
Thu Feb 14 22:26:22 CET 2019


Thanks Allan, that's very encouraging!

I just realized that the freeze date for 5.13 has passed. Any chance our
patch could land in that version regardless? I guess not, but having to
wait almost a year for 5.14 is going to be a shame. We could always ship
our own local build with the patch, but that's something we were trying to
avoid.

Anyway, thanks for suggesting we use a Chrome extension, that's a
possibility we hadn't contemplated. Unfortunately after some research I
don't think any of the supported APIs (
https://developer.chrome.com/extensions/devguide) is powerful enough to
support our use case. I looked into the "Web Request" section in particular
since that seemed to show promise, but no luck.

Thanks as well for the hint about bridging threads, will definitely take it
into account when I'm working on the patch.

Regards,
Manuel

On Thu, Feb 14, 2019 at 4:31 PM Allan Jensen <Allan.Jensen at qt.io> wrote:

> Hi,
>
> That sounds like a great idea, and useful for more than just you. So if
> you
> submit it I will definitely give a look, and I think you are right, that
> it
> should be possible to do without patching Chromium. We have a chance to
> set a
> host-resolver in ProfileIoDataQt, so it should be possibly to override.
>
> One issue you might run into though is bridging threads. Typically we
> assume
> our API is accessed from the main thread or unknown user threads, where
> Chromium will likely access the host resolver from the IO thread.
>
> Btw. would you be able to implement this using Chrome extensions if we had
> support for that? We got most of the infrastructure for that into 5.13, so
> it
> is likely we can enable a lot of extension features for 5.14.
>
> Best regards
> 'Allan
>
> On Thursday, 14 February 2019 16:25:23 CET Manuel Peinado wrote:
> > Hi all,
> >
> > We have this app we’re working on at Plex that’s written in QML and makes
> > heavy use of WebEngineView. In order to implement our secure connections
> > feature (see
> >
> https://support.plex.tv/articles/206225077-how-to-use-secure-server-connecti
> > ons/) we would need to hook into Chromium's DNS resolution. The goal is
> > pretty simple, basically detect if the host has a particular structure
> and
> > resolve it to a custom IP in case it does.
> >
> > So assuming Qt had support for this, we would be doing something like the
> > following:
> >
> >
> > QQuickWebEngineProfile* webEngineProfile = ...;
> > webProfile->setHostResolver(new CustomHostResolver());
> >
> > Where CustomHostResolver would implement an interface similar to the
> > existing QWebEngineUrlRequestInterceptor:
> >
> > class CustomHostResolver : public QtWebEngineHostResolver
> > {
> >  Q_OBJECT
> >
> > public:
> >
> >  void resolveHost(QWebEngineHostResolutionInfo& info) override
> >  {
> >    if (info.host == "special host name")
> >    {
> >      info.resolveHostTo("custom IP");
> >      return;
> >    }
> >
> >    // If we don't modify "info" then the host gets resolved
> >    // using the default, DNS based, path.
> >  }
> > };
> >
> > There is no support at the moment for any of this in QtWebEngine, so we
> > would have to add it ourselves. And here's the question: if we create a
> PR
> > that implements this, would it have any chance of getting reviewed and
> > ultimately accepted? Just want to make sure it stands a chance before we
> > spend a bunch of time working on it.
> >
> > (I've studied the underlying code and think we would be able to implement
> > what we need without requiring any patches to Chromium, which should
> > improve the chances that the PR succeeds right?)
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20190214/864ee673/attachment-0001.html>


More information about the QtWebEngine mailing list