fix(curl-impersonate): treat a refused CONNECT tunnel as a proxy error - #2109
Open
vdusek wants to merge 2 commits into
Open
fix(curl-impersonate): treat a refused CONNECT tunnel as a proxy error#2109vdusek wants to merge 2 commits into
vdusek wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2109 +/- ##
=======================================
Coverage 93.55% 93.56%
=======================================
Files 181 181
Lines 12590 12595 +5
=======================================
+ Hits 11779 11784 +5
Misses 811 811
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vdusek
marked this pull request as ready for review
August 3, 2026 09:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
curl-cffi0.16.0 broke two things inCurlImpersonateHttpClient, which is why #2107 capped it. This fixes both and drops the cap.Bundled libcurl went 8.15.0 -> 8.21.0, so a refused CONNECT tunnel is now
CURLE_COULDNT_CONNECTwithCONNECT tunnel failedinstead ofCURLE_RECV_ERROR.curl_cffimaps only the latter toCurlProxyError, so_is_proxy_errorstopped recognizing it and sessions were not rotated. The needle lives in_curl_impersonate.pyrather than the sharedROTATE_PROXY_ERRORS, which mirrors the JS Crawlee list - impit and httpx never produce libcurl messages.The session cookie write path moved to
Cookies.update_cookies_from_curl_changes, leaving the_EmptyCookiesoverride inert. Isolation held (get_cookies_for_curlis still overridden, so nothing was ever sent), but every response cookie accumulated in the jar of the per-proxy session cached for the client's lifetime. Measured with the same 25-request repro: 25 cookies on 0.16.0, 0 on 0.15.0.The existing
test_crawl_with_proxy_disabled[curl]andtest_send_request_with_proxy_disabled[curl]cover the first;test_internal_session_cookie_jar_stays_emptyis new for the second.Closes: #2111
✍️ Drafted by Claude Code