After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 580903 - No way to change user agent for distributors
No way to change user agent for distributors
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Backend
git master
Other Linux
: Normal normal
: ---
Assigned To: Xan Lopez
Epiphany Maintainers
Depends on:
Blocks: 584346
 
 
Reported: 2009-04-30 15:41 UTC by Vincent Untz
Modified: 2009-12-18 19:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (3.17 KB, patch)
2009-08-03 20:54 UTC, Vincent Untz
none Details | Review
Second approach (3.89 KB, patch)
2009-08-07 12:17 UTC, Vincent Untz
none Details | Review
Updated patch for second approach (4.81 KB, patch)
2009-08-07 16:05 UTC, Vincent Untz
none Details | Review

Description Vincent Untz 2009-04-30 15:41:15 UTC
With the mozilla backend, it was possible to change some file in /usr/share/epiphany/chrome to change the user agent.

It's not possible anymore with the webkit backend. I guess most distributors would like to see this implemented.
Comment 1 Vincent Untz 2009-07-30 10:39:37 UTC
How can I help make this happen now that https://bugs.webkit.org/show_bug.cgi?id=17375 is fixed?

Would you think having a file in /usr/share/epiphany for this is a good thing? A gconf key?
Comment 2 Xan Lopez 2009-07-30 11:01:01 UTC
I think a gconf key sounds better, but I guess it's also a good idea to keep backwards compatibility when possible. Since you are a distributor, what's your opinion? Is a gconf key more convenient or would you rather stick with the old solution?

