ssl2 2.0.0__tar.gz → 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ssl2
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: PEP 748 TLS interface: typed ClientHello model and parser, JA3, JA4 and Akamai fingerprints, proxies, sockets and asyncio streams
5
5
  Requires-Python: >=3.14
6
6
  Project-URL: Repository, https://github.com/baobien-dev/ssl2
@@ -150,7 +150,7 @@ proxy = Proxy.parse("socks5h://user:secret@proxy.example:1080") # http, https,
150
150
  print(proxy.scheme, proxy.host, proxy.port, proxy.credentials)
151
151
  ```
152
152
 
153
- `socks4` and `socks5` resolve the destination locally, `socks4a`, `socks5h` and the HTTP schemes let the proxy resolve it, and an `https` proxy carries TLS inside TLS with the same client context. A refusal raises `ProxyError` with the proxy's reason.
153
+ `socks4` and `socks5` resolve the destination locally, `socks4a`, `socks5h` and the HTTP schemes let the proxy resolve it, and an `https` proxy carries TLS inside TLS with the same client context, or with `proxy_context=` on `connect` when given; CONNECT is HTTP/1.1, so that context should offer only `http/1.1`. A refusal raises `ProxyError` with the proxy's reason.
154
154
 
155
155
  ## Sockets and streams on any engine
156
156
 
@@ -142,7 +142,7 @@ proxy = Proxy.parse("socks5h://user:secret@proxy.example:1080") # http, https,
142
142
  print(proxy.scheme, proxy.host, proxy.port, proxy.credentials)
143
143
  ```
144
144
 
145
- `socks4` and `socks5` resolve the destination locally, `socks4a`, `socks5h` and the HTTP schemes let the proxy resolve it, and an `https` proxy carries TLS inside TLS with the same client context. A refusal raises `ProxyError` with the proxy's reason.
145
+ `socks4` and `socks5` resolve the destination locally, `socks4a`, `socks5h` and the HTTP schemes let the proxy resolve it, and an `https` proxy carries TLS inside TLS with the same client context, or with `proxy_context=` on `connect` when given; CONNECT is HTTP/1.1, so that context should offer only `http/1.1`. A refusal raises `ProxyError` with the proxy's reason.
146
146
 
147
147
  ## Sockets and streams on any engine
148
148
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ssl2"
3
- version = "2.0.0"
3
+ version = "2.0.1"
4
4
  description = "PEP 748 TLS interface: typed ClientHello model and parser, JA3, JA4 and Akamai fingerprints, proxies, sockets and asyncio streams"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ssl2"
3
- version = "2.0.0"
3
+ version = "2.0.1"
4
4
  description = "PEP 748 TLS interface: typed ClientHello model and parser, JA3, JA4 and Akamai fingerprints, proxies, sockets and asyncio streams"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -109,9 +109,12 @@ class TLSStream:
109
109
  *,
110
110
  proxy: Proxy | None = None,
111
111
  timeout: float | None = None,
112
+ proxy_context: ClientContext | None = None,
112
113
  ) -> Self:
113
114
  async with asyncio.timeout(timeout):
114
- tunnel = await cls.tunnel(context, address, proxy)
115
+ tunnel = await cls.tunnel(
116
+ context if proxy_context is None else proxy_context, address, proxy
117
+ )
115
118
  try:
116
119
  buffer = context.create_buffer(address[0])
117
120
  if tunnel.socket is not None and not tunnel.leftover:
@@ -196,6 +196,7 @@ class TLSSocket:
196
196
  *,
197
197
  proxy: Proxy | None = None,
198
198
  timeout: float | None = None,
199
+ proxy_context: ClientContext | None = None,
199
200
  ) -> Self:
200
201
  buffer = context.create_buffer(address[0])
201
202
  if proxy is None:
@@ -203,7 +204,11 @@ class TLSSocket:
203
204
  context, buffer, socket.create_connection(address, timeout=timeout)
204
205
  )
205
206
  if proxy.scheme is ProxyScheme.HTTPS:
206
- hop = cls.connect(context, (proxy.host, proxy.port), timeout=timeout)
207
+ hop = cls.connect(
208
+ context if proxy_context is None else proxy_context,
209
+ (proxy.host, proxy.port),
210
+ timeout=timeout,
211
+ )
207
212
  try:
208
213
  return cls.open(context, buffer, hop, cls._tunnel(proxy, address, hop))
209
214
  except BaseException:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes