lkrequest 0.1.1__tar.gz → 0.2.0__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.
Files changed (81) hide show
  1. {lkrequest-0.1.1 → lkrequest-0.2.0}/CHANGELOG.md +12 -0
  2. {lkrequest-0.1.1 → lkrequest-0.2.0}/Cargo.lock +129 -128
  3. {lkrequest-0.1.1 → lkrequest-0.2.0}/Cargo.toml +1 -1
  4. {lkrequest-0.1.1 → lkrequest-0.2.0}/PKG-INFO +18 -2
  5. {lkrequest-0.1.1 → lkrequest-0.2.0}/README-zh.md +17 -1
  6. {lkrequest-0.1.1 → lkrequest-0.2.0}/README.md +17 -1
  7. {lkrequest-0.1.1 → lkrequest-0.2.0}/pyproject.toml +1 -1
  8. {lkrequest-0.1.1 → lkrequest-0.2.0}/python/lkrequest/__init__.py +6 -0
  9. {lkrequest-0.1.1 → lkrequest-0.2.0}/python/lkrequest/_lkrequest.pyi +39 -0
  10. lkrequest-0.2.0/src/bridge.rs +275 -0
  11. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/client.rs +77 -2
  12. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/fingerprint.rs +36 -0
  13. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/lib.rs +36 -0
  14. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/proxy.rs +1 -1
  15. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/quic.rs +10 -0
  16. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/response.rs +5 -5
  17. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/session.rs +6 -6
  18. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/session_pool.rs +7 -7
  19. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/types.rs +4 -2
  20. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/websocket.rs +5 -5
  21. {lkrequest-0.1.1 → lkrequest-0.2.0}/tests/conftest.py +48 -1
  22. {lkrequest-0.1.1 → lkrequest-0.2.0}/tests/test_advanced.py +39 -0
  23. {lkrequest-0.1.1 → lkrequest-0.2.0}/tests/test_followup_features.py +69 -1
  24. lkrequest-0.2.0/tests/test_local_server.py +413 -0
  25. lkrequest-0.1.1/tests/test_local_server.py +0 -120
  26. {lkrequest-0.1.1 → lkrequest-0.2.0}/.editorconfig +0 -0
  27. {lkrequest-0.1.1 → lkrequest-0.2.0}/.github/workflows/ci.yml +0 -0
  28. {lkrequest-0.1.1 → lkrequest-0.2.0}/.gitignore +0 -0
  29. {lkrequest-0.1.1 → lkrequest-0.2.0}/CONTRIBUTING.md +0 -0
  30. {lkrequest-0.1.1 → lkrequest-0.2.0}/LICENSE +0 -0
  31. {lkrequest-0.1.1 → lkrequest-0.2.0}/NOTICE +0 -0
  32. {lkrequest-0.1.1 → lkrequest-0.2.0}/SECURITY.md +0 -0
  33. {lkrequest-0.1.1 → lkrequest-0.2.0}/benchmarks/README.md +0 -0
  34. {lkrequest-0.1.1 → lkrequest-0.2.0}/benchmarks/bench_latency.py +0 -0
  35. {lkrequest-0.1.1 → lkrequest-0.2.0}/benchmarks/bench_memory.py +0 -0
  36. {lkrequest-0.1.1 → lkrequest-0.2.0}/benchmarks/bench_throughput.py +0 -0
  37. {lkrequest-0.1.1 → lkrequest-0.2.0}/benchmarks/requirements.txt +0 -0
  38. {lkrequest-0.1.1 → lkrequest-0.2.0}/build.rs +0 -0
  39. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/accept_encoding.py +0 -0
  40. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/authentication.py +0 -0
  41. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/basic_requests.py +0 -0
  42. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/browser_fingerprints.py +0 -0
  43. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/certificate_config.py +0 -0
  44. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/client_pool.py +0 -0
  45. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/connection_prewarming.py +0 -0
  46. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/cookie_management.py +0 -0
  47. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/custom_fingerprint.py +0 -0
  48. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/error_handling.py +0 -0
  49. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/event_hooks.py +0 -0
  50. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/fingerprint_validation.py +0 -0
  51. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/http_methods.py +0 -0
  52. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/logging_config.py +0 -0
  53. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/metrics.py +0 -0
  54. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/middleware.py +0 -0
  55. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/multipart_upload.py +0 -0
  56. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/pool_stats.py +0 -0
  57. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/proxy_pool.py +0 -0
  58. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/redirect_history.py +0 -0
  59. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/response_inspection.py +0 -0
  60. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/retry_strategies.py +0 -0
  61. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/session_pool.py +0 -0
  62. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/streaming_response.py +0 -0
  63. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/timeout_config.py +0 -0
  64. {lkrequest-0.1.1 → lkrequest-0.2.0}/examples/websocket.py +0 -0
  65. {lkrequest-0.1.1 → lkrequest-0.2.0}/justfile +0 -0
  66. {lkrequest-0.1.1 → lkrequest-0.2.0}/python/lkrequest/blocking.py +0 -0
  67. {lkrequest-0.1.1 → lkrequest-0.2.0}/python/lkrequest/pcap.py +0 -0
  68. {lkrequest-0.1.1 → lkrequest-0.2.0}/rustfmt.toml +0 -0
  69. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/client_pool.rs +0 -0
  70. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/error.rs +0 -0
  71. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/hsts.rs +0 -0
  72. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/metrics.rs +0 -0
  73. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/middleware.rs +0 -0
  74. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/multipart.rs +0 -0
  75. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/priority.rs +0 -0
  76. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/protocol.rs +0 -0
  77. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/randomize.rs +0 -0
  78. {lkrequest-0.1.1 → lkrequest-0.2.0}/src/retry.rs +0 -0
  79. {lkrequest-0.1.1 → lkrequest-0.2.0}/tests/test_client.py +0 -0
  80. {lkrequest-0.1.1 → lkrequest-0.2.0}/tests/test_package_metadata.py +0 -0
  81. {lkrequest-0.1.1 → lkrequest-0.2.0}/tests/test_stub_parity.py +0 -0
@@ -5,12 +5,24 @@ All important changes to this project will be documented in this file.
5
5
  ## lkrequest-py 0.2.0
6
6
 
7
7
  ### 🚀 Features
8
+ - **System DNS Positive Cache** — Added `system_dns_cache_ttl` and `system_dns_cache_max_entries` to `Client` and `BlockingClient`. The OS resolver already coalesces concurrent identical lookups process-wide; these cache successful, non-empty results for `ttl` seconds (default capacity 1024 entries). A `0` TTL keeps the coalescing while disabling the cache. It selects the system resolver, so it cannot be combined with `dns`; errors and empty results are never cached.
9
+ - **Shutdown Draining** — Added `drain_pending(timeout=None)`, its blocking counterpart `blocking_drain_pending(...)`, and `pending_requests()`. Waiting for in-flight work before tearing down an event loop means results are still delivered rather than dropped on arrival. Counts are process-wide and cover every async call, not only requests.
10
+ - **HTTP/2 Pending-Request Bound** — Added `max_pending_h2_requests` to `Client` and `BlockingClient`. HTTP/2 requests that exceed the peer's concurrent-stream limit now wait for a stream slot instead of failing, and this option caps how many may queue. Omit it (the default) for an unbounded queue; `0` is rejected with `ValueError`.
8
11
  - **Synthetic Fingerprint Negotiability (`synthetic-fp`)** — Added `NegotiabilityFloor.UNIVERSAL`, `NegotiabilityFloor.PRESET_FAMILY`, `NegotiabilityFloor.custom(...)`, and `Randomize.negotiability(...)` so synthesized ClientHello profiles retain a configurable signature-algorithm compatibility floor.
9
12
  - **Multi-hop Proxy Chains** — Added `ProxyConfig.parse_chain(...)` and `.through(...)`, with chain metadata via `hop_count()` and `identity()`. Client sessions, proxy pools, and session pools now accept either proxy URLs or `ProxyConfig` objects.
10
13
  - **Mixed Proxy Transports** — HTTP/1.1 and HTTP/2 can traverse ordered combinations of HTTP CONNECT, SOCKS5, and SOCKS5H hops. QUIC/HTTP3 supports all-SOCKS5 chains when the optional `quic-h3` feature is enabled.
14
+ - **QUIC-TLS Profile Presets** — Added `TlsProfile.chrome_146_quic()`, `TlsProfile.chrome_150_quic()`, and `TlsProfile.chrome_151_quic()`, exposing the ClientHello Chrome sends inside QUIC (previously reachable only through the bundled `Client.chrome_1xx()` presets). Pass one to `Client(quic_fingerprint=...)` when building a client manually; HTTP/3 otherwise reuses the main TLS profile.
15
+ - **Chrome 151 Preset** — Added `Client.chrome_151()`, `BlockingClient.chrome_151()`, `TlsProfile.chrome_151()`, `H2Profile.chrome_151()`, `QuicProfile.chrome_151()`, and the `"chrome_151"` TLS/H2/QUIC profile names. Captured from Chrome 151.0.7922.72: TCP TLS and HTTP/2 keep Chrome 150's stable fields, while the QUIC-TLS capture omits the three ML-DSA signature algorithms; QUIC transport parameters and HTTP/3 SETTINGS stay aligned with Chrome 150.
11
16
  - **Chrome 150 QUIC/H3 (`quic-h3`)** — `Client.chrome_150()` now uses dedicated Chrome 150 QUIC TLS and HTTP/3 profiles instead of reusing Chrome 146. The preset covers captured signature algorithms, QUIC transport parameters, QPACK limits, navigation `PRIORITY_UPDATE`, connection-ID lengths, and Initial datagram sizing. Added `QuicProfile.chrome_150()` and the `"chrome_150"` QUIC profile name.
12
17
 
13
18
  ### 🐞 Fixes
19
+ - **No More Crashes From Late-Completing Requests** — A request that finished after its event loop had closed used to print a `RuntimeError: Event loop is closed` traceback from whichever worker thread it landed on. Enough of them at once turned into `Fatal Python error: _enter_buffered_busy` and killed the process with SIGABRT — uncatchable, and it took the whole batch down. Results arriving after the loop closes are now dropped silently, since nothing is left to receive them.
20
+ - **Multi-Address Connect Fallback** — Connecting now tries every address a hostname resolves to, racing them Happy Eyeballs style (RFC 8305) with interleaved address families, rather than giving up when the first candidate is unreachable. Applies to direct TCP and to SOCKS5 proxies.
21
+ - **HTTP/2 Stream-Limit Backpressure** — Requests beyond the peer's advertised `MAX_CONCURRENT_STREAMS` now wait asynchronously for a stream slot instead of failing with a local capacity error.
22
+ - **Redirects Over Reused HTTP/1.1 Connections** — Following a redirect no longer fails when the pooled HTTP/1.1 connection was torn down in the meantime. The reuse attempt surfaces as hyper's `operation was canceled`, which is now recognised as a closed connection, so the request is retried on a fresh connection instead of erroring out. Affects any server that hangs up after answering a `3xx` — a common pattern after `POST`.
23
+ - **HTTP/2 `1xx` Interim Responses** — The HTTP/2 driver now consumes `1xx` informational responses — such as the `103 Early Hints` Cloudflare sends ahead of its `200` — and returns the final response that follows, instead of reporting the interim status as the final one. A plain `GET https://www.cloudflare.com/` previously came back as `103`.
24
+ - **Connection Limit Enforcement** — `max_connections` now bounds *physical* connections, counting those still being dialled and those checked out by an in-flight request rather than only what sits idle in the pool. Exceeding the limit raises instead of quietly opening another connection, and an idle HTTP/1.1 connection is evicted first so one origin's idle connections cannot starve another. `PoolStats.total` correspondingly reports physical connections in use rather than pooled entries.
25
+ - **Optional Client Certificate Requests** — A server that asks for a client certificate no longer breaks the handshake. TLS 1.2 and TLS 1.3 now answer a `CertificateRequest` with an empty client `Certificate` message — echoing the request context on TLS 1.3, as RFC 8446 §4.4.2 requires — so endpoints with optional mutual TLS complete the handshake instead of failing.
14
26
  - **TLS Handshake Reassembly** — TLS 1.2 and TLS 1.3 handshake messages fragmented across multiple records are now buffered and reassembled correctly, preventing failures such as `truncated handshake message in record` without changing ClientHello or fingerprint output.
15
27
  - **SOCKS5 UDP Relay Compatibility** — QUIC-over-SOCKS5 accepts relay replies from the advertised source IP even when the relay uses a different egress port, preventing affected HTTP/3 requests from hanging.
16
28
  - **Package Version Reporting** — `lkrequest.__version__` is now read from installed distribution metadata instead of being maintained as a separate hard-coded value.