Subject: bug#33002: 26.1; EWW sends unspecific "Accept: */*" header

From: Federico Tedin <[email-masked]>
Date: Sat, 13 Oct 2018 18:59:05 -0300

> I noticed EWW sends header "Accept: */*", which appears to prevent
> HTTP servers that provide multiple content types from picking a sensible
> response content type.
>
> More information about the Accept header with a list of RFCs at the
> bottom of the page can be found here [1]. For comparison lynx sends a
> more specific header, which indicates It'd prefer common web content
> types before anything else [2]. I experienced this particular bug when
> browsing [3], which uses the Accept header to determine when to show the
> built-in API Explorer. In a web browser it shows a HTML form to interact
> with the API, however actual API clients use "Accept: application/json"
> or similar to get the desired format.

I've been looking into this problem. It seems that EWW uses
url-retrieve to retrieve HTTP contents, which then calls url-http.  In
url-http, the variable url-mime-accept-string is used as the value for
the HTTP Accept header (if it is set to nil, "*/*" is used
instead). By default, url-mime-accept-string is set to nil.

We could temporarily set the variable url-mime-accept-string with
another value when url-retrieve is called by EWW. I am not sure what
the default value should be, or if it should be configurable. Maybe
the same value used by Lynx would be a good starting point.