Skip to content

Conversation

@Xuanwo
Copy link
Contributor

@Xuanwo Xuanwo commented Apr 30, 2025

This PR is part of #2641, and will close #2440 and #353, maybe relate to #2617


This PR has the following changes:

  • Change PolicyKind::Custom from Box to Arc to make it Clone. That's required by inserting into http::Extensions
  • Introduce config::RedirectPolicy
  • Add public API Request::redirect and Request::redirect_mut

There are some chore changes (I'm open to move them to a seperate PR)

  • Change all usage of config from Xxx to config::Xxx to make it more clear.
  • Move Request::version to front for better API organization.

@seanmonstar
Copy link
Owner

Just noting that this might conflict with #2576 that someone else is actively working on.

@Xuanwo
Copy link
Contributor Author

Xuanwo commented May 1, 2025

Just noting that this might conflict with #2576 that someone else is actively working on.

Thank you for your note.

My motivation for choosing to work on redirect::Policy is that it's a complex struct rather than a simple Duration. By using this struct, I can evaluate whether my previous configuration design is effective.

Another reason is that this is a feature request that others have also asked for. If we can merge this first, it will help us address those related issues.

I'm fine to begin this work once #2576 has been resolved if you prefer. It's clear that if #2617 is merged as it currently stands, incorporating it at the request level could become more complicated.

@0x676e67
Copy link
Contributor

@Xuanwo Do you have any new ideas for integrating #2617? HyperClient and RedirectPolicy are wrapped into FollowRedirect. If RedirectPolicy is set at the request level, it means that the FollowRedirect wrapper needs to be recreated every time

@Xuanwo
Copy link
Contributor Author

Xuanwo commented May 28, 2025

@Xuanwo Do you have any new ideas for integrating #2617? HyperClient and RedirectPolicy are wrapped into FollowRedirect. If RedirectPolicy is set at the request level, it means that the FollowRedirect wrapper needs to be recreated every time

I'll take another look when I have some time. However, since the wrapper itself doesn't add much overhead, it may be acceptable to recreate it each time.

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.

Per-Request RedirectPolicy

3 participants