Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

www.booking.com - Server sends JPEG2000 images in the Raw HTML to Safari on iOS #133697

Closed
karlcow opened this issue Feb 21, 2024 — with webcompat-app · 7 comments
Closed
Assignees
Labels
browser-safari priority-important type-image Issues with specific images rendering differently (the server is sending the same image to each UA). type-server-issue Server configuration issue
Milestone

Comments

@karlcow
Copy link
Member

karlcow commented Feb 21, 2024

URL: https://www.booking.com/hotel/us/milpitas-40-ranch-drive.html

Browser / Version: Safari 17.4
Operating System: iOS 17.4
Tested Another Browser: Yes Firefox

Problem type: Design is broken
Description: Images not loaded
Steps to Reproduce:

  1. On iPhone with Safari
  2. Go to https://www.booking.com/hotel/us/milpitas-40-ranch-drive.html

Expected:
See the images

Actual:
Images are not visible.

View the screenshot Screenshot
Browser Configuration
  • gfx.webrender.software: false
  • blockList: basic
  • hasTouchScreen: false
  • frameworks: {'fastclick': False, 'mobify': False, 'marfeel': False}
  • mixed active content blocked: false
  • mixed passive content blocked: false
  • tracking content blocked: false

View console log messages

From webcompat.com with ❤️

@karlcow
Copy link
Member Author

karlcow commented Feb 21, 2024

booking.com is doing a combination of User-Agent and Accept HTTP headers sniffing.
Safari on iOS is receiving JPEG2000 (extension .jp2) images in raw HTML responses, while Firefox on Android is receiving simple JPEG (extension .jpg).

JPEG2000

    <img class="swpg__image swpg__image--cover-y js-preloaded-low-res-image"
         src="https://cf.bstatic.com/xdata/images/hotel/max200/217608701.jp2?k=3fe774144faa575ffcce19274fe85b5e43227fba1568cb612902b40a6dced873&o=&hp=1"
         alt="a building with palm trees in front of it at Larkspur Landing Milpitas-An All-Suite Hotel in Milpitas"
         onerror="" />

JPEG

<img class="swpg__image swpg__image--cover-y js-preloaded-low-res-image"
         src="https://cf.bstatic.com/xdata/images/hotel/max200/217608701.jpg?k=3fe774144faa575ffcce19274fe85b5e43227fba1568cb612902b40a6dced873&o=&hp=1"
         alt="a building with palm trees in front of it at Larkspur Landing Milpitas-An All-Suite Hotel in Milpitas"
         onerror="" />

We determined that this was due to a combination of User-Agent and Accept headers.

Firefox on Android is sending for HTML resources

User-Agent: Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-G973U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/14.2 Chrome/87.0.4280.141 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8

Safari on iOS is sending for HTML resources:

User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

But if we use the Safari on iOS User Agent with the accept header of Firefox:

User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8

Booking.com is sending the normal JPG in the raw HTML response.

Note: Safari on MacOS with the same Accept header receives the normal JPEG.

Why does it matter?

On https://bugs.webkit.org/show_bug.cgi?id=178758
WebKit is removing the support for JPEG2000
This will be released in future versions of Safari.
See the Pull Request WebKit/WebKit#3824

So booking.com needs to fix their HTTP responses and not single out Safari.
Both Firefox and Chrome do not support JPEG2000.

Relevant bug in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=jpeg2000
Relevant bug in Chrome https://issues.chromium.org/issues/41350700
And https://caniuse.com/jpeg2000

Moving to needscontact

@karlcow karlcow modified the milestones: needsdiagnosis, needscontact Feb 21, 2024
@karlcow
Copy link
Member Author

karlcow commented Feb 21, 2024

@bookingcom is on GitHub and currently list 9 people.

Maybe @andrew-grechkin could help us find the right person at Booking.com to solve this server side issue which will send broken JPEG images on Safari on iOS in the future.

@karlcow karlcow modified the milestones: needscontact, sitewait Feb 21, 2024
@karlcow karlcow added type-server-issue Server configuration issue type-image Issues with specific images rendering differently (the server is sending the same image to each UA). labels Feb 21, 2024
@karlcow karlcow self-assigned this Feb 21, 2024
@karlcow karlcow changed the title www.booking.com - design is broken www.booking.com - Server sends JPEG2000 images in the Raw HTML to Safari on iOS Feb 21, 2024
@karlcow
Copy link
Member Author

karlcow commented Feb 21, 2024

Note that if there is no fix on the side of booking.com, the WebKit team will have to implement a Quirk to trick the server into sending simple JPEGs.
This is https://bugs.webkit.org/show_bug.cgi?id=269875

@andrew-grechkin
Copy link

I have passed this issue to our engineers responsible for front-end and iOS. Now we need to wait a little bit.

@karlcow
Copy link
Member Author

karlcow commented Feb 22, 2024

@andrew-grechkin Thanks a lot.
In the process of creating a Quirk at the same time if necessary.
We can remove it when this is resolved on your side.
WebKit/WebKit#24923

webkit-commit-queue pushed a commit to karlcow/WebKit that referenced this issue Feb 23, 2024
https://bugs.webkit.org/show_bug.cgi?id=269875
rdar://123408770

Reviewed by Chris Dumez.

In webkit.org/b/178758, the support for JPEG2000 was removed from
WebKit. Booking.com is doing content negociation on both the
User-Agent string and the HTTP accept header. The website sends
JPEG2000 assets to Safari on iOS. An outreach effort has been started
to make sure that booking fixes their servers.
See webcompat/web-bugs#133697

No other breakage has been detected yet, but we know that Cloudinary
is currently JPEG2000 images for some websites on both iOS and macOS.
It might break once this release of WebKit reaches Safari. An ongoing
effort has started to avoid this so that Cloudinary can adjust their
rules and warn their customers.

In the meantime this Quirk sends a different HTTP Accept header for
booking.com tricking the server into sending compatible image resources
for HTML requests instead of JPEG2000.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::updateRequestAndAddExtraFields):
* Source/WebCore/loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::acceptHeaderValueFromType):
(WebCore::CachedResourceRequest::setAcceptHeaderIfNone):
* Source/WebCore/loader/cache/CachedResourceRequest.h:
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldSendLongerAcceptHeaderQuirk):
* Source/WebCore/page/Quirks.h:

Canonical link: https://commits.webkit.org/275216@main
@lucrocha
Copy link

Hi. Booking.com no longer sends jp2 files (since 20240308).

@karlcow karlcow modified the milestones: sitewait, fixed Mar 12, 2024
@karlcow
Copy link
Member Author

karlcow commented Mar 12, 2024

Thanks @lucrocha
Wonderful. Do not hesitate to reach out to me for any future issues about WebKit.

I will remove the Quirk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-safari priority-important type-image Issues with specific images rendering differently (the server is sending the same image to each UA). type-server-issue Server configuration issue
Projects
None yet
Development

No branches or pull requests

4 participants