summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfsbs <fsbs@users.noreply.github.com>2021-10-31 11:13:07 +0000
committerfsbs <fsbs@users.noreply.github.com>2021-10-31 12:13:07 +0100
commit9bc059968b9240cd3fdc5a0bba8180e884b4081b (patch)
tree3f2960556e5edba68e0f9b0f2b33d39d629fc504
parenta2dae3b2e52287edb9d06cc4b273ce17ca6c91b3 (diff)
downloadpycurl-9bc059968b9240cd3fdc5a0bba8180e884b4081b.tar.gz
Add duphandle() documentation
-rw-r--r--doc/docstrings/curl_duphandle.rst23
-rw-r--r--src/easy.c2
2 files changed, 24 insertions, 1 deletions
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