From 9bc059968b9240cd3fdc5a0bba8180e884b4081b Mon Sep 17 00:00:00 2001 From: fsbs Date: Sun, 31 Oct 2021 11:13:07 +0000 Subject: Add duphandle() documentation --- doc/docstrings/curl_duphandle.rst | 23 +++++++++++++++++++++++ src/easy.c | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 doc/docstrings/curl_duphandle.rst diff --git a/doc/docstrings/curl_duphandle.rst b/doc/docstrings/curl_duphandle.rst new file mode 100644 index 0000000..ca6e7a8 --- /dev/null +++ b/doc/docstrings/curl_duphandle.rst @@ -0,0 +1,23 @@ +duphandle() -> Curl + +Clone a curl handle. This function will return a new curl handle, +a duplicate, using all the options previously set in the input curl handle. +Both handles can subsequently be used independently. + +The new handle will not inherit any state information, no connections, +no SSL sessions and no cookies. It also will not inherit any share object +states or options (it will be made as if SHARE was unset). + +Corresponds to `curl_easy_duphandle`_ in libcurl. + +Example usage:: + + import pycurl + curl = pycurl.Curl() + curl.setopt(pycurl.URL, "https://python.org") + dup = curl.duphandle() + curl.perform() + dup.perform() + +.. _curl_easy_duphandle: + https://curl.se/libcurl/c/curl_easy_duphandle.html diff --git a/src/easy.c b/src/easy.c index f3f7fc5..aeb2b78 100644 --- a/src/easy.c +++ b/src/easy.c @@ -728,7 +728,7 @@ PYCURL_INTERNAL PyMethodDef curlobject_methods[] = { {"setopt_string", (PyCFunction)do_curl_setopt_string, METH_VARARGS, curl_setopt_string_doc}, {"unsetopt", (PyCFunction)do_curl_unsetopt, METH_VARARGS, curl_unsetopt_doc}, {"reset", (PyCFunction)do_curl_reset, METH_NOARGS, curl_reset_doc}, - {"duphandle", (PyCFunction)do_curl_duphandle, METH_NOARGS, NULL}, + {"duphandle", (PyCFunction)do_curl_duphandle, METH_NOARGS, curl_duphandle_doc}, #if defined(HAVE_CURL_OPENSSL) {"set_ca_certs", (PyCFunction)do_curl_set_ca_certs, METH_VARARGS, curl_set_ca_certs_doc}, #endif -- cgit v1.2.1