Also, no matter what we do, this should be possible to override from an extension, which I'm pretty sure someone will write sooner or later.
Comment 3 Vincent Untz 2009-07-30 11:33:38 UTC
(In reply to comment #2)
> I think a gconf key sounds better, but I guess it's also a good idea to keep
> backwards compatibility when possible. Since you are a distributor, what's your
> opinion? Is a gconf key more convenient or would you rather stick with the old
> solution?

(backwards compatibility here is possible if you want to ship the same file that was shipped with ephy-gecko, in some chrome directory)

For openSUSE, both methods are fine. I would think that it's easier for distros to change a default gconf value, though.
Comment 4 Vincent Untz 2009-08-03 20:32:19 UTC
Thinking a bit more about this: vendors don't want a key to set the whole user agent, they just want to append "openSUSE/blablabla" or "Debian/blablabla" to the user agent, where blablabla would likely be the package version.

So if we want to use a gconf key, it'd be user_agent_os_vendor, I think.
Comment 5 Vincent Untz 2009-08-03 20:54:14 UTC
Created attachment 139827 [details] [review]
Patch

Okay, this is a patch I might use for openSUSE. Comments welcome.

(it certainly doesn't handle the extension stuff you wanted)
Comment 6 Reinout van Schouwen 2009-08-03 21:44:09 UTC
Fred, do you have an opinion on this?
Comment 7 Vincent Untz 2009-08-07 12:17:03 UTC
Created attachment 140109 [details] [review]
Second approach

This second approach might actually make more sense, after thinking about it. It does this:

 + look at /apps/epiphany/general/user_agent. Use the value of this key if it's non-empty. (it's empty by default)

 + else, use the webkit UA + Epiphany/VERSION. And optionally append a vendor value that is taken from /usr/share/epiphany/branding.conf. If the file doesn't exist, then there's no vendor added.

This file would look like this:
[User Agent]
Vendor=SUSE/2.27.90

The reason it might be better this way is that it really doesn't make sense to have some gconf key for vendor information, since it's not a preference.

Comment welcome, etc.

Note that this adds new strings (gconf schema) so it'd be nice to have a solution before the string freeze :-)
Comment 8 Vincent Untz 2009-08-07 16:05:23 UTC
Created attachment 140128 [details] [review]
Updated patch for second approach

After talking with Alexander Sack, it seems doing it this way is better.

branding.conf would now contain:

[User Agent]
Vendor=SUSE
VendorSub=11.2
VendorComment=2.27.90-1

And the result would be:

Mozilla/5.0 (X11; U; Linux i686; fr-fr) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ SUSE/11.2 (2.27.90-1) Epiphany/2.27.90

(apparently, it's better to put the vendor before the browser; that's what firefox does)
Comment 9 Dan Winship 2009-08-07 16:27:40 UTC
(In reply to comment #8)
> And the result would be:
> 
> Mozilla/5.0 (X11; U; Linux i686; fr-fr) AppleWebKit/531.2+ (KHTML, like Gecko)
> Safari/531.2+ SUSE/11.2 (2.27.90-1) Epiphany/2.27.90
> 
> (apparently, it's better to put the vendor before the browser; that's what
> firefox does)

The spec says: "By convention, the products are listed in order of their significance for identifying the application." The fact that it's "Epiphany 2.27.90" tells you more about the application than the fact that it's part of SUSE 11.2, so Epiphany should come first.
Comment 10 Vincent Untz 2009-08-07 16:36:01 UTC
Well, I'd agree. It's just that Firefox doesn't do it this way, and some broken parsers on servers might rely on this...

Anyway, it's just two lines to change, so quite easy.
Comment 11 Diego Escalante Urrelo (not reading bugmail) 2009-08-07 16:54:42 UTC
I can imagine the news in slashdot... "google's secret operating system is codenamed EPIPHANY and uses webkit"
Comment 12 Dan Winship 2009-08-07 18:09:55 UTC
(In reply to comment #10)
> Well, I'd agree. It's just that Firefox doesn't do it this way, and some broken
> parsers on servers might rely on this...

If there is someone out there with a server that relies on "Epiphany" being the last token in a User-Agent string, we can just find them on irc.gnome.org and ask them to fix it. :-)

People who parse User-Agent are doing it to see whether you are Firefox or Internet Explorer. It doesn't matter how they parse *our* User-Agent string, because they're going to do something stupid and incorrect with it regardless.

Also, I am thinking now that

    Epiphany/2.27.0 (SUSE 11.2, 2.27.0-1)

would be more correct. But whatever.
Comment 13 Xan Lopez 2009-08-10 07:20:22 UTC
(In reply to comment #9)
> The spec says: "By convention, the products are listed in order of their
> significance for identifying the application." The fact that it's "Epiphany
> 2.27.90" tells you more about the application than the fact that it's part of
> SUSE 11.2, so Epiphany should come first.
> 

What spec are you reading? This one: https://developer.mozilla.org/en/User_Agent_Strings_Reference seems to be the latest and it does not say that.

I agree with the general sentiment that putting Epiphany first makes more sense for identification purposes, although as you also mention, it's unlikely that this will matter at all...
Comment 14 Dan Winship 2009-08-10 14:29:45 UTC
(In reply to comment #13)
> What spec are you reading? This one:
> https://developer.mozilla.org/en/User_Agent_Strings_Reference seems to be the
> latest and it does not say that.

I was talking about the HTTP/1.1 spec, RFC 2616. Apparently at least the first version of the Mozilla spec pre-dates that, since it refers to obeying "the standard described in RFC 1945 and RFC 2068" :)

Anyway, this spec also seems to say that browsers that are based on Gecko but not on the mozilla source tree should not use "Mozilla/...", so it's clearly not designed to reflect the realities of User-Agent sniffing.

Although, FWIW, apparently Opera doesn't include a Mozilla/ piece any more.
Comment 15 Dan Winship 2009-08-26 14:06:13 UTC
We need to do *something* here; right now we're not even including "Epiphany" in the User-Agent...
Comment 16 Sven Arvidsson 2009-09-10 19:53:00 UTC
I don't know if this is the right place for this comment, but it would be good if it was possible (by way of an extension) to override the user agent.

There's sadly still a need for this.
Comment 17 Xan Lopez 2009-12-18 19:42:42 UTC
I have pushed this to master with very small style modifications, thank you!