Skip to content

perf(client): only re-parse the response URL after a redirect - #3124

Open
patrick-immometrica wants to merge 2 commits into
seanmonstar:masterfrom
patrick-immometrica:perf-response-url-reparse
Open

patrick-immometrica wants to merge 2 commits into
seanmonstar:masterfrom
patrick-immometrica:perf-response-url-reparse

Conversation

@patrick-immometrica

@patrick-immometrica patrick-immometrica commented Oct 24, 2026 •

Copy link
Copy Markdown

FollowRedirect puts a RequestUri extension on every response, not only on redirected ones. PendingRequest turned that Uri into a string and re-parsed it with Url::parse on every request. Without a redirect, the result is just the request URL minus the fragment.

Now it compares the Uri to the request URL up to the query. If they match, it only clears the fragment. If they differ, it parses as before. Behavior is unchanged: the fragment is still dropped.

A micro benchmark puts the to_string + parse at 0.7–1 µs and the comparison at under 0.1 µs, so this saves under 1 µs per request. Small, but it's on every request.

The test checks res.url() for a plain request and for one with a fragment.

@patrick-immometrica
patrick-immometrica marked this pull request as ready for review October 24, 2026 23:30
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 16, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 16, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 16, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 16, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 16, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 16, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 18, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 20, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
Byron pushed a commit to GitoxideLabs/gitoxide that referenced this pull request Nov 24, 2026
Port the source worktree commit into `gix-reqwest`, retaining its author.
Retarget Rust crate paths and preserve upstream formatting.

Port validation: library, proxy, redirect, blocking, and client tests pass
with the stable optional features enabled; external TLS-info tests are
excluded.

Reqwest-Patch: 65ed14e531b2feb034704b4d51ea8ab9844066ec
Reqwest-PR: seanmonstar/reqwest#3124

Original source message:

perf(client): only re-parse the response URL after a redirect

<!-- agent -->
Transplanted from seanmonstar/reqwest#3124.
Original commit: f079b71656dab2ab61f6545d5d66231e22ff9aa7.
Included in the reqwest patch stack for Gitoxide transport correctness, security, or transfer efficiency.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
perf(client): only re-parse the response URL after a redirect
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.

1 participant