Skip to content

Omit the IPv6 zone from the Host header - #1360

Open
Kludex wants to merge 4 commits into
mainfrom
omit-ipv6-zone-from-host-header
Open

Kludex wants to merge 4 commits into
mainfrom
omit-ipv6-zone-from-host-header

Conversation

@Kludex

@Kludex Kludex commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #676.

A URL with an IPv6 zone, such as http://[fe80::1%en0]/, sent the zone in the Host header:

Host: [fe80::1%en0]

The zone names a network interface on the client. It means nothing to the server, and #676 reports that Apache and lighttpd reject the request. RFC 9844, section 6 says zone identifiers "must not be sent on the wire", and curl strips it too.

The Host header is now [fe80::1], both for a new Request and when a redirect changes the origin. An explicit Host header is left alone.

URL.netloc and URL.host keep the zone. The connection still needs it to pick the interface, and cookies stay scoped to it.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Session: pi --session 01a20ced-af54-7647-a636-b3d9c9458448

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T09:51:18.869755Z 54b542b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@veria-ai

veria-ai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Reviews

@codspeed

codspeed Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 18 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing omit-ipv6-zone-from-host-header (a45cf86) with main (538b256)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

View guided diff | Re-trigger cubic

Comment thread src/httpx2/httpx2/_urls.py Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread tests/httpx2/client/test_headers.py Resolved

This branch has not been deployed

No deployments
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.

Httpx includes ipv6 scope in Host header

1 participant