Skip to content

Releases

lkrequest-py v0.3.0

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 20 Nov 10:55

Built on the Rust library's 0.3.0, it adds the Chrome 158 fingerprint, caps on
the retries and connections of one request and a summary of what each request
did, a deadline for a body that stops arriving and deadlines that can be turned
off, a lifetime for cached TLS sessions, complete profile bundles, compressed
WebSocket messages and proxy credentials worked out from a 407's challenges.
The Rust library's other changes show on the wire: requests sent at once to an
origin no connection is open to share the one being set up, where each dialed
its own; TLS 1.2 sessions are resumed, by ticket or session ID, until they
expire; the Firefox presets no longer stall HTTP/2 downloads of more than 128
KiB; the Firefox and Safari presets complete the P-521 handshakes they offer;
and a server that accepts permessage-deflate gets compressed messages. Of the
bindings' own changes, quic_fingerprint="chrome_158" sends the ClientHello
Chrome sends inside QUIC rather than its TCP one.

Three changes are visible from Python and worth reading before upgrading: an
HTTP/2 connection whose first request fails is no longer tried again over
HTTP/1.1, and a request whose pooled connection the server closed is no longer
sent again, unless h2_fallback_h1 and retry_on_connection_close turn that
back on; total_timeout now defaults to 120 seconds and also bounds the reading
of a streamed body, so a longer download needs a deadline that fits it; and a
host Hsts.dynamic() learns covers its subdomains only with
includeSubDomains and is forgotten when its max-age runs out.

🚀 Features

  • Chrome 158 Fingerprint — Added Client.chrome_158() / BlockingClient.chrome_158(), the "chrome_158" name for tls_profile= / h2_profile= / quic_profile=, and TlsProfile.chrome_158(), TlsProfile.chrome_158_quic(), H2Profile.chrome_158(), QuicProfile.chrome_158(). Captured from Chrome 158.0.8127.37 on Windows, it matches Chrome 157 throughout: the TCP and QUIC ClientHellos differ only in their name, and the H2, QUIC and HTTP/3 profiles, the header order and the protocol policy are Chrome 157's. The capture confirmed the HTTP/2 and HTTP/3 SETTINGS and the navigation and favicon priority; timing, loss recovery, resumption and 0-RTT carry over from Chrome 157 without being observed again. Like Chrome 152 to 157, it carries Trust Anchor Identifiers, so the trust_anchor_* options apply to it. The default fingerprint stays Chrome 155.
  • Profile Bundles — inherited from upstream 0.3.0. lkrequest.export_preset_json(name) writes a browser preset out as a complete profile bundle, lkrequest's v2 preset JSON: its TLS, QUIC TLS, HTTP/2 and QUIC profiles, header and cookie order, protocol policy and session-cache partitioning. Client.from_preset_json(json, tcp_fingerprint=None) and Client.from_preset_file(path, tcp_fingerprint=None), on BlockingClient too, build a client from one, edited or of your own, as Client.<name>() builds one from a preset; a bundle has no TCP fingerprint, so it is given alongside. The Rust library validates a bundle as it reads it, up to 1 MiB, and one it refuses raises ValueError naming the reason and the JSON pointer of the value at fault, such as UnknownField at /runtime/surprise or a protocol policy whose axes contradict one another.
  • Attempt Limits, And What A Request Did — inherited from upstream 0.3.0. The new AttemptLimits(extra_http_attempts=..., connect_attempts=...) caps, for one request, the HTTP submissions beyond its first and its redirects — retries and recoveries — and the TCP and QUIC connections it starts; reusing a pooled connection, or waiting for one being set up, starts none. Give it as attempt_limits= to a client, to session() or to a single request: a session or request inherits the cap above it and can only lower it, and one above raises ValueError, from session() for a session and before anything is sent for a request. The caps turn no retry on and replace no timeout, and concurrent requests count separately. Every Response and StreamingResponse, and the exception of a request that failed, now has attempt_summary, a dict of what the request did: its HTTP submissions, the extra ones among them, redirects, recoveries and connection starts, its outcome, why a recovery it could have made was refused, and the limits in effect, each with the scope that set it. Clients and sessions read their limits back as attempt_limits and effective_attempt_limits.
  • How Long A TLS Session Is Cached — Client(tls_session_cache_ttl=...) and BlockingClient(tls_session_cache_ttl=...) set how many seconds a cached TLS session lives before it is no longer resumed, over TLS 1.2, TLS 1.3 and QUIC alike: by default an hour for TLS 1.2, counted from the session's first full handshake, and seven days for TLS 1.3 and QUIC, which is also the most it can be. A shorter lifetime from the server still wins, and 0 caches nothing. The read-only tls_session_cache_ttl reads the setting back, None for the defaults, and tls_session_cache_enabled says whether sessions are cached at all, which TlsSessionResumptionPolicy.DISABLED or a lifetime of zero turns off.
  • A Deadline For A Body That Stops Arriving, And Deadlines Turned Off — Client(read_idle_timeout=...) and BlockingClient(read_idle_timeout=...) end a request whose response body, buffered or streamed, goes that many seconds without anything arriving, with TimeoutError; it is off unless set, and reads back in timeouts. Any of the client's timeouts — dns_timeout, tcp_connect_timeout, tls_handshake_timeout, ttfb_timeout, total_timeout, quic_connect_timeout and read_idle_timeout — now takes math.inf to turn that deadline off, which reads back as None; before, every one of them had a deadline whatever was given, and infinity raised ValueError. Together they suit a long download: total_timeout=math.inf, read_idle_timeout=30.0. A request's own timeout= still takes a finite number of seconds.
  • Compressed WebSocket Messages — inherited from upstream. ws_connect(..., extensions=["permessage-deflate; client_max_window_bits"]), the offer Chrome makes, now gives a connection that compresses and decompresses its messages once the server accepts the offer, with context takeover, fragmented messages and client windows of 9 to 15 bits; a message that decompresses to more than 64 MiB fails the connection. Before, the offer could be made but every compressed message the server sent failed to be received. Compression is used only when offered, so a connection that offers nothing is unchanged. The handshake now fails with RequestError when the server accepts an extension other than permessage-deflate, more than one, or deflate parameters that match no offer, where the frames used to be read plain regardless.
  • Proxy Credentials Worked Out From A 407's Challenges — inherited from upstream 0.3.0. ProxyConfig.with_custom_auth() takes on_challenge=, a function given the proxy's Proxy-Authenticate values, each whole and in the order sent, that answers a 407 in place of authorize, for a scheme such as Digest that works its credential out from the challenge. It runs on the thread setting the connection up, which waits for it, once for the CONNECT the challenge prompts. None, an exception or anything but a string declines the challenge, and the request fails with a ProxyError whose proxy_error_kind is "authentication_required"; an exception is logged as a warning. Like authorize, it must be a plain function: an async def, or anything that cannot be called, raises TypeError.

