Skip to content

Conversation

@adoy
Copy link
Member

@adoy adoy commented Feb 17, 2023

Fixes GH-10270 - If the value returned in the CURLOPT_READFUNCTION is an integer then return it. This will allow to return the CURL_READFUNC_PAUSE magic value.

@adoy adoy changed the base branch from master to PHP-8.1 February 17, 2023 04:56
@adoy adoy requested a review from kocsismate February 17, 2023 04:56
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) {
Copy link
Member

@kocsismate kocsismate Feb 19, 2023

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

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

OK then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants