mirror of
https://github.com/c-cube/ezcurl.git
synced 2025-12-06 03:05:31 -05:00
Expose underlying no signal in a global setting
This commit is contained in:
parent
0faaf35969
commit
48b3330b95
2 changed files with 19 additions and 0 deletions
|
|
@ -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 =
|
||||||
|
|
|
||||||
|
|
@ -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 *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue