[Pkg-ocaml-maint-commits] [ocurl] 10/23: Imported Upstream version 0.7.2
Stéphane Glondu
glondu at moszumanska.debian.org
Tue Feb 23 10:20:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
glondu pushed a commit to branch master
in repository ocurl.
commit 870385a78fe63b5e907677b215372dbf74e987ce
Author: Stephane Glondu <steph at glondu.net>
Date: Tue Feb 23 10:41:54 2016 +0100
Imported Upstream version 0.7.2
---
CHANGES.txt | 6 ++++++
Makefile.in | 8 ++++----
configure | 18 +++++++++---------
configure.in | 2 +-
curl-helper.c | 30 ++++++++++++++++++++++++------
curl_lwt.ml | 6 ++++--
examples/Makefile.in | 4 ++--
7 files changed, 50 insertions(+), 24 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 57ab9c7..8ff637b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,9 @@
+0.7.2 - 23 Sep 2014
+
+ * fix Curl.duphandle wrt CURLOPT_DNS_SERVERS
+ * lwt: fix memory leak
+ * Multi: keep Curl.t alive
+
0.7.1 - 12 May 2014
* Multi: win32 support (arirux)
diff --git a/Makefile.in b/Makefile.in
index caa1c41..5a8eefd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,7 +16,7 @@ OCAMLOPT = @OCAMLOPT@
OCAMLDEP = @OCAMLDEP@
OCAMLMKLIB = @OCAMLMKLIB@
-FLAGS =
+FLAGS = -g
LIBS =
CFLAGS = @CFLAGS@ @DEFS@ -Wall
@@ -67,13 +67,13 @@ curl.cmxa: $(CURLOBJS) dllcurl-helper.so
$(OCAMLMKLIB) -o curl $(CURLOBJS) -oc curl-helper $(CLIBS)
curl_lwt.cmo: curl_lwt.ml
- $(FINDLIB) c -package lwt.unix -c $< -o $@
+ $(FINDLIB) c -package lwt.unix -c $(FLAGS) $< -o $@
curl_lwt.cmx: curl_lwt.ml
- $(FINDLIB) opt -package lwt.unix -c $< -o $@
+ $(FINDLIB) opt -package lwt.unix -c $(FLAGS) $< -o $@
curl_lwt.cmi: curl_lwt.mli
- $(FINDLIB) c -package lwt -c $< -o $@
+ $(FINDLIB) c -package lwt -c $(FLAGS) $< -o $@
.ml.cmx:
$(OCAMLOPT) -c $(FLAGS) $< -o $@
diff --git a/configure b/configure
index 823e440..8af4888 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ocurl 0.7.1.
+# Generated by GNU Autoconf 2.69 for ocurl 0.7.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ocurl'
PACKAGE_TARNAME='ocurl'
-PACKAGE_VERSION='0.7.1'
-PACKAGE_STRING='ocurl 0.7.1'
+PACKAGE_VERSION='0.7.2'
+PACKAGE_STRING='ocurl 0.7.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1242,7 +1242,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ocurl 0.7.1 to adapt to many kinds of systems.
+\`configure' configures ocurl 0.7.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1303,7 +1303,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ocurl 0.7.1:";;
+ short | recursive ) echo "Configuration of ocurl 0.7.2:";;
esac
cat <<\_ACEOF
@@ -1383,7 +1383,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ocurl configure 0.7.1
+ocurl configure 0.7.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1681,7 +1681,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ocurl $as_me 0.7.1, which was
+It was created by ocurl $as_me 0.7.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -8520,7 +8520,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ocurl $as_me 0.7.1, which was
+This file was extended by ocurl $as_me 0.7.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8582,7 +8582,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ocurl config.status 0.7.1
+ocurl config.status 0.7.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.in b/configure.in
index 8a5024d..6c3106f 100644
--- a/configure.in
+++ b/configure.in
@@ -2,7 +2,7 @@ dnl
dnl ocurl autoconf input
dnl
-AC_INIT(ocurl,0.7.1)
+AC_INIT(ocurl,0.7.2)
AC_PROG_CC()
diff --git a/curl-helper.c b/curl-helper.c
index 36c75d5..b86d7f5 100644
--- a/curl-helper.c
+++ b/curl-helper.c
@@ -10,6 +10,8 @@
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
+/* suppress false gcc warning on seekFunction */
+#define CURL_DISABLE_TYPECHECK
#include <curl/curl.h>
#include <caml/alloc.h>
@@ -112,6 +114,8 @@ enum OcamlValues
OcamlSSHHostPublicKeyMD5,
OcamlCopyPostFields,
+ OcamlDNSServers,
+
/* Not used, last for size */
OcamlValuesSize
};
@@ -124,7 +128,7 @@ struct Connection
value ocamlValues;
- size_t refcount; /* number of OCaml heap values referencing this structure */
+ size_t refcount; /* number of references to this structure */
char *url;
char *proxy;
@@ -1410,6 +1414,10 @@ static Connection *duplicateConnection(Connection *original)
handleCopyPostFields(connection,
Field(original->ocamlValues,
OcamlCopyPostFields));
+ if (Field(original->ocamlValues, OcamlDNSServers) != Val_unit)
+ handleDnsServers(connection,
+ Field(original->ocamlValues,
+ OcamlDNSServers));
return connection;
}
@@ -1432,7 +1440,8 @@ static void removeConnection(Connection *connection, int finalization)
{
fin_url = "unknown";
}
- fprintf(stderr,"Curl: handle %p leaked, conn %p, url %s", connection->connection, connection, fin_url);
+ fprintf(stderr,"Curl: handle %p leaked, conn %p, url %s\n", connection->connection, connection, fin_url);
+ fflush(stderr);
}
else
{
@@ -5492,6 +5501,8 @@ static void handleDnsServers(Connection *conn, value option)
{
CAMLparam1(option);
+ Store_field(conn->ocamlValues, OcamlDNSServers, option);
+
CURLcode result = CURLE_OK;
free_if(conn->dns_servers);
@@ -6371,6 +6382,7 @@ CAMLprim value caml_curlm_remove_finished(value v_multi)
{
Store_field(Field(conn->ocamlValues, OcamlErrorBuffer), 0, caml_copy_string(conn->errorBuffer));
}
+ conn->refcount--;
/* NB: same handle, but different block */
v_easy = caml_curl_alloc(conn);
v_tuple = caml_alloc(2, 0);
@@ -6426,12 +6438,17 @@ CAMLprim value caml_curl_multi_add_handle(value v_multi, value v_easy)
{
CAMLparam2(v_multi,v_easy);
CURLM* multi = CURLM_val(v_multi);
- CURL* easy = Connection_val(v_easy)->connection;
+ Connection* conn = Connection_val(v_easy);
+
+ /* prevent collection of OCaml value while the easy handle is used
+ and may invoke callbacks registered on OCaml side */
+ conn->refcount++;
/* may invoke callbacks so need to be consistent with locks */
caml_enter_blocking_section();
- if (CURLM_OK != curl_multi_add_handle(multi, easy))
+ if (CURLM_OK != curl_multi_add_handle(multi, conn->connection))
{
+ conn->refcount--; /* not added, revert */
caml_leave_blocking_section();
failwith("caml_curl_multi_add_handle");
}
@@ -6444,15 +6461,16 @@ CAMLprim value caml_curl_multi_remove_handle(value v_multi, value v_easy)
{
CAMLparam2(v_multi,v_easy);
CURLM* multi = CURLM_val(v_multi);
- CURL* easy = Connection_val(v_easy)->connection;
+ Connection* conn = Connection_val(v_easy);
/* may invoke callbacks so need to be consistent with locks */
caml_enter_blocking_section();
- if (CURLM_OK != curl_multi_remove_handle(multi, easy))
+ if (CURLM_OK != curl_multi_remove_handle(multi, conn->connection))
{
caml_leave_blocking_section();
failwith("caml_curl_multi_remove_handle");
}
+ conn->refcount--;
caml_leave_blocking_section();
CAMLreturn(Val_unit);
diff --git a/curl_lwt.ml b/curl_lwt.ml
index c02ac04..93c909f 100644
--- a/curl_lwt.ml
+++ b/curl_lwt.ml
@@ -17,6 +17,7 @@ type multi = {
let create () =
let mt = M.create () in
+ let timer_event = ref Lwt_engine.fake_event in
let all_events = Hashtbl.create 32 in
let wakeners = Hashtbl.create 32 in
let finished s =
@@ -49,13 +50,14 @@ let create () =
in
let on_timer _ =
if !debug then log "on_timer";
+ Lwt_engine.stop_event !timer_event;
M.action_timeout mt;
finished "on_timer"
in
M.set_timer_function mt begin fun timeout ->
if !debug then log "set timeout %d" timeout;
- let (_:Lwt_engine.event) = Lwt_engine.on_timer (float_of_int timeout /. 1000.) false on_timer in
- ()
+ Lwt_engine.stop_event !timer_event; (* duplicate stop_event is ok *)
+ timer_event := Lwt_engine.on_timer (float_of_int timeout /. 1000.) false on_timer
end;
M.set_socket_function mt begin fun fd what ->
if !debug then log "set socket fd %d %s" (int_of_fd fd)
diff --git a/examples/Makefile.in b/examples/Makefile.in
index f0c4beb..678ba11 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -10,8 +10,8 @@ OCBYTE = @OCAMLC@ -thread
OCOPT = @OCAMLOPT@ -thread
FINDLIB = @OCAMLFIND@
-FLAGS = -I ..
-LFLAGS = -I .. -ccopt -L..
+FLAGS = -g -I ..
+LFLAGS = -g -I .. -ccopt -L..
OCURLLIB = curl.cma unix.cma threads.cma
OCURLOPTLIB = curl.cmxa unix.cmxa threads.cmxa
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocurl.git
More information about the Pkg-ocaml-maint-commits
mailing list