Skip to content

fix(redirect): clear stale Referer on HTTPS downgrade - #3140

Open
shuvroroy wants to merge 1 commit into
seanmonstar:masterfrom
shuvroroy:fix/redirect-referer-downgrade
Open

shuvroroy wants to merge 1 commit into
seanmonstar:masterfrom
shuvroroy:fix/redirect-referer-downgrade

Conversation

@shuvroroy

Copy link
Copy Markdown

An HTTPS → HTTPS → HTTP redirect chain can retain an earlier HTTPS URL in Referer, including its query parameters, on the final HTTP request. Remove the stale header when automatic referer generation is disallowed by a downgrade.

Add an eight-case middleware regression test covering HTTP and HTTPS destinations, existing Referer headers, and .referer(false). The regression fails before the fix and passes afterward.

Validation:

  • Unit and redirect tests pass with default TLS plus blocking/cookies, no default features, and native TLS.
  • Documentation tests, cargo check --lib, cargo fmt -- --check, and git diff --check pass.
  • The local HTTPS → HTTPS → HTTP server reproduction passes.

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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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.

Adapt the new redirect-policy test to the proxy-aware constructor here,
bringing forward that part of source commit `e41ec35` so this commit builds.

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

Reqwest-Patch: 315345fdedaef7c75d134b8ee8923da96a578ef1
Reqwest-PR: seanmonstar/reqwest#3140

Original source message:

fix(redirect): clear stale Referer on HTTPS downgrade

<!-- agent -->
Transplanted from seanmonstar/reqwest#3140.
Original commit: 49cb173c9ecd39eb0476fc46ae73ebac488e7eef.
Compatible with filtered-header carry-forward in tower-http 0.7.1. Proxy-aware policy test adaptation belongs in a separate follow-up.
The source patch is preserved; local changes are kept in separate commits.

<!-- original message -->
fix(redirect): clear stale Referer on HTTPS downgrade
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