Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/advanced/ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
client = httpx.Client(verify=ctx)
```

Loding an alternative certificate verification store using [the standard SSL context API](https://docs.python.org/3/library/ssl.html)...
Loading an alternative certificate verification store using [the standard SSL context API](https://docs.python.org/3/library/ssl.html)...

```python
import httpx
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ filterwarnings = [
"ignore: trio.MultiError is deprecated since Trio 0.22.0:trio.TrioDeprecationWarning",
]
markers = [
"copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accodomate e.g. our test setup",
"copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accommodate e.g. our test setup",
"network: marks tests which require network connection. Used in 3rd-party build environments that have network disabled.",
"benchmark: marks CodSpeed benchmark tests under tests/test_benchmark.py.",
]
Expand Down
8 changes: 4 additions & 4 deletions src/httpcore2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Historical entries below are from upstream `encode/httpcore`.
## 1.0.5 (March 27th, 2024)

- Handle `EndOfStream` exception for anyio backend. (#899)
- Allow trio `0.25.*` series in package dependancies. (#903)
- Allow trio `0.25.*` series in package dependencies. (#903)

## 1.0.4 (February 21st, 2024)

Expand Down Expand Up @@ -142,7 +142,7 @@ The project versioning policy is now explicitly governed by SEMVER. See https://
- Allow `ws` and `wss` schemes. Allows us to properly support websocket upgrade connections. (#625)
- Forwarding HTTP proxies use a connection-per-remote-host. Required by some proxy implementations. (#637)
- Don't raise `RuntimeError` when closing a connection pool with active connections. Removes some error cases when cancellations are used. (#631)
- Lazy import `anyio`, so that it's no longer a hard dependancy, and isn't imported if unused. (#639)
- Lazy import `anyio`, so that it's no longer a hard dependency, and isn't imported if unused. (#639)

## 0.16.2 (November 25th, 2022)

Expand Down Expand Up @@ -200,7 +200,7 @@ The project versioning policy is now explicitly governed by SEMVER. See https://
## 0.14.1 (November 12th, 2021)

- `max_connections` becomes optional. (Pull #429)
- `certifi` is now included in the install dependancies. (Pull #428)
- `certifi` is now included in the install dependencies. (Pull #428)
- `h2` is now strictly optional. (Pull #428)

## 0.14.0 (November 11th, 2021)
Expand Down Expand Up @@ -265,7 +265,7 @@ Note that `curio` support is not currently available in 0.14.0. If you're using

### Fixed

- More resiliant testing for closed connections. (Pull #311)
- More resilient testing for closed connections. (Pull #311)
- Don't raise exceptions on ungraceful connection closes. (Pull #310)

## 0.13.0 (April 21st, 2021)
Expand Down
2 changes: 1 addition & 1 deletion src/httpcore2/docs/proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ If you use proxies, keep in mind that the `httpcore` package only supports proxi

The `httpcore` package also supports proxies using the SOCKS5 protocol.

Make sure to install the optional dependancy using `pip install 'httpcore[socks]'`.
Make sure to install the optional dependency using `pip install 'httpcore[socks]'`.

The `SOCKSProxy` class should be using instead of a standard connection pool:

Expand Down
2 changes: 1 addition & 1 deletion src/httpcore2/httpcore2/_async/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _assign_requests_to_connections(self) -> list[AsyncConnectionInterface]:
Called whenever a new request is added or removed from the pool.

Any closing connections are returned, allowing the I/O for closing
those connections to be handled seperately.
those connections to be handled separately.
"""
closing_connections = []

Expand Down
4 changes: 2 additions & 2 deletions src/httpcore2/httpcore2/_async/http11.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ async def handle_async_request(self, request: Request) -> Response:
await self._send_request_body(**kwargs)
except WriteError:
# If we get a write error while we're writing the request,
# then we supress this error and move on to attempting to
# then we suppress this error and move on to attempting to
# read the response. Servers can sometimes close the request
# pre-emptively and then respond with a well formed HTTP
# preemptively and then respond with a well formed HTTP
# error response.
pass

Expand Down
6 changes: 3 additions & 3 deletions src/httpcore2/httpcore2/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def enforce_headers(
value: HeadersAsMapping | HeadersAsSequence | None = None, *, name: str
) -> list[tuple[bytes, bytes]]:
"""
Convienence function that ensure all items in request or response headers
Convenience function that ensure all items in request or response headers
are either bytes or strings in the plain ASCII range.
"""
if value is None:
Expand Down Expand Up @@ -180,13 +180,13 @@ class URL:
"""
Represents the URL against which an HTTP request may be made.

The URL may either be specified as a plain string, for convienence:
The URL may either be specified as a plain string, for convenience:

```python
url = httpcore2.URL("https://www.example.com/")
```

Or be constructed with explicitily pre-parsed components:
Or be constructed with explicitly pre-parsed components:

```python
url = httpcore2.URL(scheme=b'https', host=b'www.example.com', port=None, target=b'/')
Expand Down
2 changes: 1 addition & 1 deletion src/httpcore2/httpcore2/_sync/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _assign_requests_to_connections(self) -> list[ConnectionInterface]:
Called whenever a new request is added or removed from the pool.

Any closing connections are returned, allowing the I/O for closing
those connections to be handled seperately.
those connections to be handled separately.
"""
closing_connections = []

Expand Down
4 changes: 2 additions & 2 deletions src/httpcore2/httpcore2/_sync/http11.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def handle_request(self, request: Request) -> Response:
self._send_request_body(**kwargs)
except WriteError:
# If we get a write error while we're writing the request,
# then we supress this error and move on to attempting to
# then we suppress this error and move on to attempting to
# read the response. Servers can sometimes close the request
# pre-emptively and then respond with a well formed HTTP
# preemptively and then respond with a well formed HTTP
# error response.
pass

Expand Down
2 changes: 1 addition & 1 deletion src/httpcore2/httpcore2/_synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ._exceptions import ExceptionMapping, PoolTimeout, map_exceptions

# Our async synchronization primatives use either 'anyio' or 'trio' depending
# Our async synchronization primitives use either 'anyio' or 'trio' depending
# on if they're running under asyncio or trio.

try:
Expand Down
2 changes: 1 addition & 1 deletion src/httpcore2/httpcore2/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def is_socket_readable(sock: socket.socket | None) -> bool:
"""
Return whether a socket, as identifed by its file descriptor, is readable.
Return whether a socket, as identified by its file descriptor, is readable.
"A socket is readable" means that the read buffer isn't empty, i.e. that calling
.recv() on it would immediately return some data.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/httpx2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Historical entries below are from upstream `encode/httpx`.

## 0.28.0 (28th November, 2024)

Be aware that the default *JSON request bodies now use a more compact representation*. This is generally considered a prefered style, tho may require updates to test suites.
Be aware that the default *JSON request bodies now use a more compact representation*. This is generally considered a preferred style, tho may require updates to test suites.

The 0.28 release includes a limited set of deprecations...

Expand Down Expand Up @@ -192,7 +192,7 @@ Our revised [SSL documentation](docs/advanced/ssl.md) covers how to implement th

### Removed

* The `rfc3986` dependancy has been removed. (#2252)
* The `rfc3986` dependency has been removed. (#2252)

## 0.23.3 (4th January, 2023)

Expand Down
2 changes: 1 addition & 1 deletion src/httpx2/httpx2/_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(self, name: str, value: FileTypes) -> None:
# This large tuple based API largely mirror's requests' API
# It would be good to think of better APIs for this that we could
# include in httpx 2.0 since variable length tuples(especially of 4 elements)
# are quite unwieldly
# are quite unwieldy
if isinstance(value, tuple):
if len(value) == 2:
# neither the 3rd parameter (content_type) nor the 4th (headers)
Expand Down
4 changes: 2 additions & 2 deletions src/httpx2/httpx2/_urlparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ def urlparse(url: str = "", **kwargs: str | None) -> ParseResult:
# Replace "raw_path" with "path" and "query".
if "raw_path" in kwargs:
raw_path = kwargs.pop("raw_path") or ""
kwargs["path"], seperator, kwargs["query"] = raw_path.partition("?")
if not seperator:
kwargs["path"], separator, kwargs["query"] = raw_path.partition("?")
if not separator:
kwargs["query"] = None

# Ensure that IPv6 "host" addresses are always escaped with "[...]".
Expand Down
12 changes: 6 additions & 6 deletions tests/httpcore2/_async/test_connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def test_connection_pool_with_keepalive():
)

async with httpcore2.AsyncConnectionPool(network_backend=network_backend, max_keepalive_connections=1) as pool:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
async with pool.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in pool.connections]
assert info == ["<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -99,7 +99,7 @@ async def test_connection_pool_with_close():
)

async with httpcore2.AsyncConnectionPool(network_backend=network_backend) as pool:
# Sending an intial request, which once complete will not return to the pool.
# Sending an initial request, which once complete will not return to the pool.
async with pool.stream("GET", "https://example.com/", headers={"Connection": "close"}) as response:
info = [repr(c) for c in pool.connections]
assert info == ["<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -148,7 +148,7 @@ async def test_connection_pool_with_http2():
async with httpcore2.AsyncConnectionPool(
network_backend=network_backend,
) as pool:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
response = await pool.request("GET", "https://example.com/")
assert response.status == 200
assert response.content == b"Hello, world!"
Expand Down Expand Up @@ -194,7 +194,7 @@ async def test_connection_pool_with_http2_goaway():
async with httpcore2.AsyncConnectionPool(
network_backend=network_backend,
) as pool:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
response = await pool.request("GET", "https://example.com/")
assert response.status == 200
assert response.content == b"Hello, world!"
Expand Down Expand Up @@ -420,7 +420,7 @@ async def test_connection_pool_with_immediate_expiry():
keepalive_expiry=0.0,
network_backend=network_backend,
) as pool:
# Sending an intial request, which once complete will not return to the pool.
# Sending an initial request, which once complete will not return to the pool.
async with pool.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in pool.connections]
assert info == ["<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -449,7 +449,7 @@ async def test_connection_pool_with_no_keepalive_connections_allowed():
)

async with httpcore2.AsyncConnectionPool(max_keepalive_connections=0, network_backend=network_backend) as pool:
# Sending an intial request, which once complete will not return to the pool.
# Sending an initial request, which once complete will not return to the pool.
async with pool.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in pool.connections]
assert info == ["<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down
6 changes: 3 additions & 3 deletions tests/httpcore2/_async/test_http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def test_proxy_forwarding():
max_connections=10,
network_backend=network_backend,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
async with proxy.stream("GET", "http://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == [
Expand Down Expand Up @@ -82,7 +82,7 @@ async def test_proxy_tunneling():
proxy=Proxy("http://localhost:8080/"),
network_backend=network_backend,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
async with proxy.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == [
Expand Down Expand Up @@ -162,7 +162,7 @@ async def test_proxy_tunneling_http2():
network_backend=network_backend,
http2=True,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
async with proxy.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == ["<AsyncTunnelHTTPConnection ['https://example.com:443', HTTP/2, ACTIVE, Request Count: 1]>"]
Expand Down
6 changes: 3 additions & 3 deletions tests/httpcore2/_async/test_socks_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def test_socks5_request():
proxy=httpcore2.Proxy("socks5://localhost:8080/"),
network_backend=network_backend,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
async with proxy.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == ["<AsyncSocks5Connection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -79,7 +79,7 @@ async def test_authenticated_socks5_request():
),
network_backend=network_backend,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
async with proxy.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == ["<AsyncSocks5Connection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -152,7 +152,7 @@ async def test_socks5_request_failed_to_provide_auth():
async def test_socks5_request_incorrect_auth():
"""
Attempt to send an HTTP request via an authenticated SOCKS proxy,
wit incorrect authentication credentials.
with incorrect authentication credentials.
"""
network_backend = httpcore2.AsyncMockBackend(
[
Expand Down
12 changes: 6 additions & 6 deletions tests/httpcore2/_sync/test_connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_connection_pool_with_keepalive():
)

with httpcore2.ConnectionPool(network_backend=network_backend, max_keepalive_connections=1) as pool:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
with pool.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in pool.connections]
assert info == ["<HTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_connection_pool_with_close():
)

with httpcore2.ConnectionPool(network_backend=network_backend) as pool:
# Sending an intial request, which once complete will not return to the pool.
# Sending an initial request, which once complete will not return to the pool.
with pool.stream("GET", "https://example.com/", headers={"Connection": "close"}) as response:
info = [repr(c) for c in pool.connections]
assert info == ["<HTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_connection_pool_with_http2():
with httpcore2.ConnectionPool(
network_backend=network_backend,
) as pool:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
response = pool.request("GET", "https://example.com/")
assert response.status == 200
assert response.content == b"Hello, world!"
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_connection_pool_with_http2_goaway():
with httpcore2.ConnectionPool(
network_backend=network_backend,
) as pool:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
response = pool.request("GET", "https://example.com/")
assert response.status == 200
assert response.content == b"Hello, world!"
Expand Down Expand Up @@ -420,7 +420,7 @@ def test_connection_pool_with_immediate_expiry():
keepalive_expiry=0.0,
network_backend=network_backend,
) as pool:
# Sending an intial request, which once complete will not return to the pool.
# Sending an initial request, which once complete will not return to the pool.
with pool.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in pool.connections]
assert info == ["<HTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down Expand Up @@ -449,7 +449,7 @@ def test_connection_pool_with_no_keepalive_connections_allowed():
)

with httpcore2.ConnectionPool(max_keepalive_connections=0, network_backend=network_backend) as pool:
# Sending an intial request, which once complete will not return to the pool.
# Sending an initial request, which once complete will not return to the pool.
with pool.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in pool.connections]
assert info == ["<HTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"]
Expand Down
6 changes: 3 additions & 3 deletions tests/httpcore2/_sync/test_http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_proxy_forwarding():
max_connections=10,
network_backend=network_backend,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
with proxy.stream("GET", "http://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == [
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_proxy_tunneling():
proxy=Proxy("http://localhost:8080/"),
network_backend=network_backend,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
with proxy.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == [
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_proxy_tunneling_http2():
network_backend=network_backend,
http2=True,
) as proxy:
# Sending an intial request, which once complete will return to the pool, IDLE.
# Sending an initial request, which once complete will return to the pool, IDLE.
with proxy.stream("GET", "https://example.com/") as response:
info = [repr(c) for c in proxy.connections]
assert info == ["<TunnelHTTPConnection ['https://example.com:443', HTTP/2, ACTIVE, Request Count: 1]>"]
Expand Down
Loading