Closed toots closed 2 years ago
Yes, that's correct. I was more curious about your idea to make it work.
On Fri, May 28, 2021, 11:40 AM ygrek @.***> wrote:
@.**** commented on this pull request.
In curl.mli https://github.com/ygrek/ocurl/pull/43#discussion_r641681270 :
val set_writefunction : t -> (string -> int) -> unit + +( Return this value to pause the read transfers. ) +val readfunc_pause : int
READFUNCTION callback returns string, so it is not possible to return int value there, unless I am missing something.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ygrek/ocurl/pull/43#discussion_r641681270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGUVFDI4GMZNUCYHD7CZPDTP7BQ7ANCNFSM45TQNCOA .
add CURLOPT_READ of type int -> read_result
where read_result = String of string | Substring of string * int * int (* if we want to get fancy *) | Abort | Pause
and map it to the same CURLOPT_READFUNCTION on C side (keeping CURLOPT_READFUNCTION variant intact). Same for write.
Gotcha, will do thanks!
I looked into it and it's actually pretty tricky. The way the code is structured to implicitly create the handlers for each define
doesn't really allow for two alternative names for the read
callback. I might just restrict it to the write
callback, in which case it is pretty easy to define the alternative callback at the OCaml
level.
This PR adds the two special variables used to signal the library to pause read and write transfers.