🔧 Changes

  • Recovery Only When Asked For — inherited from upstream 0.3.0. h2_fallback_h1 and retry_on_connection_close now default to False on both clients, where both were on: an HTTP/2 connection whose first request fails is no longer tried again over HTTP/1.1, whose fingerprint is not the browser's, and a request whose pooled connection the server has closed fails instead of going out again on a new connection. Pass True for either to have it back; neither overrides the method's idempotency or a body that cannot be sent twice. The new read-only retry_on_connection_close reads the setting back, beside h2_fallback_h1. One effect to look out for: HTTP/2 forbids the headers Connection, Keep-Alive, Proxy-Connection, Transfer-Encoding, Upgrade and a TE other than trailers. A request given one still sends it, now with a warning logged, and a strict server fails the request, which used to fall back to HTTP/1.1 and succeed; header sets copied from a browser's HTTP/1.1 request often carry Connection: keep-alive.
  • Two Minutes For A Whole Request, Streaming Included — inherited from upstream 0.3.0. total_timeout now defaults to 120 seconds, where it was 60, and bounds the whole request: connecting, redirects, retries and their backoff, and now the reading of a streamed body too, which it did not bound before. A streamed download that takes longer fails part way with TimeoutError, so give such a download a total_timeout, or a timeout= of its own, that fits it, or total_timeout=math.inf and a read_idle_timeout (see A Deadline For A Body That Stops Arriving, And Deadlines Turned Off above). A retry no longer starts a deadline of its own.

🐞 Fixes

  • Concurrent Requests Share The Connection Being Set Up — inherited from upstream. Requests sent at once to an origin no connection was open to each dialed one of their own: 50 at once made 50 TCP and TLS connections, where a browser makes one, and with max_connections_per_session set, every request beyond the cap failed with session connection limit reached. They now wait for the first connection and share it once it turns out to speak HTTP/2, so 50 or 100 at once make one connection and none fails. Over HTTP/1.1, which cannot share a connection, they still dial in parallel.
  • **A Learned HSTS ...
Read more

lkrequest-py v0.2.4

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 09 Nov 07:00

Adds the Chrome 156 and Chrome 157 fingerprints, Trust Anchor Identifiers and a
switch for sending HTTP/1.1 header names in lowercase, and much of what the Rust
library offers and the bindings did not:
every exception now says what failed, pools take their proxies from a function,
names can be looked up by a DNS server of your own or by Python code, log events
can go to Python's logging, and protocol policies, QUIC cooldowns, HSTS
policies, proxy credentials, WebSocket connections and TCP and TLS fingerprints
can be set in full, among the rest listed below. It also moves the bindings to
PyO3 0.30 and refreshes the Rust dependencies, and fixes the proxy pool, which
handed out a key rather than a proxy. Default request headers and request
cookies now go out in the order they were given, as the Rust library sends
them; a copy made by randomize_fingerprint() keeps the options of the client
it copies; and the default fingerprint, Chrome 155, sends its trust-anchor IDs
in Chrome's sorted order instead of shuffling them. Apart from those three, and
unless a new option is used or one Hsts.dynamic() is given to several
sessions, requests go out on the wire exactly as before. Six changes are visible
from Python and worth reading before upgrading: ProxyPool.acquire() now
returns a ProxyLease instead of a string; TimeoutConfig and
ResourceLimits, which nothing accepted, are gone; the exception raised for an
argument of the wrong type no longer names the argument in its message;
Client.session(proxy=...) now raises ValueError for a proxy URL it cannot
parse, where it used to build a session that connected direct; a
ProtocolPolicy whose axes contradict one another raises ValueError when it
is given to a client or a session, rather than on the first request; and the
sessions given one Hsts.dynamic() now share what it learns.

🚀 Features

  • Chrome 157 Fingerprint — Added Client.chrome_157() / BlockingClient.chrome_157(), the "chrome_157" name for tls_profile= / h2_profile= / quic_profile=, and TlsProfile.chrome_157(), TlsProfile.chrome_157_quic(), H2Profile.chrome_157(), QuicProfile.chrome_157(). Captured from Chrome 157.0.8103.39 on Windows, it matches Chrome 156 throughout: the TCP and QUIC ClientHellos differ only in their name, and the H2, QUIC and HTTP/3 profiles are Chrome 156's. The capture confirmed the HTTP/3 SETTINGS and the navigation and favicon priority; timing, loss recovery and resumption carry over from Chrome 156 without being observed again. The default fingerprint stays Chrome 155.
  • Trust Anchor Identifiers — Client and BlockingClient take trust_anchor_advertisement=, trust_anchor_recovery= and trust_anchor_bindings=, for the Rust library's new support of draft-ietf-tls-trust-anchor-ids: the IDs of the roots a client accepts, which the Chrome 152 to 157 profiles send in extension 0xca34. trust_anchor_advertisement="trusted" sends the sorted IDs of the roots the client trusts instead of the profile's list. trust_anchor_recovery="once" opens one more connection when a server lists the IDs it can serve and then its certificate chain fails to verify, or it ends the handshake, asking for the first of those IDs the client trusts; at most once per request, with 0-RTT off, and a second failure raises the error of its cause with a message beginning trust anchor recovery failed. trust_anchor_bindings={id: anchor_identity} gives IDs to roots of your own, and the new lkrequest.trust_anchor_identity(der) computes the identity a binding names a root by; the bundled IDs of the Chrome 157 root store need none. The IDs never change which certificates are trusted. A setting the Rust library rejects raises ValueError: recovery without verify, or with proxy_fallback_direct=True, "trusted" or "once" on a profile without the extension or with TLS synthesis, and a binding to a root the client does not load. Response.diagnostics and the diagnostics of an exception gained trust_anchor, the negotiation of the TLS connection the request opened: the IDs requested and offered, the root that verified the chain and, after a recovery, the first attempt; it is None on a pooled connection. Whatever the settings, a TLS failure on a server that listed IDs of its own is no longer retried.
  • Chrome 156 Fingerprint — Added Client.chrome_156() / BlockingClient.chrome_156(), the "chrome_156" name for tls_profile= / h2_profile= / quic_profile=, and TlsProfile.chrome_156(), TlsProfile.chrome_156_quic(), H2Profile.chrome_156(), QuicProfile.chrome_156(). Captured from Chrome 156.0.8078.48 on Windows, it matches Chrome 155 throughout: the TCP and QUIC ClientHellos differ only in their name, and the H2, QUIC and HTTP/3 profiles are Chrome 155's. The capture confirmed the HTTP/3 SETTINGS and the navigation and favicon priority updates; timing, loss recovery and resumption carry over from Chrome 155 without being observed again. The default fingerprint stays Chrome 155.
  • Lowercase HTTP/1.1 Header Names — Added Client(http1_title_case_headers=...) on both clients, and a read-only http1_title_case_headers property. HTTP/1.1 header names go out in Title-Case (Content-Type) by default, as before; False sends them in lowercase (content-type), including generated headers such as content-length, except for Host, which keeps its capital H. It applies to ordinary and streamed requests, preconnected connections and WebSocket handshakes, and leaves header values and order alone. Either way, the spelling a header was given in is not kept, and HTTP/2 and HTTP/3 always send lowercase names. Lowercase names alone do not make a request match what any particular browser sends over HTTP/1.1.
  • What An Exception Knows About The Failure — Every RequestError now carries phase, retryable, safe_to_replay, status_code, proxy_error_kind, tls_alert and diagnostics, read from the Rust library's error, where an exception used to carry its message alone: an HttpStatusError could not give its status code, a ProxyError did not say whether the proxy wanted credentials or could not be reached, and the timings of a failed request were thrown away. phase names the step of the connection that failed ("tcp_connect", "proxy_tunnel", "tls_handshake", …); retryable says whether trying again could succeed, and safe_to_replay whether the server cannot have processed the request, so that even a POST can be sent again; proxy_error_kind says what went wrong with a proxy ("authentication_required", "tunnel_refused", …) and tls_alert which alert a handshake ended in; diagnostics holds the timings and transport so far, in the form of Response.diagnostics, for a failed request of the HTTP methods and request(), and the response's own for error_for_status(). An attribute that does not apply is None, or False for the two flags, on an error built by hand as well, and the attributes survive pickling. A retry callable that also takes exception= (or **kwargs) is given the exception itself, or None when a status is being retried; one taking only (attempt, error, status) is called exactly as before.
  • Proxies From A Function — ProxyPool, SessionPool and BlockingSessionPool take a function in place of the list of proxies. It is called with no arguments for every proxy the pool hands out and returns a URL or a ProxyConfig: the way to use a gateway that picks the exit by a session id in the username, with a new id each time. What the function raises comes out of the acquire() that called it, and so does a ValueError for a URL that does not parse or a TypeError for anything but a URL or a ProxyConfig, where the Rust library would only log it and keep asking, so that acquire() waited for good. An async def is refused with TypeError. Every proxy from a function is a new one, so rotation, bad_proxy_config and health_check do not apply to them, and max_proxies / max_sessions still cap how many are out at once. The async pools call the function on a worker thread that waits for it; proxy_buffer=n has n proxies made ahead of time on a thread of their own, where a failure is logged and the function is called again a second later, rather than at once and over and over as the Rust library would. proxy_buffer= with a list raises ValueError.
  • Blocking ProxyPool — Added lkrequest.blocking.ProxyPool (lkrequest.BlockingProxyPool), which takes the same arguments as ProxyPool, blocks in acquire() and acquire_fresh(), and hands out the same ProxyLease.
  • bad_proxy_config= And health_check= For Session Pools — SessionPool and BlockingSessionPool now take the BadProxyConfig and HealthCheckConfig that ProxyPool already did, so a session pool can cool a failing proxy down after fewer or more failures than the default three, and probe its proxies in the background.
  • A DNS Server Of Your Own — Client(dns=...) and BlockingClient(dns=...) now take the address of a DNS server besides the seven resolver names: "ip" for port 53, or "ip:port", an IPv6 address with a port in brackets ("[2606:4700::1111]:53"). It is asked over UDP, and over TCP for an answer too long for UDP. Like the named public resolvers and unlike the system one, it also answers HTTPS records, which is how the client learns a site's ECH configuration and HTTP/3 support from DNS. Anything that is neither a name nor an address still raises ValueError, whose message now mentions the address form.
  • Python Code As The Resolver — dns= also takes Python code that looks names up: a function resolve(host, port) returning a list of addresses, each an IP, which takes the requested port, or "ip:port"; or an object with that method and, optionally, lookup_https(host), returning None or the host's HTTPS record as a dict of alpn, no_default_alpn, target, port, `ech...
Read more

lkrequest-py v0.2.3

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 19 Oct 05:07

Adds the Chrome 155 fingerprint and picks up upstream's switch of the default
fingerprint to it, plus upstream hardening of length fields read off the wire.
Sessions can now be closed, and a session whose event hooks refer back to its
owner is reclaimed instead of living for good. HTTP/2 requests abandoned after
they were sent are now reset instead of holding their stream open, a WebSocket
can send and close while another task is receiving, and upstream's pass over TLS,
ECH and QUIC handshake behaviour is picked up, along with fixes to what a
redirect carries along and to how a few responses are read. Several things are
worth reading before upgrading, because they change the wire or what a call
returns: a client built without a TLS or HTTP/2 profile now presents Chrome 155
instead of Chrome 144; Firefox 156 and the Chrome presets differ in their HTTP/2
stream numbering and dependencies; a redirect to another origin no longer carries
the client's default Authorization, Cookie and Host headers along; a
Set-Cookie with an empty Max-Age gives a session cookie instead of one that
lasts until the year 9999; a deflate body that ends early is now an error; and
ProxyPool.acquire() now waits, rather than answering "no proxy", while every
proxy is cooling down.

🚀 Features

  • Closing A Session — Added Session.close() and Session.closed on both session classes, and context-manager support: with on BlockingSession, async with on Session. Closing aborts the pooled connections, abandons the requests still in flight — they raise RuntimeError("Session was closed while the request was in flight") instead of carrying on — drops the event hooks and the callbacks of the session's own middleware, and makes the session refuse further requests and new hooks with RuntimeError("Session is closed"). Closing twice is harmless and cookies stay readable. Until now the only way to let go of a session's connections was pool_clear(), which empties the pool but leaves requests in flight running and the session usable; it is unchanged. Client has no counterpart, since it owns no connections — those belong to its sessions. The README gained a "Session lifecycle and memory" section: reuse a session rather than creating one per request, the default pool has no upper limit and drops an idle connection after 300 seconds (only when the session is next used), and the resident size of a process does not necessarily shrink when memory is freed.
  • Chrome 155 Fingerprint — Added Client.chrome_155() / BlockingClient.chrome_155(), the "chrome_155" name for tls_profile= / h2_profile= / quic_profile=, and TlsProfile.chrome_155(), TlsProfile.chrome_155_quic(), H2Profile.chrome_155(), QuicProfile.chrome_155(). Captured from Chrome 155.0.8059.40 on Windows: the TCP and QUIC ClientHellos, H2, the QUIC transport parameters and the Initial-packet generation rules all match Chrome 154. What differs is how the QUIC profile behaves once connected: QuicProfile.chrome_155() switches on 16 booleans that Chrome 154's lacks — Chrome 155's HTTP/3 request handling (among them a PRIORITY_UPDATE sent for each request stream before its HEADERS) and its loss-recovery and packetization timing — and nothing else in it moves. Unlike the Chrome 154 capture, this one completed an HTTP/3 navigation, so the H3 SETTINGS were observed directly rather than carried over — and matched the inherited ones.
  • The Default Fingerprint Is Now Chrome 155 — inherited from upstream, and visible on the wire. Client() / BlockingClient() without tls_profile= used Chrome 144's TLS fingerprint and now uses Chrome 155's; without h2_profile=, the same for HTTP/2. Nothing else about the default changes: no TCP fingerprint, no QUIC profile, no default headers. The preset methods and named profiles are unaffected. Pass tls_profile="chrome_144", h2_profile="chrome_144" to keep the previous default.
  • Per-Request HTTP/2 Priority Weight — Added h2_priority_weight= (0–255) to every request method on both session classes. It sets the weight in the legacy priority field of the request's HTTP/2 HEADERS frame — on the request that opens a connection as on any other — independently of the priority header, the stream dependency and the exclusive flag; the next request goes back to the weight its profile sends. A profile whose HEADERS carry no legacy priority field (Safari 26) still sends none, and HTTP/1.1 and HTTP/3 are not affected. It is what reproduces Firefox 156's favicon request: priority=RequestPriority(6, False) together with h2_priority_weight=21. A value outside 0–255 is rejected before anything is sent.
  • HTTP/2 Stream Numbering And Dependencies — Added H2Profile(initial_stream_id=...) and a read-only initial_stream_id: the ID of the first request stream a connection opens, an odd number up to 2³¹ − 1 (ValueError otherwise; a profile saved without it keeps starting at 1). Added "priority_chain" as a PriorityConfig(stream_dep_policy=...) value. Two presets change on the wire as a result. Firefox 156 now opens its first request on stream 3, as its capture shows, and sends navigation HEADERS with weight 41 where it sent 42. The Chrome presets now point each stream's dependency at the newest still-active stream of equal or higher priority, dropping finished and reset streams, instead of at the stream opened just before it: PriorityConfig.chrome().stream_dep_policy is "priority_chain" where it was "chain". "chain" itself behaves as it did.
  • HTTP/3 Protocol-Error Retries — Added H3RetryMode and session(h3_retry_mode=...) on both clients. H3RetryMode.Safe, the default, keeps the behaviour of earlier releases. H3RetryMode.Chrome155ProtocolErrors retries HTTP/3 stream and connection protocol errors and stateless resets up to twice per redirect hop, as long as no response headers have arrived, which is what Chrome 155 does. That replays a finite buffered request, including a POST the server may already have processed. Streaming uploads are not retried, a request sent with idempotency=Idempotency.NotIdempotent opts out, and a request that is not HTTP/3-only needs a protocol policy that allows falling back to TCP. It adds no status-code retries and leaves 0-RTT eligibility alone. Without the quic-h3 build feature only Safe is accepted.

🐞 Fixes

  • Event Hooks No Longer Keep Their Session Alive — a hook that referred back to the object holding the session — session.on_response(self.log) in a class that stores self.session, or a closure over the session — made a reference cycle that Python's collector could not see, because the hooks sat in a Rust Vec behind an Arc. The session, its connection pool and everything the owner held then stayed alive for the life of the process: on the order of 7 KB per session in a loop that created one per request, plus its open connection for as long as the server kept it open. The hooks are now kept in Python lists and the session classes report them to the collector, so such a cycle is reclaimed. The callbacks of middleware are still held where the collector cannot see them: those of a session's own middleware are released by Session.close(), and a callback of Client(middleware=...) that refers back to its own client keeps that client alive, so create such a client once rather than per request.
  • Overflow-Checked Length Fields — inherited from upstream. Lengths declared in HPACK, QUIC transport parameters and MASQUE capsules were added to buffer offsets without overflow checks, and on a 32-bit target a declared length of 4 GiB or more was truncated outright. They are now compared against the bytes actually present. The one place this surfaces in Python is H2Profile.from_h2_frames(): a header block whose declared lengths run past the frame now ends the pseudo-header scan at the last field that fits, instead of relying on unchecked arithmetic.
  • Abandoned HTTP/2 Requests Are Reset — inherited from upstream. A request the caller gave up on after it was sent — a timeout, a cancelled task, a dropped streaming response — was never reset with RST_STREAM, so its stream stayed open on the server for as long as the connection did. On a shared session that used up the server's concurrent-stream limit (typically 100): later requests then queued behind it without ever being sent, every one of them timed out, and the pool still counted the connection as healthy. A dropped session also kept its connections open for another 30 seconds, waiting out the abandoned streams. The client now sends RST_STREAM(CANCEL) for such a request and frees its slot, and a dropped session closes its connections at once. HTTP/1.1 was never affected.
  • WebSocket Send And Close No Longer Wait For recv() — a connection held one lock across every operation, so while one task was waiting in recv(), send_text(), send_binary() and close() from any other task or thread waited too. Against a server that only speaks when spoken to that is a deadlock: the message recv() is waiting for is the one send_text() cannot send. Receiving, sending and closing now proceed independently, and closing hands a recv() that is waiting the closing handshake. As before, once a connection is closed every operation raises RuntimeError("WebSocket is closed") and iterating it ends.
  • WebSocket Upgrade Request Line And Host — inherited from upstream. The HTTP/1.1 upgrade request went out in absolute-form (GET https://host/path), which only a proxy is meant to receive, and its Host header dropped the port. A server that routes on the path never matched it, and a wss:// endpoint on any port but 443 was addressed as if it were on 443. The request line is now the path and query, and Host carries the port whenever it is not the scheme's default.
  • ProxyPool.acquire() Does Not Answer With "No Proxy" While Proxies Cool Down — inherited from upstrea...
Read more

lkrequest-py v0.2.2

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 25 Sep 14:07

Adds streaming uploads, the Chrome 153, Chrome 154 and Firefox 156 fingerprints,
experimental MASQUE (CONNECT-UDP) proxies and address-family control with dial
target overrides, makes text() usable on the non-UTF-8 web, and picks up three
upstream fixes: a connection-pool bug that made every request re-dial whenever
HTTP/3 fell back to HTTP/2, a QPACK bug that made HTTP/3 connections built from
the Chrome presets unusable after their first request against servers such as
LiteSpeed, and HTTP/3 never reaching an IPv6 address. Six behaviour changes are
worth reading before upgrading: what text() does with bytes it cannot decode,
the exception json() raises, the order of the Cookie header, the QUIC GREASE
fields the Chromium presets now randomize per connection, the default port for a
portless HTTP proxy URL, and the encoding of ProxyConfig.identity().

🚀 Features

  • Streaming Uploads — Added body_stream= and content_length= to post, put, patch, delete, request and send_streaming on both clients, uploading without holding the body in memory. body_stream accepts a file-like object (read(n)), any iterable of bytes, or — on the async client — an async iterable; the blocking client rejects an async iterable up front, since it has no event loop to drive it. Omit content_length for an unknown-length body: HTTP/1.1 then uses chunked framing, HTTP/2 and HTTP/3 send DATA frames with no Content-Length. A supplied length is exact, so a source that ends short or runs long fails the request. Chunk boundaries are passed through untouched rather than re-chunked, because they are visible on the wire as DATA frame sizes. The source is single-use: neither an automatic retry, a protocol fallback, nor a redirect that must preserve the body can replay it.
  • HTTP/2 Dispatch Batching — Added Client(h2_dispatch_batch_size=...) and a matching read-only property, capping how many ready HTTP/2 requests are coalesced into one driver write turn. The default of 1 keeps each request in its own write, which is the shape the browser presets were captured with; batching is faster but observable, so it is opt-in. 0 is rejected with ValueError.
  • Readable Cookie Attributes — Added session.get_cookies_with_attrs(url) and session.get_all_cookies() on both clients, returning Cookie objects carrying name, value, domain, host_only, path, secure, http_only, same_site, expires and is_persistent. get_cookies() returns (name, value) pairs, which cannot tell apart two cookies sharing a name at different paths — the jar holds both, and only the attributes say which is which. These are what a caller needs to hand a jar to a browser automation context, to persist a login and know which cookies are session-only, and to answer why a cookie the jar holds was not sent. get_cookies_with_attrs is scoped to a URL like get_cookies; get_all_cookies spans every domain, which is the view to persist. Cookie is hashable, so two jars can be diffed with set operations. get_all_cookies lists cookies oldest first, which is the order to write them back in: combined with the Cookie ordering fix below, a jar saved and restored reproduces the same headers on the wire.
  • Address Family Selection — Added Client(ip_family="any" | "ipv4" | "ipv6") on both clients, backed by upstream's address-family policy. On a dual-stack host the OS resolver orders IPv6 ahead of IPv4 (RFC 6724), so a target publishing an AAAA record is reached over IPv6 whenever IPv6 happens to work; "ipv4" or "ipv6" keeps every address this process dials — the target, the proxy's own address, a SOCKS5 UDP relay, QUIC — within one family, which is what keeps a session from leaving over two families and presenting two source addresses to the target. "ipv6" also refuses IPv4-mapped addresses (::ffff:a.b.c.d). The default "any" is the previous behaviour. An address outside the family raises an error that names the ip_family setting (LkConnectionError, or ProxyError for the proxy's own address) instead of falling back — not even to a direct connection under proxy_fallback_direct=True — and an unknown value raises ValueError. Composes with dns= and with system_dns_cache_ttl=. A proxy that resolves the target itself — HTTP CONNECT, socks5h or MASQUE handed a hostname — still picks the family it dials; connect_to hands it an address instead.
  • Dial Target Overrides — Added Client(connect_to={"host:port": "ip:port"}) on both clients: requests to that origin dial the given address, while the URL, TLS SNI and certificate name, Host, cookies and connection pooling keep the original host. It applies to direct, proxied and HTTP/3 connections, ahead of Alt-Svc / SVCB endpoints, and never to the proxy's own address; through an HTTP CONNECT proxy the CONNECT line carries the address, which is how to decide the family a proxy dials. An IPv6 host or address goes in brackets ("[::1]:8443", "[2001:db8::1]:443"). The mapping is fixed — nothing re-resolves or refreshes it. A malformed entry, a zero port, one origin listed twice (Example.com and example.com count as the same), or an address ip_family excludes raises ValueError when the client is built.
  • Chrome 153 Fingerprint — Added Client.chrome_153() / BlockingClient.chrome_153(), the "chrome_153" name for tls_profile= / h2_profile= / quic_profile=, and TlsProfile.chrome_153(), TlsProfile.chrome_153_quic(), H2Profile.chrome_153(), QuicProfile.chrome_153(). Captured from Chrome 153.0.8010.37 on Windows. Against Chrome 152 the TLS shape is the same except for the shuffled trust-anchor list (extension 0xca34), which narrows from 32 identifiers to 28; H2 is unchanged; the QUIC ClientHello keeps the nine classic signature algorithms and sends no TLS GREASE slots. Nothing switches over on its own — an existing client keeps the preset it names.
  • Chrome 154 And Firefox 156 Fingerprints — Added Client.chrome_154() / BlockingClient.chrome_154(), the "chrome_154" name for tls_profile= / h2_profile= / quic_profile=, and TlsProfile.chrome_154(), TlsProfile.chrome_154_quic(), H2Profile.chrome_154(), QuicProfile.chrome_154(). Captured from Chrome 154.0.8037.58 on Windows: the TCP and QUIC ClientHellos, H2, the QUIC transport parameters and the Initial-packet generation rules all match Chrome 153, so only the profile name differs. The capture never received a QUIC response, so the H3 SETTINGS and request priority carry over from Chrome 153's completed navigation instead of being observed anew. Added Client.firefox_156() / BlockingClient.firefox_156(), the "firefox_156" name for tls_profile= / h2_profile=, and TlsProfile.firefox_156(), H2Profile.firefox_156(). Captured from Firefox 156.0.1 on Windows: against Firefox 147 the TLS profile drops two ECDSA CBC suites (0xc009, 0xc00a) and both FFDHE groups (256, 257), and its ECH GREASE switches to AES-128-GCM with a fixed 240-byte payload; H2 is unchanged. Like the other Firefox presets it carries no QUIC profile and turns HTTP/3 off — upstream captured Firefox 156's QUIC Initial but cannot yet reproduce every field of it — so there is no "firefox_156" QUIC name. As before, an existing client keeps the preset it names.
  • Chromium GREASE Generation For The QUIC Presets — inherited from upstream, and it changes the wire for existing presets, not just Chrome 153. Three fields are now generated per connection the way Chromium generates them, instead of being fixed by the profile: the reserved HTTP/3 SETTINGS id and value plus the control-stream GREASE frame (every Chrome QuicProfile, the generic chrome included); the reserved QUIC transport parameter ids, now spanning the full 62-bit range with 0–15 byte payloads and a randomized GREASE version position; and the Initial packet layout, with CRYPTO data split and shuffled and PING/PADDING interleaved (both on Chrome 146 and 150–154). Two connections from one client therefore no longer look byte-identical in those fields — which is what real Chrome does, and the reason a fixed value was a fingerprint of its own. A QuicProfile loaded from JSON is unaffected: the three flags default to off, so a serialized or hand-built profile keeps its previous behaviour.
  • MASQUE Proxies (Experimental) — experimental upstream and here: MasqueConfig, the masque= / tunnel_probe= parameters and the behaviour of masque:// routes may change in any release without a deprecation period, and interoperability has been checked only against test proxies, not against independent production MASQUE deployments. Behind the new masque build feature, which implies quic-h3 and is compiled into the published wheels; it does nothing unless a masque:// proxy is used. A masque:// proxy (port 443 by default) carries the QUIC connection to the target inside an RFC 9298 CONNECT-UDP tunnel over an HTTP/3 connection to the proxy; the target is named in the tunnel request, so DNS resolves proxy-side as with socks5h. Added MasqueConfig for the hop to the proxy — server_name, ca_cert (PEM file) / ca_cert_pem, use_native_certs, verify, and the two tunnel-lifecycle knobs tunnel_idle_timeout (default 120 s, None never retires an idle tunnel) and max_idle_tunnels (default 256, 0 removes the cap) — passed as Client(masque=...) on both clients. Its trust settings are deliberately independent of the client's verify / ca_cert*, which govern the origin: relaxing one hop for debugging never relaxes the other. A PEM bundle that is malformed or holds no certificate raises ValueError instead of leaving the trust store unchanged. HealthCheckConfig gained tunnel_probe and masque: a TCP connect proves nothing about a MASQUE proxy, so by default the health check skips those proxies — neither credited nor blacklisted — and with tunnel_probe=True it opens a real CONNECT-UDP tu...
Read more

lkrequest-py v0.2.1

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 04 Sep 05:36

Adds the Chrome 152 preset and browser network session policies, and picks up a
large upstream RFC-compliance pass. Several fixes below change observable
behaviour — the ECH, retry, redirect, cookie and connection-limit entries are
the ones most likely to affect existing code.

🚀 Features

  • Chrome 152 Preset — Added Client.chrome_152(), BlockingClient.chrome_152(), TlsProfile.chrome_152(), TlsProfile.chrome_152_quic(), H2Profile.chrome_152(), QuicProfile.chrome_152(), and the "chrome_152" TLS/H2/QUIC profile names. Chrome 152 is currently the only preset that applies GREASE to signature_algorithms, and it carries the new trust anchor IDs extension. HTTP/2 is unchanged from Chrome 151; the QUIC capture drops the google_initial_rtt transport parameter (0x3127).
  • Browser Network Session Policies — Added TlsSessionResumptionPolicy (BROWSER_DEFAULT / DISABLED / enabled(max_tickets_per_server)), TlsSessionCachePartitionPolicy (UNPARTITIONED / TOP_LEVEL_SITE / TOP_LEVEL_AND_FRAME_SITE / CHROMIUM / FIREFOX), and NetworkPartitionContext(top_level_site, frame_site). Set the first two via Client(tls_session_resumption_policy=..., tls_session_cache_partition_policy=...) and pass the third to session(network_partition_context=...) to reproduce a browser's per-site ticket isolation. These control whether tickets are stored and how the cache is keyed; SessionResumptionConfig continues to control which resumption modes the ClientHello advertises.
  • HTTP/2 DATA Frame Policy — Added Client(h2_data_frame_policy=...) with H2DataFramePolicy.BROWSER_DEFAULT, .PEER_MAX_FRAME_SIZE, .fixed_payload(n), and .socket_write_aligned(n), choosing how request bodies are split into DATA frames. The default keeps the browser preset's native framing, since frame sizes are themselves an observable fingerprint trait.
  • Strict TLS close_notify — Added Client(require_close_notify=True) and a matching read-only property. When enabled, a response body truncated by a bare socket EOF — with no TLS close_notify alert — is reported as an error instead of being accepted as a complete body. One part applies regardless of the flag: the read loop now stops at close_notify instead of reading on, because anything arriving after it did not come from the peer — those bytes were previously appended to the response body.
  • Trust Anchor IDs Extension — Added ExtType.TRUST_ANCHOR_IDS and a new ExtensionSpec source: ExtensionSpec(ExtType.TRUST_ANCHOR_IDS, source="trust_anchor_ids", trust_anchor_ids=[...], shuffle=False), with trust_anchor_ids and shuffle readable back off the spec.
  • DNS-over-HTTPS Feature — Upstream moved the DoH resolvers behind a doh Cargo feature. The published wheels enable it, so dns="google_https", "cloudflare_https" and "quad9_https" keep working exactly as before; a reduced-feature source build now rejects those three names with an actionable error instead of a generic "unknown DNS config".

🐞 Fixes

  • A Rejected ECH No Longer Falls Through In The Clear — when a server did not accept Encrypted ClientHello, the handshake previously carried on and handed back a connection whose real server name had never been protected, so the request ECH existed to hide went out in the open. The handshake now aborts before any traffic keys exist, and the session redials once with the retry_configs the server supplied — the same thing a browser does, so routine ECH key rotation stays transparent. Retrying without ECH is deliberately not a fallback. This affects clients that never set ech_config=, because ECH is enabled automatically from DNS HTTPS records; a rejection that cannot be retried now surfaces as TlsError. GREASE ECH is unaffected.
  • Status-Code Retries Are Gated On Replay Safety — a non-idempotent request answered with a status in the retry set was replayed even though the answer proves the server received it, so a POST answered 502 was sent twice. Such a method is now retried only on a status that says it was not applied (429, 503); 502, 504 and the Cloudflare 520–530 range are returned to the caller instead. Safe methods are unaffected, and passing idempotency=Idempotency.Idempotent on the request restores the old behaviour per call.
  • Only Real Redirect Statuses Are Followed — 300, 304, 305 and 306 are no longer treated as redirects. Previously a 304 Not Modified or a 305 Use Proxy could send the client chasing a Location header it should have ignored. 301, 302, 303, 307 and 308 are unaffected.
  • Cookie Name Prefixes Enforced — Cookies named with the __Secure- or __Host- prefix are now rejected unless they satisfy the prefix rules (Secure, and for __Host- also a / path with no Domain). A server can no longer set a lookalike cookie that client code would reasonably trust.
  • Secure Cookies Ignored Over Plain HTTP — A Set-Cookie carrying Secure received over a plain-HTTP channel is now discarded rather than stored.
  • Sessions Are No Longer Capped At 64 Connections — The implicit per-session ceiling made unrelated high-concurrency workloads fail with session connection limit reached. The default is now unbounded; set max_connections_per_session explicitly to impose a budget.
  • Multi-Layer Content-Encoding Is Decoded — A response carrying stacked encodings (for example Content-Encoding: gzip, br) is now fully decoded instead of being returned partly compressed. The zlib-wrapped form of deflate is also accepted, matching what browsers tolerate.
  • WebSocket Handshakes And Close Codes Are Validated — the upgrade response was checked only for a 101, which on its own proves nothing; a wrong or missing Sec-WebSocket-Accept merely logged a warning. RFC 6455 §4.1 makes that, a missing or wrong Upgrade/Connection, and any unoffered extension or subprotocol grounds for failing the connection, and all are enforced now. Enforcing it also uncovered that Sec-WebSocket-Accept was being computed with a GUID that is not the one §1.3 specifies, so the token never matched a conforming server — harmless while the check only warned. On the sending side, 1005, 1006 and 1015 may never appear on the wire (§7.4.1) and are now rejected locally, along with over-long close reasons, instead of producing an invalid frame.
  • HSTS Is Learned Only From Secure Transport — Strict-Transport-Security is no longer recorded from a plain-HTTP response, and never for IP-literal hosts.
  • Multipart Bodies Match Chrome — Boundary generation and parameter escaping now follow Chrome's format. A Content-Type containing CR or LF is rejected outright, since — unlike the quoted Content-Disposition parameters, which are escaped — it cannot be encoded safely and would be a live header-injection vector.
  • Redirect Method Rewriting Follows The Spec — The request method is now rewritten only in the cases the specification calls for, so 307 and 308 correctly preserve the original method and body.
  • Graceful HTTP/2 GOAWAY Is Honoured — a graceful shutdown carries NO_ERROR and therefore set no connection error, while the draining check keyed off "has an error". The driver kept opening streams on a connection the peer had already promised to refuse. Google and Cloudflare send these routinely for connection turnover, so this showed up as sporadic failures under sustained load; queued requests now fail over to a fresh connection.
  • Alternative Services No Longer Supply The TLS Identity — an Alt-Svc entry or DNS HTTPS record says where to send packets, but the endpoint must still prove it may serve the origin. The advertised host was used as the SNI and certificate name, so the alternative authenticated as itself. Besides the trust problem this broke conforming deployments outright, since an HTTPS RR TargetName is typically a CDN-internal name serving the origin's certificate.
  • Certificates Compressed With zstd Decompress — compress_certificate advertises zlib, brotli and zstd (the Firefox 147 profile offers all three), but only zlib and brotli could be decoded, so a server that picked zstd failed the handshake. All three are handled now (RFC 8879).
  • Coalesced TLS Post-Handshake Messages Are Reassembled — post-handshake messages follow the same framing as the handshake: several may share one record, and one may span several. Each record was treated as exactly one message, so a KeyUpdate sharing a record with a NewSessionTicket was silently dropped — read keys were never rotated and every record after it failed to decrypt — and coalesced tickets past the first were lost.
  • Protocol Hardening Across TLS, HTTP/2, QUIC And Alt-Svc — Picks up a broad upstream compliance pass: TLS 1.2 renegotiation is refused with a fatal alert, the record layer and session-ticket trust are bounded, servers can no longer select parameters the client never offered, HTTP/2 enforces response pseudo-header rules and closes connections on peer protocol errors, record_size_limit is honoured when sending (RFC 8449), draft HTTP/3 Alt-Svc advertisements are ignored, and SOCKS5 authentication replies are version-checked.

lkrequest-py v0.2.0

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 18 Aug 02:50

🚀 Features

  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.

🐞 Fixes

  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • Package Version Reporting — lkrequest.__version__ is now read from installed distribution metadata instead of being maintained as a separate hard-coded value.
  • TLS 1.3 ECH + HelloRetryRequest — Real ECH CH2 now reuses the ECH configuration, HPKE sender context, Inner random, GREASE values, extension permutation, and fake ECH bytes. HRR confirmation, selected groups, cookie-only retries, invalid extensions, dummy CCS, and local fatal alerts now follow the browser/RFC flow.
  • ECH + PSK + HRR Binders — pre_shared_key remains exclusively in ClientHelloInner; CH1 and CH2 binders now use the correct truncated Inner transcripts, including message_hash(ClientHelloInner1) + HRR for CH2.
  • QUIC/H3 HRR State Transitions — QUIC revokes 0-RTT stream and packet state after HRR and maps local TLS alerts to QUIC CRYPTO_ERROR codes.

lkrequest-py v0.1.1

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 04 Aug 05:39

🐞 Fixes

  • Project URLs — Homepage, Repository, and Issues in the package metadata pointed at a repository path that does not exist, so every link on the PyPI project page returned 404. They now point at github.com/EZ-XLabs/lkrequest-py.
  • README Links on PyPI — the language switcher at the top of both READMEs used relative paths (README.md / README-zh.md), which PyPI cannot resolve when it renders the long description. Both now use absolute URLs, so switching between English and 简体中文 works from the project page.

📝 Documentation

  • Development Setup — the setup section now walks through the full local workflow on Linux/macOS and Windows: creating and activating a virtualenv, installing maturin, pip install -e ".[test,lint]", and running the suite via just test. An equivalent uv sync --extra test --extra lint path is documented alongside it.

lkrequest-py v0.1.0

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 31 Jul 10:46

🚀 Features

  • TLS Fingerprint Control — Byte-level ClientHello generation that matches real browsers (Chrome, Firefox, Safari)
  • HTTP/2 Fingerprint Control — SETTINGS frame order, pseudo-header order, WINDOW_UPDATE, PRIORITY frames, and per-request priority weights
  • HTTP/3 + QUIC — Optional quic-h3 feature for full HTTP/3 over QUIC with fingerprint-aware Transport Parameters, Alt-Svc auto-discovery, and H2→H3 seamless upgrade
  • Built-in Browser Presets — Chrome 131/144/145/146/147/148/149/150, Firefox 133/147, Safari 18/26 (TLS + H2, plus QUIC when quic-h3 is enabled)
  • Session Management — Cookie jars, connection pooling, HTTP/2 multiplexing, and optional QUIC 0-RTT session resumption
  • Connection Prewarming — session.preconnect() pre-establishes DNS + TCP + TLS + H2 (or, with quic-h3, QUIC + H3) connections
  • Custom DNS Resolver — Pluggable DNS with DoH support, auto ECH config and H3 hints via HTTPS/SVCB records
  • Alt-Svc Discovery — Automatic HTTP/2 → HTTP/3 protocol upgrade via Alt-Svc headers with broken-QUIC fallback
  • SessionPool — High-concurrency pool with proxy rotation (round-robin / random)
  • Proxy Support — SOCKS5 and HTTP CONNECT with authentication
  • WebSocket — HTTP/1.1 Upgrade (RFC 6455) and H2 Extended CONNECT (RFC 8441)
  • Middleware — Interceptor chain for request/response modification
  • Retry Policies — Exponential backoff, fixed interval, custom strategies; idempotency-aware (non-idempotent methods are not silently replayed after a possibly-already-sent failure unless marked Idempotency::Idempotent)
  • Redirect Control — RedirectPolicy::Follow(n) or RedirectPolicy::None for manual handling
  • Auto-Decompression — Brotli, gzip, deflate, zstd
  • Blocking API — Synchronous wrapper for non-async contexts
  • Multipart/Form-Data — File uploads with streaming support
  • TCP Fingerprint — JA4T-style TCP SYN fingerprinting