You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I understand correctly httr::write_stream is mostly offhanded to curl::curl_fetch_stream which does not take into account the value that is returned by the callback function in such way as defined in the httr docs.
As a reference the docs from ?httr::write_stream:
write_stream(f)
Arguments
f: Callback function. It should have a single argument, a raw vector containing the bytes recieved from the server. This will usually be 16k or less. It should return the length of bytes processed - if this is less than the input length, the function will terminate.
If the callback function's return value would actually be checked to be the length of bytes processed, which it doesn't ATM, this would allow for terminating the stream when required.
Or maybe I'm taking this too far and there is a much easier way to terminate the handler when wanted? 😁
The text was updated successfully, but these errors were encountered:
bart6114
changed the title
curl_fetch_stream: return value of fun not evaluated - desired behaviour?
curl_fetch_stream: return value of 'fun' not evaluated - desired behaviour?
Apr 18, 2016
We can't add a feature like this in curl right now because functions already using curl_fetch_stream will likely break. There is no mention in the curl documentation that the handler should return the buffer size. So I think this is mostly a bug in httr.
As an alternative you can simply use curl's connection interface:
This relates to r-lib/httr#352.
If I understand correctly
httr::write_stream
is mostly offhanded tocurl::curl_fetch_stream
which does not take into account the value that is returned by the callback function in such way as defined in thehttr
docs.As a reference the docs from
?httr::write_stream
:If the callback function's return value would actually be checked to be the length of bytes processed, which it doesn't ATM, this would allow for terminating the stream when required.
This quick hack:
Would allow e.g. for:
Or maybe I'm taking this too far and there is a much easier way to terminate the handler when wanted? 😁
The text was updated successfully, but these errors were encountered: