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

fetch: fix small spec inconsistency #1158

Merged
merged 1 commit into from
Jan 4, 2022
Merged

fetch: fix small spec inconsistency #1158

merged 1 commit into from
Jan 4, 2022

Conversation

KhafraDev
Copy link
Member

@KhafraDev KhafraDev commented Jan 3, 2022

This condition is not yet possible to meet so I couldn't add a test
(sorry!).

  • response is always null
    let response = null
  • which means it is set here
    response = await (async () => {
    which always either returns a network error or sets the responseTainting to either opaque or cors.
  • Then this condition runs if there wasn't a network error (response.status === 0 would be a network error)
    if (response.status !== 0 && !response.internalResponse) {
  • Therefore responseTainting is never basic as of now.

The spec says that "[a] basic filtered response is a filtered response
whose type is "basic" and header list excludes any headers in internal
response’s header list whose name is a forbidden response-header name."
The library was incorrectly excluding valid headers.

If data:, blob:, about:, or file: URIs are ever supported, this
change will be needed.

This condition is not *yet* possible to meet so I couldn't add a test
(sorry!). The responseTainting is always set here or a network error is
returned (.status = 0 is a network error which makes the check never
pass):
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L529 and
the condition is always met because response is never set
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L475

The spec says that "[a] basic filtered response is a filtered response
whose type is "basic" and header list excludes any headers in internal
response’s header list whose name is a forbidden response-header name."
The library was incorrectly excluding valid headers.

If `data:`, `blob:`, `about:`, or `file:` URIs are ever supported, this
change will be needed.
@ronag
Copy link
Member

ronag commented Jan 4, 2022

Thanks!

@ronag ronag merged commit 01302e6 into nodejs:main Jan 4, 2022
@KhafraDev KhafraDev deleted the forbidden-response-headers branch January 4, 2022 20:07
KhafraDev added a commit to KhafraDev/undici that referenced this pull request Jun 23, 2022
This condition is not *yet* possible to meet so I couldn't add a test
(sorry!). The responseTainting is always set here or a network error is
returned (.status = 0 is a network error which makes the check never
pass):
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L529 and
the condition is always met because response is never set
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L475

The spec says that "[a] basic filtered response is a filtered response
whose type is "basic" and header list excludes any headers in internal
response’s header list whose name is a forbidden response-header name."
The library was incorrectly excluding valid headers.

If `data:`, `blob:`, `about:`, or `file:` URIs are ever supported, this
change will be needed.
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
This condition is not *yet* possible to meet so I couldn't add a test
(sorry!). The responseTainting is always set here or a network error is
returned (.status = 0 is a network error which makes the check never
pass):
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L529 and
the condition is always met because response is never set
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L475

The spec says that "[a] basic filtered response is a filtered response
whose type is "basic" and header list excludes any headers in internal
response’s header list whose name is a forbidden response-header name."
The library was incorrectly excluding valid headers.

If `data:`, `blob:`, `about:`, or `file:` URIs are ever supported, this
change will be needed.
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
This condition is not *yet* possible to meet so I couldn't add a test
(sorry!). The responseTainting is always set here or a network error is
returned (.status = 0 is a network error which makes the check never
pass):
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L529 and
the condition is always met because response is never set
https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L475

The spec says that "[a] basic filtered response is a filtered response
whose type is "basic" and header list excludes any headers in internal
response’s header list whose name is a forbidden response-header name."
The library was incorrectly excluding valid headers.

If `data:`, `blob:`, `about:`, or `file:` URIs are ever supported, this
change will be needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants