Closed Bug 1783686 Opened 3 years ago Closed 2 years ago

Add test case for early hints returned before redirects.

Categories

(Core :: Networking: HTTP, task, P2)

task

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: manuel, Assigned: manuel)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file, 2 obsolete files)

Early hints before cross origin redirects should get cancelled, early hints before same-origin redirects should get used.

https://html.spec.whatwg.org/multipage/semantics.html#early-hints

Early hints after cross origin redirects should get used even if there was an early hint before the cross origin redirect.

More specific:

This should use the preload

> GET /index.html HTTP/1.1
< 103 Early Hints
< Link: </image.png>; as=image; rel=preload
< 
< 302 Redirect
< Location: /alternate.html
< 
> GET /alternate.html HTTP/1.1
< 200 OK
< Content-Length: ...
< 
< <html><body><img src="/image.png"></body></html>

Only the first early hint should get preloaded, the second one should not get preloaded:

> GET /index.html HTTP/1.1
< 103 Early Hints
< Link: </image.png>; as=image; rel=preload
< 
< 302 Redirect
< Location: /alternate.html
<
> GET /alternate.html HTTP/1.1
< 103 Early Hints
< Link: </other.png>; as=image; rel=preload
< 
< 200 OK
< Content-Length: ...
< 
< <html><body><img src="/image.png"><img src="/other.png"></body></html>

This preload probably should not get used and can get cancelled when the redirect is returned:

> GET example.org/index.html HTTP/1.1
< 103 Early Hints
< Link: <https://example.net/image.png>; as=image; rel=preload
< 
< 302 Redirect
< Location: https://example.net/index.html
< 
> GET example.net/index.html HTTP/1.1
< 200 OK
< Content-Length: ...
< 
< <html><body><img src="/image.png"></body></html>

The preload should get started 1-2 times and the last preload should get used (no non-preload request to the image should get made)

> GET example.org/index.html HTTP/1.1
< 103 Early Hints
< Link: <https://example.net/image.png>; as=image; rel=preload
< 
< 302 Redirect
< Location: https://example.net/index.html
< 
> GET example.net/index.html HTTP/1.1
< 103 Early Hints
< Link: </image.png>; as=image; rel=preload
<
< 200 OK
< Content-Length: ...
< 
< <html><body><img src="/image.png"></body></html>
Severity: -- → S4
Priority: -- → P2
Assignee: nobody → mleclair
Attachment #9295908 - Attachment is obsolete: true
Attachment #9298139 - Attachment is obsolete: true
Assignee: mleclair → manuel

Also adds test cases in combination with redirect of main document

Fixing two bugs:

  • When cancelling all ongoing preloads the preload list wasn't cleared
  • After redirects all preloads were ignored due to no set in
    SetupReplacementChannel
Pushed by mbucher@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/53b4cf67f4f0 Fix Early Hints in combination with main document redirects r=necko-reviewers,kershaw
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
Duplicate of this bug: 1798716
See Also: → 1864057
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: