mirror of
https://github.com/c-cube/ezcurl.git
synced 2026-03-07 21:47:55 -05:00
set options after resetting curl handle (#29)
* set options after resetting curl handle * format --------- Co-authored-by: Simon Cruanes <simon.cruanes.2007@m4x.org>
This commit is contained in:
parent
44a2b9f149
commit
674eac996b
2 changed files with 11 additions and 3 deletions
|
|
@ -68,7 +68,11 @@ module Config = struct
|
||||||
let to_string s = Format.asprintf "%a" pp s
|
let to_string s = Format.asprintf "%a" pp s
|
||||||
end
|
end
|
||||||
|
|
||||||
type t = { curl: Curl.t } [@@unboxed]
|
type t = {
|
||||||
|
curl: Curl.t;
|
||||||
|
set_opts: Curl.t -> unit;
|
||||||
|
}
|
||||||
|
|
||||||
type client = t
|
type client = t
|
||||||
|
|
||||||
let _top_mutex = Mutex.create ()
|
let _top_mutex = Mutex.create ()
|
||||||
|
|
@ -103,7 +107,7 @@ let make ?(set_opts = fun _ -> ()) ?cookiejar_file
|
||||||
Curl.set_cookiefile curl file);
|
Curl.set_cookiefile curl file);
|
||||||
if enable_session_cookies then Curl.set_cookiefile curl "";
|
if enable_session_cookies then Curl.set_cookiefile curl "";
|
||||||
set_opts curl;
|
set_opts curl;
|
||||||
{ curl }
|
{ curl; set_opts }
|
||||||
|
|
||||||
let delete (self : t) = Curl.cleanup self.curl
|
let delete (self : t) = Curl.cleanup self.curl
|
||||||
let _cfg_no_signal = ref false (* default: 0 *)
|
let _cfg_no_signal = ref false (* default: 0 *)
|
||||||
|
|
@ -403,6 +407,7 @@ module Make (IO : IO) : S with type 'a io = 'a IO.t = struct
|
||||||
| None -> true, make ()
|
| None -> true, make ()
|
||||||
| Some c ->
|
| Some c ->
|
||||||
Curl.reset c.curl;
|
Curl.reset c.curl;
|
||||||
|
c.set_opts c.curl;
|
||||||
false, c
|
false, c
|
||||||
in
|
in
|
||||||
_apply_config self config;
|
_apply_config self config;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ module Config : sig
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
end
|
end
|
||||||
|
|
||||||
type t = private { curl: Curl.t } [@@unboxed]
|
type t = {
|
||||||
|
curl: Curl.t;
|
||||||
|
set_opts: Curl.t -> unit;
|
||||||
|
}
|
||||||
(** A client, i.e. a cURL instance. The wrapping record has been present since
|
(** A client, i.e. a cURL instance. The wrapping record has been present since
|
||||||
0.3 *)
|
0.3 *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue