GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: handle Headers in RedirectHandler by iiAku · Pull Request #3777 · nodejs/undici

Conversation

@iiAku

@iiAku iiAku commented Oct 27, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This relates to...

This should close #3773

Rationale

Changes

Features

Bug Fixes

Breaking Changes and Deprecations

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iiAku
fix: handle Headers in RedirectHandler
c1c78c2
@iiAku
iiAku force-pushed the fix/redirect-handler-headers branch from e4ddac9 to c1c78c2 Compare October 27, 2024 23:36
metcoder95
metcoder95 requested changes Oct 28, 2024
View reviewed changes

@metcoder95 metcoder95 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for it?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iiAku
fix: add testing
71c9baf
@iiAku
iiAku force-pushed the fix/redirect-handler-headers branch from b941ad4 to 71c9baf Compare October 28, 2024 18:00
@iiAku
iiAku requested a review from metcoder95 October 28, 2024 18:10
metcoder95
metcoder95 reviewed Oct 29, 2024
View reviewed changes
Comment thread lib/handler/redirect-handler.js Outdated
}

module.exports = RedirectHandler
module.exports.cleanRequestHeaders = cleanRequestHeaders

@metcoder95 metcoder95 Oct 29, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not do that if we are just exporting it to testing it out.

You can attempt to test the same on the redirect-request test suite where you submit a Headers instance instead of the array/object way.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iiAku reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@iiAku iiAku Oct 29, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests in appropriate file

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/handler/redirect-handler.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@iiAku
fix: tests
e4768c4
@iiAku
iiAku force-pushed the fix/redirect-handler-headers branch from 7c891d5 to e4768c4 Compare October 29, 2024 20:18
@iiAku
iiAku requested a review from metcoder95 October 29, 2024 20:42
metcoder95
metcoder95 approved these changes Oct 29, 2024
View reviewed changes
@metcoder95
Merge branch 'main' into fix/redirect-handler-headers
96092a5
@ronag
ronag merged commit dade9de into nodejs:main Nov 7, 2024
KhafraDev
KhafraDev reviewed Nov 7, 2024
View reviewed changes
Comment thread lib/handler/redirect-handler.js
}
} else if (headers && typeof headers === 'object') {
for (const key of Object.keys(headers)) {
const entries = headers instanceof Headers ? headers.entries() : Object.entries(headers)

@KhafraDev KhafraDev Nov 7, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work for Maps, only Headers

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ronag ronag Nov 8, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to check for Symbol.Iterable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ronag ronag Nov 8, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iiAku can you create a follow up PR?

const entries = utils.isIterable(headers) ? headers : Object.entries(headers)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

metcoder95, KhafraDev, and iiAku reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

@KhafraDev KhafraDev Nov 8, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also only works with the global Headers, not Headers imported from undici

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iiAku iiAku Nov 10, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iiAku can you create a follow up PR?

const entries = utils.isIterable(headers) ? headers : Object.entries(headers)

Yes I can look into this, thanks for reviewing raising that point @KhafraDev

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iiAku iiAku mentioned this pull request Nov 10, 2024
fix: handle undici Headers and Maps in redirect-handler #3819
Merged
7 tasks
flakey5 pushed a commit to flakey5/undici that referenced this pull request Nov 14, 2024
@iiAku @flakey5
fix: handle Headers in RedirectHandler (nodejs#3777)
13a3821
@github-actions github-actions Bot mentioned this pull request Dec 3, 2024
[Release] v7.1.0 #3922
Merged
This was referenced Dec 16, 2024
[Release] v7.1.1 #3952
Closed
[Release] v7.2.0 #3962
Merged
@github-actions github-actions Bot mentioned this pull request Mar 12, 2025
[Release] v6.21.2 #4092
Closed
@github-actions github-actions Bot mentioned this pull request May 12, 2025
[Release] v6.21.3 #4211
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ronag ronag ronag left review comments
@metcoder95 metcoder95 metcoder95 approved these changes
+1 more reviewer
@KhafraDev KhafraDev KhafraDev left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

RedirectHandler cleans headers too aggressively

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@iiAku @ronag @metcoder95 @KhafraDev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.