Skip to content

Commit

Permalink
disable closesocketfunction
Browse files Browse the repository at this point in the history
ref #58
  • Loading branch information
ygrek committed Jan 7, 2022
1 parent 46d2c45 commit 006b968
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 5 additions & 3 deletions curl-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ typedef enum OcamlValues
Ocaml_IOCTLFUNCTION,
Ocaml_SEEKFUNCTION,
Ocaml_OPENSOCKETFUNCTION,
Ocaml_CLOSESOCKETFUNCTION,
/* Ocaml_CLOSESOCKETFUNCTION, */
Ocaml_SSH_KEYFUNCTION,

Ocaml_ERRORBUFFER,
Expand Down Expand Up @@ -1183,6 +1183,7 @@ static int cb_OPENSOCKETFUNCTION(void *data,
return ((sock == -1) ? CURL_SOCKET_BAD : sock);
}

/*
static int cb_CLOSESOCKETFUNCTION(void *data,
curl_socket_t socket)
{
Expand All @@ -1203,6 +1204,7 @@ static int cb_CLOSESOCKETFUNCTION(void *data,
caml_enter_blocking_section();
return result;
}
*/

static int cb_SSH_KEYFUNCTION(CURL *easy,
const struct curl_khkey *knownkey,
Expand Down Expand Up @@ -1575,7 +1577,7 @@ SETOPT_FUNCTION( IOCTL)
#endif

SETOPT_FUNCTION( OPENSOCKET)
SETOPT_FUNCTION( CLOSESOCKET)
/* SETOPT_FUNCTION( CLOSESOCKET) */

static void handle_slist(Connection *conn, struct curl_slist** slist, CURLoption curl_option, value option)
{
Expand Down Expand Up @@ -3612,7 +3614,7 @@ CURLOptionMapping implementedOptionMap[] =
HAVENOT(AUTOREFERER),
#endif
HAVE(OPENSOCKETFUNCTION),
HAVE(CLOSESOCKETFUNCTION),
/*HAVE(CLOSESOCKETFUNCTION),*/
#if HAVE_DECL_CURLOPT_PROXYTYPE
HAVE(PROXYTYPE),
#else
Expand Down
6 changes: 4 additions & 2 deletions curl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ type curlOption =
| CURLOPT_SEEKFUNCTION of (int64 -> curlSeek -> curlSeekResult)
| CURLOPT_AUTOREFERER of bool
| CURLOPT_OPENSOCKETFUNCTION of (Unix.file_descr -> unit)
| CURLOPT_CLOSESOCKETFUNCTION of (Unix.file_descr -> unit)
(* | CURLOPT_CLOSESOCKETFUNCTION of (Unix.file_descr -> unit) *)
| CURLOPT_PROXYTYPE of curlProxyType
| CURLOPT_PROTOCOLS of curlProto list
| CURLOPT_REDIR_PROTOCOLS of curlProto list
Expand Down Expand Up @@ -1019,8 +1019,10 @@ let set_autoreferer conn b =
let set_opensocketfunction conn closure =
setopt conn (CURLOPT_OPENSOCKETFUNCTION closure)

(*
let set_closesocketfunction conn closure =
setopt conn (CURLOPT_CLOSESOCKETFUNCTION closure)
*)

let set_proxytype conn ptype =
setopt conn (CURLOPT_PROXYTYPE ptype)
Expand Down Expand Up @@ -1427,7 +1429,7 @@ class handle =
method set_dns_servers l = set_dns_servers conn l
method set_autoreferer b = set_autoreferer conn b
method set_opensocketfunction closure = set_opensocketfunction conn closure
method set_closesocketfunction closure = set_closesocketfunction conn closure
(* method set_closesocketfunction closure = set_closesocketfunction conn closure *)
method set_proxytype t = set_proxytype conn t
method set_mimepost p = set_mimepost conn p
method set_sshknownhosts s = set_sshknownhosts conn s
Expand Down
10 changes: 7 additions & 3 deletions curl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ type curlOption =
| CURLOPT_SEEKFUNCTION of (int64 -> curlSeek -> curlSeekResult)
| CURLOPT_AUTOREFERER of bool
| CURLOPT_OPENSOCKETFUNCTION of (Unix.file_descr -> unit)
| CURLOPT_CLOSESOCKETFUNCTION of (Unix.file_descr -> unit)
(* | CURLOPT_CLOSESOCKETFUNCTION of (Unix.file_descr -> unit) *)
| CURLOPT_PROXYTYPE of curlProxyType
| CURLOPT_PROTOCOLS of curlProto list
| CURLOPT_REDIR_PROTOCOLS of curlProto list
Expand Down Expand Up @@ -790,7 +790,11 @@ val set_proxytransfermode : t -> bool -> unit
val set_seekfunction : t -> (int64 -> curlSeek -> curlSeekResult) -> unit
val set_autoreferer : t -> bool -> unit
val set_opensocketfunction : t -> (Unix.file_descr -> unit) -> unit

(** current implementation is faulty
ref https://github.com/ygrek/ocurl/issues/58
val set_closesocketfunction : t -> (Unix.file_descr -> unit) -> unit
*)
val set_proxytype : t -> curlProxyType -> unit
val set_protocols : t -> curlProto list -> unit
val set_redirprotocols : t -> curlProto list -> unit
Expand Down Expand Up @@ -867,7 +871,7 @@ val get_localport : t -> int
val get_conditionunmet : t -> bool
(** @since 0.6.1 (libcurl 7.19.4) *)
val get_certinfo : t -> string list list
(** @since 0.9.3 *)
(** @since 0.9.2 *)
val get_http_version : t -> curlHTTPVersion

(** {2 Object interface} *)
Expand Down Expand Up @@ -1013,7 +1017,7 @@ class handle :
method set_seekfunction : (int64 -> curlSeek -> curlSeekResult) -> unit
method set_autoreferer : bool -> unit
method set_opensocketfunction : (Unix.file_descr -> unit) -> unit
method set_closesocketfunction : (Unix.file_descr -> unit) -> unit
(* method set_closesocketfunction : (Unix.file_descr -> unit) -> unit *)
method set_proxytype : curlProxyType -> unit
method set_resolve : (string * int * string) list -> (string * int) list -> unit
method set_dns_servers : string list -> unit
Expand Down

0 comments on commit 006b968

Please sign in to comment.