Skip to content

Reject out-of-range URL ports (0–65535) - #198

Open
Pitchfork-and-Torch wants to merge 2 commits into
python-hyper:masterfrom
Pitchfork-and-Torch:cook/reject-out-of-range-ports
Open

Pitchfork-and-Torch wants to merge 2 commits into
python-hyper:masterfrom
Pitchfork-and-Torch:cook/reject-out-of-range-ports

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown

Summary

URL.from_text() and URL() accepted ports outside 0–65535 (e.g. -1, 65536, 99999) after int() conversion. Validate the range on parse (URLParseError) and construction (ValueError).

Distinct from #192 / malformed digit strings — this is numeric range enforcement.

Test plan

  • Manual: URL.from_text("http://ex.com:-1") / :65536 / :99999 raise URLParseError
  • Manual: URL(..., port=-1) raises ValueError
  • :8080 and :65535 still accepted
URL.from_text() and URL() accepted ports like -1 and 65536/99999 after
int() conversion. Validate the TCP/UDP port range on parse and
construction so callers get URLParseError/ValueError instead of
serializing illegal authorities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant