android-components icon indicating copy to clipboard operation
android-components copied to clipboard

Are defult header needed GeckoViewFetchClient?

Open Amejia481 opened this issue 6 years ago • 11 comments

After chatting with @snorp he suggested that we shouldn't be passing default headers to the GeckoWebExecutor as GeckoView is already providing any default headers and passing them could cause issue for some sites. Do we really need them?

┆Issue is synchronized with this Jira Task

Amejia481 avatar Jul 15 '20 01:07 Amejia481

What do you think @pocmo ?

Amejia481 avatar Jul 15 '20 01:07 Amejia481

Those are our default headers: https://github.com/mozilla-mobile/android-components/blob/589e186f8779594fb0641f6bc8bc00efa2da11f7/components/concept/fetch/src/main/java/mozilla/components/concept/fetch/Client.kt#L98

The reason for them was to unify the headers that our concept-fetch implementations send, so that switching between implementations does not cause a different behavior.

Do we know what exactly causes issues?

pocmo avatar Jul 15 '20 08:07 pocmo

Reading the backlog of the Slack discussion it seems like the headers themselves were not the cause of the problem?

pocmo avatar Jul 15 '20 08:07 pocmo

Those are our default headers:

https://github.com/mozilla-mobile/android-components/blob/589e186f8779594fb0641f6bc8bc00efa2da11f7/components/concept/fetch/src/main/java/mozilla/components/concept/fetch/Client.kt#L98

The reason for them was to unify the headers that our concept-fetch implementations send, so that switching between implementations does not cause a different behavior.

Do we know what exactly causes issues?

So far no, we don't have any specific confirm case, but as @snorp recommended to do not send them to GeckoWebExecutor as they may cause problem in the future, I wanted to confirm if we have keep sending them?

Amejia481 avatar Jul 15 '20 13:07 Amejia481

I think the Accept-* ones are probably ok, but setting User-Agent to something different than what we use to fetch pages is wrong. It also seems wrong to set Connection, because you aren't doing connection management at that layer and have no idea if the impl supports it. Additionally, you are only fetching the one thing, so how do you even know if a persistent connection would help?

snorp avatar Jul 15 '20 14:07 snorp

See https://github.com/mozilla-mobile/fenix/issues/11332#issuecomment-663854356 for a case where this broke stuff.

kbrosnan avatar Jul 30 '20 07:07 kbrosnan

Moving into triage for the next sprint.

pocmo avatar Jul 30 '20 11:07 pocmo

Please also have a look at: https://bugzilla.mozilla.org/show_bug.cgi?id=1657251#c9

sv-ohorvath avatar Aug 10 '20 14:08 sv-ohorvath

This bug causes some download failures: https://bugzilla.mozilla.org/show_bug.cgi?id=1662235 likely because the website thinks Fenix is a web crawler.

agi avatar Sep 10 '20 15:09 agi

Aye, thank you for reminding me about this issue. I'll move it into our sprint.

pocmo avatar Sep 10 '20 16:09 pocmo

We removed "User-Agent" and "Connection" from the default headers.

Looking at the other linked issues I think we should just drop the other Accept(-*) default headers too.

pocmo avatar Sep 21 '20 09:09 pocmo