Repository navigation
Conversation
On non-Windows systems, telnet_do() ended the transfer and returned CURLE_OK when poll() failed, when read() of the CURLOPT_READDATA file failed and when the read callback returned CURL_READFUNC_ABORT. Return CURLE_RECV_ERROR, CURLE_READ_ERROR and CURLE_ABORTED_BY_CALLBACK. The Windows code returned CURLE_READ_ERROR for CURL_READFUNC_ABORT, make it return CURLE_ABORTED_BY_CALLBACK as documented. Add test 1695, using lib513 with a read callback that returns CURL_READFUNC_ABORT.
There was a problem hiding this comment.
🟢 Approval recommended
The localized error-handling changes match the intended behavior, include a focused regression test, and have no identified blocking issues.
No open issues 🎉
What changed in this PR
This PR makes TELNET transfers report input and polling failures instead of incorrectly returning success, and aligns callback-abort handling across platforms.
Changes:
- Return appropriate errors for polling failures, input read failures, and callback aborts.
- Add and register a regression test using
lib513to verify TELNET callback-abort behavior.
| File | Description |
|---|---|
tests/data/test1695 |
Verify that a TELNET read callback abort returns error 42. |
tests/data/Makefile.am |
Register test 1695. |
lib/telnet.c |
Propagate polling, input-read, and callback-abort errors. |
Review effort: Balanced
Member
|
Thanks! |
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.
On non-Windows systems,
telnet_do()ends the transfer and returns CURLE_OK when:poll()fails (it returns -1 only for errors other than EINTR),read()of the CURLOPT_READDATA file fails, for example when it is a directory,So
curl_easy_perform()reports success right away. This returns CURLE_RECV_ERROR, CURLE_READ_ERROR and CURLE_ABORTED_BY_CALLBACK instead. The Windows code returned CURLE_READ_ERROR for CURL_READFUNC_ABORT, and now also returns CURLE_ABORTED_BY_CALLBACK.Test 1695 reuses lib513 (read callback returning CURL_READFUNC_ABORT) with a telnet URL; it fails without the change. I checked the other two cases by hand, with a directory as CURLOPT_READDATA and with
poll()made to fail with ENOMEM through LD_PRELOAD.The curl tool never returns CURL_READFUNC_ABORT and turns read errors into EOF, so it only sees the
poll()change.