Skip to content

Add public Origin API - #1134

Merged
Kludex merged 5 commits into
mainfrom
feature/origin
Aug 13, 2026
Merged

Kludex merged 5 commits into
mainfrom
feature/origin

Conversation

@Kludex

@Kludex Kludex commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add a public, immutable, and hashable Origin value object
  • expose normalized origins through URL.origin
  • support effective ports for FTP, HTTP(S), and WS(S), including canonical IPv6 comparison
  • use the shared value object for existing origin comparisons
  • document and test the public API

Motivation

Applications and integrations sometimes need a reusable representation of a URL's scheme, host, and effective port. Origin provides that representation without including user information, paths, queries, or fragments.

Testing

  • pytest: 1,967 passed, 1 skipped
  • ruff format --check --diff
  • ruff check
  • mypy src/httpx2 tests/httpx2 src/httpcore2 tests/httpcore2
  • python scripts/unasync.py --check

Review in cubic

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

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

codspeed Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 17 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing feature/origin (afb84bb) with main (a966320)

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. ↩

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e05ae1c01

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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 7 files

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

Re-trigger cubic

Comment thread src/httpx2/httpx2/_urls.py Resolved
Comment thread src/httpx2/CHANGELOG.md Resolved
Comment thread src/httpx2/httpx2/_urls.py Resolved
Comment thread src/httpx2/httpx2/_urls.py Resolved
Comment thread tests/httpx2/client/test_headers.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 3 files (changes from recent commits).

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

Re-trigger cubic

Comment thread src/httpx2/httpx2/_urls.py Resolved
Comment thread src/httpx2/httpx2/_urls.py Resolved
@veria-ai

veria-ai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

PR overview

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

Security review

No open security issues remain on this pull request.

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

Comment thread src/httpx2/httpx2/_urls.py Resolved
Comment thread src/httpx2/httpx2/_client.py Resolved
@Kludex
Kludex merged commit d03f1ec into main Aug 13, 2026
19 checks passed
@Kludex
Kludex deleted the feature/origin branch August 13, 2026 12:25
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 25, 2026
## 2.12.0 (August 18th, 2026)

### Changed

* Use `backports.zstd` for Zstandard decoding on Python 3.13 and earlier.
  ([#1146](pydantic/httpx2#1146))

### Fixed

* Bound peak memory while streaming compressed responses and close response streams when decoding fails.
  ([#1126](pydantic/httpx2#1126))

## 2.11.0 (August 18th, 2026)

### Added

* Add the public `Origin` value object and `URL.origin` property for normalized,
  hashable origin comparisons. ([#1134](pydantic/httpx2#1134))

### Changed

* Require Brotli 1.2.0 or later for the `brotli` extra. ([#1141](pydantic/httpx2#1141))

### Fixed

* Restore deprecated status code aliases. ([#1135](pydantic/httpx2#1135))
* Extract HTTP/2 release notes from changelog headings correctly. ([#1136](pydantic/httpx2#1136))
* Respect explicit `Transfer-Encoding` headers and expose buffered request body lengths to WSGI applications.
  ([#1137](pydantic/httpx2#1137))
* Validate multipart part header names and values before serialization.
  ([#1142](pydantic/httpx2#1142))
tsutsui pushed a commit to tsutsui/pkgsrc that referenced this pull request Oct 17, 2026
## 2.12.0 (August 18th, 2026)

### Changed

* Use `backports.zstd` for Zstandard decoding on Python 3.13 and earlier.
  ([#1146](pydantic/httpx2#1146))

### Fixed

* Bound peak memory while streaming compressed responses and close response streams when decoding fails.
  ([#1126](pydantic/httpx2#1126))

## 2.11.0 (August 18th, 2026)

### Added

* Add the public `Origin` value object and `URL.origin` property for normalized,
  hashable origin comparisons. ([#1134](pydantic/httpx2#1134))

### Changed

* Require Brotli 1.2.0 or later for the `brotli` extra. ([#1141](pydantic/httpx2#1141))

### Fixed

* Restore deprecated status code aliases. ([#1135](pydantic/httpx2#1135))
* Extract HTTP/2 release notes from changelog headings correctly. ([#1136](pydantic/httpx2#1136))
* Respect explicit `Transfer-Encoding` headers and expose buffered request body lengths to WSGI applications.
  ([#1137](pydantic/httpx2#1137))
* Validate multipart part header names and values before serialization.
  ([#1142](pydantic/httpx2#1142))

This branch was previously deployed

1 inactive deployment
cloudflare — afb84bbd Deployed Aug 13, 2026 by Kludex via Docs preview (Cloudflare) #693
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