Skip to content

Conversation

@ammarfaizi2
Copy link
Contributor

Hi @reo7sp,

Please consider pulling a single line change to fix a bug in the curl netlib.

@okman334 reported an error when using the curl HTTP client after commit
775291f ("net: Allow curl handle in CurlHttpClient to be kept alive"):

error: curl error: Send failed since rewinding of the data stream failed.

Fix this by calling curl_easy_reset() before setting curl options. It
reinitializes all options previously set on a specified curl handle to
the default values while keeping the connection alive.

This pull request will close issue #340 once merged.

Thank you!

The following changes since commit 84e93a11803dbaecbb41cf87f069a893ff779de1:

  Merge pull request #338 from Makcal/patch-1 (2025-07-01 11:49:02 +0300)

are available in the Git repository at:

  https://github.com/ammarfaizi2/tgbot-cpp.git tags/fix-curl-netlib

for you to fetch changes up to e6d14baff9f4cdd9c11e17e01541b3107ed75bb7:

  net: CurlHttpClient: Call `curl_easy_reset()` to fix error 'rewinding of the data' (2025-09-06 19:33:35 +0700)

----------------------------------------------------------------
fix-curl-netlib

----------------------------------------------------------------
Ammar Faizi (1):
      net: CurlHttpClient: Call `curl_easy_reset()` to fix error 'rewinding of the data'

 src/net/CurlHttpClient.cpp | 1 +
 1 file changed, 1 insertion(+)

@ammarfaizi2 ammarfaizi2 changed the title [GIT PULL] net: CurlHttpClient: Call curl_easy_reset() to fix error 'rewindind of the data' [GIT PULL] net: CurlHttpClient: Call curl_easy_reset() to fix error 'rewinding of the data' Sep 6, 2025
… of the data'

@okman334 reported an error when using the curl HTTP client after commit
775291f ("net: Allow curl handle in CurlHttpClient to be kept alive"):

   error: curl error: Send failed since rewinding of the data stream failed.

Fix this by calling `curl_easy_reset()` before setting curl options. It
reinitializes all options previously set on a specified curl handle to
the default values while keeping the connection alive.

Also, move the timeout options setting below the reset call to avoid
losing the timeout options effect.

Closes: reo7sp#340
Reported-by: @okman334
Fixes: 775291f ("net: Allow curl handle in CurlHttpClient to be kept alive")
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
@ammarfaizi2
Copy link
Contributor Author

Updated. Moved the timeout options setting below the reset call to avoid losing the timeout options effect.

Copy link
Owner

@reo7sp reo7sp left a comment

Choose a reason for hiding this comment

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

Thank you

@reo7sp reo7sp merged commit f52c0b8 into reo7sp:master Sep 6, 2025
1 check passed
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.

2 participants