[Webkit-unassigned] [Bug 191858] [GTK] Unexpected User-Agent on redirect

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 1 02:18:26 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=191858

--- Comment #8 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to youenn fablet from comment #6)
> Comment on attachment 407598 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=407598&action=review
> 
> > Source/WebKit/ChangeLog:9
> > +        request when needsSiteSpecificQuirks setting is enabled.
> 
> It seems tests are missing here. Can we write some?

It's not easy to test I'm afraid. The user agent changes depending on the site, only when site specific quirks setting is enabled. In tests the host is always localhost. We would need a way to set quirks only used for testing for localhost (and not for 127.0.0.1, for example).

> Also, it seems the patch adds a generic boolean but setting the user agent
> value is platform specific.

Because the boolean is not specific to the user agent, it's the site specific quirks setting, but it's true it's currently used only by GTK port to set the user agent.

> Currently, the work is mostly done in WebProcess with platform agnostic
> code, computation of the user agent value being done by WebPage.

There's WebPage::platformUserAgent() that right now it's only implemented by iOS and Playstation ports. In the case of the iOS port, the change in the user agent doesn't really depend on the URL, but I think playstation also needs to be fixed, moving the user agent quirks to the network process. 

> How is the computation of this value supposed to work in NetworkProcess?

We can't just use a fixed user agent for all websites like major browsers do, because we get messages of unsupported browser, or features disabled, or things simply don't work. So, we need to pretend to be other browsers in some cases depending on the website. That's what we do in WebPage::platformUserAgent(). The problem is that after a redirection, we copy the user agent from the previous request, but the redirected URL might require a different user agent to work. You can see an¡ example of how this can break things in https://bugs.webkit.org/show_bug.cgi?id=215845#c3. So, in case of redirections we need to apply the user agent quirks again, but we are in the network process now. So, this patch moves the user agent quirks to the network process ensuring they are always applied, for the initial request, for downloads, and for the new request after a redirection.

> After the patch, GTK port will compute value in NetworkProcess while other
> ports will continue doing this in WebProcess.

Not exactly, most of the ports don't implement WebPage::platformUserAgent(), which means the configured user agent in settings is used, or the standard user agent defined for the port. So, we are receiving that user agent in the network process, like all other ports. But we need to ignore that user agent in some cases and apply a different one, that's what we do now in the network process, and we always did that differently even in the web process, because Safari doesn't need to pretend to be other browser.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200901/09139c32/attachment.htm>


More information about the webkit-unassigned mailing list