This commit is contained in:
Stéphane Lavergne 2025-01-29 17:46:11 +00:00 committed by GitHub
commit c77636f667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View file

@ -97,6 +97,21 @@ let make ?(set_opts = fun _ -> ()) ?cookiejar_file
let delete (self : t) = Curl.cleanup self.curl let delete (self : t) = Curl.cleanup self.curl
let _cfg_mutex = Mutex.create ()
let _cfg_no_signal = ref None
let _get_no_signal () =
Mutex.lock _cfg_mutex;
let v = !_cfg_no_signal in
Mutex.unlock _cfg_mutex;
v
let set_no_signal v =
Mutex.lock _cfg_mutex;
_cfg_no_signal := Some v;
Mutex.unlock _cfg_mutex;
()
module Cookies = struct module Cookies = struct
let reload_cookiejar (self : t) : unit = let reload_cookiejar (self : t) : unit =
Curl.set_cookielist self.curl "RELOAD" Curl.set_cookielist self.curl "RELOAD"
@ -131,6 +146,7 @@ let _apply_config (self : t) (config : Config.t) : unit =
opt_iter authmethod ~f:(Curl.set_httpauth self.curl); opt_iter authmethod ~f:(Curl.set_httpauth self.curl);
opt_iter username ~f:(Curl.set_username self.curl); opt_iter username ~f:(Curl.set_username self.curl);
opt_iter password ~f:(Curl.set_password self.curl); opt_iter password ~f:(Curl.set_password self.curl);
opt_iter (_get_no_signal ()) ~f:(Curl.set_nosignal self);
() ()
let _set_headers (self : t) (headers : _ list) : unit = let _set_headers (self : t) (headers : _ list) : unit =

View file

@ -37,6 +37,9 @@ val delete : t -> unit
val with_client : ?set_opts:(Curl.t -> unit) -> (t -> 'a) -> 'a val with_client : ?set_opts:(Curl.t -> unit) -> (t -> 'a) -> 'a
(** Make a temporary client, call the function with it, then cleanup. *) (** Make a temporary client, call the function with it, then cleanup. *)
val set_no_signal : bool -> unit
(** Set no_signal default value for each new client instance *)
(** Cookie handling. (** Cookie handling.
@since NEXT_RELEASE *) @since NEXT_RELEASE *)