Skip to content

feat(follow_redirect): Preserve extensions during redirection#581

Open
0x676e67 wants to merge 9 commits into
tower-rs:mainfrom
0x676e67:feat
Open

feat(follow_redirect): Preserve extensions during redirection#581
0x676e67 wants to merge 9 commits into
tower-rs:mainfrom
0x676e67:feat

Conversation

@0x676e67
Copy link
Copy Markdown
Contributor

@0x676e67 0x676e67 commented Jun 6, 2025

Motivation

Extensions are passed during request redirection. Extensions that currently rely on http 1.x are now cloneable.

https://github.com/hyperium/http/blob/613d3d465f222666327d61f5971133cad155f190/src/extensions.rs#L35

Solution

Solve some scenarios where redirection requires passing Extensions

@0x676e67 0x676e67 changed the title Feat feat(follow_redirect): Preserve extensions during redirection Jun 6, 2025
@0x676e67
Copy link
Copy Markdown
Contributor Author

0x676e67 commented Jun 6, 2025

Is this approach justifiable?

Comment thread tower-http/src/follow_redirect/mod.rs Outdated
Co-authored-by: Daiki Mizukami <tesaguriguma@gmail.com>
@0x676e67
Copy link
Copy Markdown
Contributor Author

0x676e67 commented Jun 6, 2025

Four hours ago, tracing-core updated its version and upgraded msrv. CI seems to have failed because of this.

@tesaguri
Copy link
Copy Markdown
Contributor

tesaguri commented Jun 6, 2025

Although I was not involved in #348, I guess it was a mere oversight that the design decision to drop extensions hadn't been revisited in the migration to http v1.

That said, I think it's a breaking change so the commit message should clearly make that clear, as required in the CONTRIBUTING.md. But, well, the contributing guidelines also prohibit one from rebasing the branch after opening a PR. I wonder how are non-conforming commit messages supposed to be handled then?

@jplatte
Copy link
Copy Markdown
Member

jplatte commented Jun 6, 2025

Well, FWIW I didn't know this repo had a CONTRIBUTING.md 😅
@seanmonstar do you care about the stuff in there? In particular force-pushes to PRs?

@seanmonstar
Copy link
Copy Markdown
Collaborator

Eh, I don't know where all that came from, was it imported from Tokio?

I don't personally care if people force push PRs. I know some people like to see the incremental changes after review passes, but I always have to review the entire change before I click merge, so I don't care.

Copy link
Copy Markdown
Member

@jlizen jlizen left a comment

Choose a reason for hiding this comment

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

@0x676e67 Sorry for the slow review...

I think that this was probably an oversight to omit, but there are security implications to turning it on. Extensions can leak sensitive information that previously was dropped. So certainly a breaking change.

We should also keep parity with the headers APIs and have FilterCredentials support for opt out via policy. It's a trickier problem than headers since mostly userspace types that we can't have a default excludelist for. I guess we could do some clever things if we have any types gated behind peer feature flags that we want to filter out.

Otherwise it seems like its mostly a user-provided filter. Probably something doable with macros to make it not-horrid to pass in a static list of type names/ids.

A simpler and non-breaking option would just be a opt-in API. (Long term I think it should be opt-out, but it can be a follow up)

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.

5 participants