Skip to content

fix(curl-impersonate): Avoid false already consumed error for buffered streams in CurlImpersonateHttpClient#2042

Merged
vdusek merged 2 commits into
apify:masterfrom
Mantisus:fix-http-stream
Jul 10, 2026
Merged

fix(curl-impersonate): Avoid false already consumed error for buffered streams in CurlImpersonateHttpClient#2042
vdusek merged 2 commits into
apify:masterfrom
Mantisus:fix-http-stream

Conversation

@Mantisus

@Mantisus Mantisus commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Description

  • curl_cffi buffers a streamed response in a queue, so a small response body could be fully buffered before reading started. This caused a false RuntimeError: Cannot read stream, it was already consumed. from read_stream.

Testing

  • Added new regression tests for HTTP clients

@Mantisus Mantisus requested a review from Pijukatel July 7, 2026 21:27
@Mantisus Mantisus self-assigned this Jul 7, 2026
@vdusek vdusek changed the title fix: Fix false already consumed error for streamed responses in CurlImpersonateHttpClient fix(curl-impersonate): Avoid false already consumed error for buffered streams in CurlImpersonateHttpClient Jul 8, 2026
Comment thread tests/unit/http_clients/test_http_clients.py Outdated

@vdusek vdusek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vdusek vdusek merged commit 86ca2f2 into apify:master Jul 10, 2026
35 checks passed
Mantisus added a commit to Mantisus/crawlee-python that referenced this pull request Jul 10, 2026
…d streams in `CurlImpersonateHttpClient` (apify#2042)

### Description

- `curl_cffi` buffers a streamed response in a queue, so a small
response body could be fully buffered before reading started. This
caused a false `RuntimeError: Cannot read stream, it was already
consumed.` from `read_stream`.

### Testing

- Added new regression tests for HTTP clients
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants