Closed Bug 1249474 Opened 8 years ago Closed 8 years ago

Accept header sent for images prevents w3.org from serving us SVG images in W3C's style sheet

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: heycam, Assigned: miketaylr)

References

Details

(Keywords: dev-doc-complete, site-compat, Whiteboard: [necko-active])

Attachments

(2 files, 3 obsolete files)

(Not sure if this is the right component.)

I was looking into the W3C’s new TR style sheet today and I noticed that for the image in the top-left of the page indicating the document’s maturity (the blue “Recommendation” strip for example) Firefox gets served a PNG and other browsers get served an SVG.

https://w3c.github.io/tr-design/src/sample.html

So on my HiDPI Mac Firefox looks a bit blurry compared to other browsers.

Current Accept headers being sent:

Firefox: image/png,image/*;q=0.8,*/*;q=0.5
Chrome: image/webp,image/*,*/*;q=0.8
Safari: */*
Edge: image/png, image/svg+xml, image/jxr, image/*;q=0.8, */*;q=0.5

What should we do about this?
We have 4 options:

1) Do nothing, given that the W3C are probably the only organization in the entire world doing this

2) Tell the W3C to stop, referencing https://wiki.whatwg.org/wiki/Why_not_conneg

3) Change the Image accept header to */*, matching Safari, as Accept sniffing is dead and bytes are expensive

4) Change to image/svg+xml,image/png,image/*;q=0.8,*/*;q=0.5 - i.e. add SVG in at the highest priority

Gerv
Matching Safari seems good. If we're adding support for a new format such as WebP it may be worth adding that in front and it may have been worth adding SVG at some point, but now that everyone supports it, it seems like a waste of bytes.
There would be a faint glimmer of hope that Accept sniffing would work for webp if we added support, as the only browser (AIUI) to support it also does send the correct Accept.

It seems like the W3C site sends SVG unless Accept specifically prioritises PNG higher, so Safari's Accept header works.

Gerv
Yeah if we add WebP switching to image/webp,*/* for a decade or so seems worthwhile (up to the point where servers stop bothering to negotiate).
Is there any potential downside to option 3, matching Safari? 

(Only thing I can think of off the top of my head is some device detection frameworks use default Accept header values to identify a browser, but I would be surprised if they were looking at Accept headers for image requests.)
Option 4 seems most compatible with the existing design decision, which is to indicate that preferred formats are preferred.  I would not assume that w3c are the only people running rfc2616-compliant servers, or with multiple available image formats.
(In reply to Martin Thomson [:mt:] from comment #6)
> Option 4 seems most compatible with the existing design decision, which is
> to indicate that preferred formats are preferred.  I would not assume that
> w3c are the only people running rfc2616-compliant servers, or with multiple
> available image formats.

Do you know of any other example? This is the first one I've seen in many years.

Gerv
Accept is a hint from the client; the server can do whatever it likes (including ignoring it). Well-behaved servers will try to honour the client's preferences.

Sending `Accept: */*` or `Accept: image/*` and then adding the formats that are not yet widely supported is a good strategy. 

There may be some content out there that still relies on things like `Accept: image/png` or (as we see here) `Accept: image/svg+xml`. Seems like if we had some solid data, we could come up with a list of what formats are considered common enough to omit here.
Considering that we don't support WebP or JPEG-XR and no one really negotiates GIF vs. PNG, matching Safari makes sense to me.
we have consensus here to match safari. Will someone take the bug and submit a patch please?
Whiteboard: [necko-active]
Sure, I'll take it (looks like just a simple pref change).
Assignee: nobody → miket
This matches the behavior of Safari.
Comment on attachment 8724136 [details] [diff] [review]
Change default Accept header for images to */*. r=?

Patrick, would you mind reviewing (and let me know if I'm missing something obvious here)?
Attachment #8724136 - Flags: review?(mcmanus)
Comment on attachment 8724136 [details] [diff] [review]
Change default Accept header for images to */*. r=?

I see there's a number of tests I need to update, so let's hold off on review until I have those ready.
Attachment #8724136 - Flags: review?(mcmanus)
This matches the behavior of Safari.
Attachment #8724136 - Attachment is obsolete: true
Attachment #8724409 - Flags: review?(mcmanus)
Attachment #8724408 - Flags: review?(mcmanus)
Attachment #8724408 - Flags: review?(mcmanus) → review+
Attachment #8724409 - Flags: review?(mcmanus) → review+
Attachment #8724408 - Attachment is obsolete: true
This matches the behavior of Safari.
Attachment #8724904 - Flags: review+
Attachment #8724409 - Attachment is obsolete: true
Updating commit message, carrying forward r+.
https://hg.mozilla.org/mozilla-central/rev/c1a33cdbdb0b
https://hg.mozilla.org/mozilla-central/rev/1e076b4fd00f
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Depends on: 1282837
Depends on: 1289776
See Also: → 1865599
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: