-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fixed GH-10270 Unable to return CURL_READFUNC_PAUSE in readfunc callback #10607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0fa8221
to
98ef7ca
Compare
@@ -1547,6 +1547,8 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) | |||
if (Z_TYPE(retval) == IS_STRING) { | |||
length = MIN((int) (size * nmemb), Z_STRLEN(retval)); | |||
memcpy(data, Z_STRVAL(retval), length); | |||
} else if (Z_TYPE(retval) == IS_LONG) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how difficult is it to add a test for the usage of CURL_READFUNC_PAUSE
? it would be nice to have one I guess unless it's very compilcated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added one, that I know test the code, but what I don't like about it is that there is no way to know that the read is paused. But I guess it's better than nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's definitely better! Would it make sense to return CURL_READFUNC_PAUSE
until a specific amount of time elapses (e.g. 1 sec)? If this makes sense then the test should be tagged as slow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CURLOPT_READFUNCTION
callback is not called after returning CURL_READFUNC_PAUSE
until curl_pause(CURLPAUSE_CONT)
is called. So I don't think that it will really improve the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK then!
98ef7ca
to
4410762
Compare
ea34a9b
to
2a7d356
Compare
Fixes GH-10270 - If the value returned in the
CURLOPT_READFUNCTION
is an integer then return it. This will allow to return theCURL_READFUNC_PAUSE
magic value.