Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions httpx/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _redirect_method(self, request: Request, response: Response) -> str:
"""
method = request.method

# https://tools.ietf.org/html/rfc7231#section-6.4.4
# https://tools.ietf.org/html/rfc9110#section-15.4.4
if response.status_code == codes.SEE_OTHER and method != "HEAD":
method = "GET"

Expand Down Expand Up @@ -532,12 +532,12 @@ def _redirect_url(self, request: Request, response: Response) -> URL:
if url.scheme and not url.host:
url = url.copy_with(host=request.url.host)

# Facilitate relative 'Location' headers, as allowed by RFC 7231.
# Facilitate relative 'Location' headers, as allowed by RFC 9110.
# (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
if url.is_relative_url:
url = request.url.join(url)

# Attach previous fragment if needed (RFC 7231 7.1.2)
# Attach previous fragment if needed (RFC 9110 10.2.2)
if request.url.fragment and not url.fragment:
url = url.copy_with(fragment=request.url.fragment)

Expand Down
2 changes: 1 addition & 1 deletion httpx/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def __getitem__(self, key: str) -> str:
Return a single header value.

If there are multiple headers with the same key, then we concatenate
them with commas. See: https://tools.ietf.org/html/rfc7230#section-3.2.2
them with commas. See: https://tools.ietf.org/html/rfc9110#section-5.3
"""
normalized_key = key.lower().encode(self.encoding)

Expand Down
2 changes: 1 addition & 1 deletion httpx/_urlparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def encode_host(host: str) -> str:
# From https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.2
#
# "A host identified by an Internet Protocol literal address, version 6
# [RFC3513] or later, is distinguished by enclosing the IP literal
# [RFC4291] or later, is distinguished by enclosing the IP literal
# within square brackets ("[" and "]"). This is the only place where
# square bracket characters are allowed in the URI syntax."
try:
Expand Down
Loading