Are defult header needed GeckoViewFetchClient?
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
What do you think @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?
Reading the backlog of the Slack discussion it seems like the headers themselves were not the cause of the problem?
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-fetchimplementations 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?
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?
See https://github.com/mozilla-mobile/fenix/issues/11332#issuecomment-663854356 for a case where this broke stuff.
Moving into triage for the next sprint.
Please also have a look at: https://bugzilla.mozilla.org/show_bug.cgi?id=1657251#c9
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.
Aye, thank you for reminding me about this issue. I'll move it into our sprint.
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.