[Python-modules-commits] [pycurl] 02/07: Import pycurl_7.21.5.orig.tar.gz

Barry Warsaw barry at moszumanska.debian.org
Tue Jan 12 19:46:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

barry pushed a commit to branch master
in repository pycurl.

commit 27c9dcbe03ae89b24377b8c629f3ed3c393d6432
Author: Barry Warsaw <barry at python.org>
Date:   Tue Jan 12 14:27:34 2016 -0500

    Import pycurl_7.21.5.orig.tar.gz
---
 AUTHORS                                            |  14 +-
 COPYING-MIT                                        |   2 +-
 ChangeLog                                          |  78 ++++
 INSTALL.rst                                        |  44 +-
 MANIFEST.in                                        |   1 +
 Makefile                                           |   3 +
 PKG-INFO                                           |   2 +-
 README.rst                                         |  10 +-
 RELEASE-NOTES.rst                                  |  26 +-
 doc/callbacks.rst                                  | 304 +++++++++----
 doc/conf.py                                        |   6 +-
 doc/curlobject.rst                                 |   2 +
 doc/docstrings/curl_setopt.rst                     |   4 +-
 doc/index.rst                                      |   2 +-
 doc/release-process.rst                            |  38 +-
 examples/ssh_keyfunction.py                        |  15 +
 setup.py                                           |  54 ++-
 src/docstrings.c                                   |   4 +-
 src/easy.c                                         | 382 ++++++++++++++--
 src/module.c                                       | 373 +++++++++++----
 src/pycurl.h                                       |  13 +-
 tests/close_socket_cb_test.py                      |  75 ++++
 ...e_function_test.py => default_write_cb_test.py} |  12 +-
 tests/error_constants_test.py                      |   4 +
 tests/fake-curl/libcurl/with_gnutls.so             | Bin 0 -> 6095 bytes
 tests/fake-curl/libcurl/with_nss.so                | Bin 0 -> 6092 bytes
 tests/fake-curl/libcurl/with_openssl.so            | Bin 0 -> 6120 bytes
 tests/fake-curl/libcurl/with_unknown_ssl.so        | Bin 0 -> 6124 bytes
 tests/fake-curl/libcurl/without_ssl.so             | Bin 0 -> 6087 bytes
 .../{header_function_test.py => header_cb_test.py} |  12 +-
 tests/matrix.py                                    |  16 +-
 tests/open_socket_cb_test.py                       | 115 +++++
 tests/option_constants_test.py                     | 185 +++++++-
 tests/{read_callback_test.py => read_cb_test.py}   |  32 +-
 tests/run.sh                                       |   5 +
 ...constants_test.py => seek_cb_constants_test.py} |   6 +-
 tests/{seek_function_test.py => seek_cb_test.py}   |   8 +-
 tests/setup_test.py                                |  11 +
 tests/socket_open_test.py                          |  44 --
 tests/sockopt_cb_test.py                           |  84 ++++
 tests/ssh_key_cb_test.py                           |  84 ++++
 tests/util.py                                      |  55 ++-
 tests/version_constants_test.py                    |  81 ++++
 winbuild.py                                        | 499 ++++++++++++++++++---
 winbuild/c-ares-vs2015.patch                       |  13 +
 winbuild/libcurl-fix-zlib-references.patch         |  25 ++
 winbuild/libssh2-vs2015.patch                      |  10 +
 winbuild/openssl-fix-crt.patch                     |  29 ++
 48 files changed, 2314 insertions(+), 468 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 63e75b8..85e0ff3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,6 @@
 Copyright (C) 2001-2008 by Kjetil Jacobsen <kjetilja at gmail.com>
 Copyright (C) 2001-2008 by Markus F.X.J. Oberhumer <markus at oberhumer.com>
-Copyright (C) 2013-2015 by Oleg Pudeyev <oleg at bsdpower.com>
+Copyright (C) 2013-2016 by Oleg Pudeyev <oleg at bsdpower.com>
 
 Please see README, COPYING-LGPL and COPYING-MIT for license information.
 
@@ -11,23 +11,23 @@ Adam Guthrie <therigu at users.sourceforge.net>
 Adam Jacob Muller <adam at isprime.com>
 Amit Mongia <amit_mongia at hotmail.com>
 Andjelko Horvat <comel at vingd.com>
-Barry Warsaw <barry at python.org>
+Barry Warsaw <barry at python.org>
 Bastian Kleineidam
 Christopher Warner <cwarner at kernelcode.com>
-Clint Clayton <clintclayton at me.com>
+Clint Clayton <clintclayton at me.com>
 Conrad Steenberg <conrad at hep.caltech.edu>
 Daniel Pena Arteaga <dpena at ph.tum.de>
 decitre <decitre at gmail.com>
-Dmitry Ketov <dketov at gmail.com>
+Dmitry Ketov <dketov at gmail.com>
 Domenico Andreoli <cavok at libero.it>
 Dominique <curl-and-python at d242.net>
 Eric S. Raymond <esr at thyrsus.com>
-Francisco Alves <chico at corp.globo.com>
+Francisco Alves <chico at corp.globo.com>
 Gisle Vanem <gvanem at yahoo.no>
-Gregory Petukhov <lorien at lorien.name>
+Gregory Petukhov <lorien at lorien.name>
 Jakob Truelsen <jakob at scalgo.com>
 Jayne <corvine at gmail.com>
-JiCiT
+JiCiT <jason at infinitebubble.com>
 Jim Patterson
 K.S.Sreeram <sreeram at tachyontech.net>
 Kamil Dudka <kdudka at redhat.com>
diff --git a/COPYING-MIT b/COPYING-MIT
index cffe3d3..322f8a3 100644
--- a/COPYING-MIT
+++ b/COPYING-MIT
@@ -2,7 +2,7 @@ COPYRIGHT AND PERMISSION NOTICE
 
 Copyright (C) 2001-2008 by Kjetil Jacobsen <kjetilja at gmail.com>
 Copyright (C) 2001-2008 by Markus F.X.J. Oberhumer <markus at oberhumer.com>
-Copyright (C) 2013-2015 by Oleg Pudeyev <oleg at bsdpower.com>
+Copyright (C) 2013-2016 by Oleg Pudeyev <oleg at bsdpower.com>
 
 All rights reserved.
 
diff --git a/ChangeLog b/ChangeLog
index efa07f3..ae3ed63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,81 @@
+Version 7.21.5 [requires libcurl-7.19.0 or better] - 2016-01-05
+---------------------------------------------------------------
+
+        * --with-openssl and its --win-ssl alias setup.py options are now
+          accepted under Windows in order to use OpenSSL's crypto locks
+          when building against OpenSSL.
+
+        * --with-openssl added as an alias for --with-ssl option to setup.py.
+
+        * Official Windows builds are now linked against C-Ares and libssh2.
+
+        * Official Windows builds are now linked against OpenSSL instead of
+          WinSSL.
+
+        * Official Windows builds are now statically linked against
+          their dependencies (libcurl and zlib).
+
+        * Added CURLOPT_USE_SSL and CURLUSESSL_* constants.
+
+        * Added CURLOPT_APPEND, CURLOPT_COOKIESESSION, CURLOPT_DIRLISTONLY,
+          CURLOPT_KEYPASSWD, CURLOPT_TELNETOPTIONS.
+
+        * Several CURLE_* and CURLM_* constants added.
+
+        * Add VERSION_* constants, corresponding to CURL_VERSION_*.
+
+        * Breaking change: OPENSOCKETFUNCTION callback API now mirrors that
+          of libcurl:
+          1. The callback now takes two arguments, `purpose' and `address`.
+             Previously the callback took `family', `socktype', `protocol`
+             and `addr' arguments.
+          2. The second argument to the callback, `address', is a
+             `namedtuple' with `family', `socktype', `protocol' and
+             `addr' fields.
+          3. `addr' field on `address' for AF_INET6 family addresses is a
+             4-tuple of (address, port, flow info, scope id) which matches
+             Python's `socket.getaddrinfo' API.
+
+          It seems that libcurl may mishandle error return from an
+          opensocket callback, as would happen when code written for
+          pre-PycURL 7.21.5 API is run with PycURL 7.21.5 or newer,
+          resulting in the application hanging.
+
+        * OPENSOCKETFUNCTION callback can now be unset.
+
+        * Added CURLOPT_CLOSESOCKETFUNCTION (libcurl 7.21.7+).
+          CURLOPT_CLOSESOCKETDATA is used internally by PycURL.
+
+        * Added CURLOPT_SOCKOPTFUNCTION. CURLOPT_SOCKOPTDATA is used
+          internally by PycURL.
+
+        * Added CURLOPT_SSH_KEYFUNCTION (libcurl 7.19.6+).
+          CURLOPT_SSH_KEYDATA is used internally by PycURL.
+
+        * Added CURLOPT_SSL_OPTIONS (libcurl 7.25.0+).
+
+        * Added CURLOPT_KRBLEVEL.
+
+        * Added CURLOPT_SSL_FALSESTART (libcurl 7.42.0+).
+
+        * Added CURLOPT_SSL_ENABLE_NPN (libcurl 7.36.0+).
+
+        * Added CURLOPT_SSL_ENABLE_ALPN (libcurl 7.36.0+).
+
+        * Added CURLOPT_UNIX_SOCKET_PATH (libcurl 7.40.0+).
+
+        * Added CURLOPT_WILDCARDMATCH (libcurl 7.21.0+).
+
+        * C module initialization changed to raise exceptions on failure
+          rather than trigger a fatal error and abort the Python interpreter.
+
+        * Added CURLOPT_PINNEDPUBLICKEY (libcurl 7.39.0-7.44.0+
+          depending on SSL backend and encoding algorithm).
+
+        * Fixed incorrect detection of libcurl 7.19.5 and 7.19.6
+          (thanks to bataniya).
+
+
 Version 7.19.5.3 [requires libcurl-7.19.0 or better] - 2015-11-03
 -----------------------------------------------------------------
 
diff --git a/INSTALL.rst b/INSTALL.rst
index 7581f10..ad3293d 100644
--- a/INSTALL.rst
+++ b/INSTALL.rst
@@ -51,7 +51,11 @@ It will then fail at runtime as follows::
 
 To fix this, you need to tell ``setup.py`` what SSL backend is used::
 
-    python setup.py --with-[ssl|gnutls|nss] install
+    python setup.py --with-[openssl|gnutls|nss] install
+
+Note: as of PycURL 7.21.5, setup.py accepts ``--with-openssl`` option to
+indicate that libcurl is built against OpenSSL. ``--with-ssl`` is an alias
+for ``--with-openssl`` and continues to be accepted for backwards compatibility.
 
 You can also ask ``setup.py`` to obtain SSL backend information from installed
 libcurl shared library, as follows:
@@ -82,10 +86,6 @@ note above)::
     export PYCURL_SSL_LIBRARY=[openssl|gnutls|nss]
     easy_install pycurl
 
-Please note the difference in spelling that concerns OpenSSL: the command-line
-argument is --with-ssl, to match libcurl, but the environment variable value is
-"openssl".
-
 
 pip and cached pycurl package
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -99,23 +99,24 @@ To force pip to recompile pycurl, run::
 
     # upgrade pip if necessary
     pip install --upgrade pip
-    
+
     # remove current pycurl
     pip remove pycurl
-    
+
     # set PYCURL_SSL_LIBRARY
     export PYCURL_SSL_LIBRARY=nss
-    
+
     # recompile and install pycurl
     pip install --compile pycurl
 
 .. _this Stack Overflow post: http://stackoverflow.com/questions/21487278/ssl-error-installing-pycurl-after-ssl-is-set
 
+
 Windows
 -------
 
 Binary Packages
-...............
+^^^^^^^^^^^^^^^
 
 Binary packages are available in the `download area`_
 for some Windows and Python version combinations.
@@ -151,8 +152,9 @@ You may find `the entire thread starting here`_ helpful.
 .. _msvcrt.dll variants: http://curl.haxx.se/mail/curlpython-2014-05/0010.html
 .. _the entire thread starting here: http://curl.haxx.se/mail/curlpython-2014-05/0000.html
 
+
 Installing From Source
-......................
+^^^^^^^^^^^^^^^^^^^^^^
 
 First, you will need to obtain dependencies. These can be precompiled binaries
 or source packages that you are going to compile yourself.
@@ -178,7 +180,10 @@ Additional Windows setup.py options:
   import library. The default is ``libcurl.lib`` which is appropriate for
   static linking and is sometimes the correct choice for dynamic linking as
   well. The other possibility for dynamic linking is ``libcurl_imp.lib``.
-- ``--avoid-stdio``: on windows, a process and each library it is using
+- ``--with-openssl``: use OpenSSL crypto locks when libcurl was built against
+  OpenSSL.
+- ``--with-ssl``: legacy alias for ``--with-openssl``.
+- ``--avoid-stdio``: on Windows, a process and each library it is using
   may be linked to its own version of the C runtime (msvcrt).
   FILE pointers from one C runtime may not be passed to another C runtime.
   This option prevents direct passing of FILE pointers from Python to libcurl,
@@ -203,7 +208,7 @@ You may find the following mailing list posts helpful:
 
 
 winbuild.py
-...........
+^^^^^^^^^^^
 
 This script is used to build official PycURL Windows packages. You can
 use it to build a full complement of packages with your own options or modify
@@ -252,3 +257,18 @@ To generate documentation, run::
 Generating documentation requires `Sphinx`_ to be installed.
 
 .. _Sphinx: http://sphinx-doc.org/
+
+
+A Note Regarding SSL Backends
+-----------------------------
+
+libcurl's functionality varies depending on which SSL backend it is compiled
+against. For example, users have `reported`_ `problems`_ with GnuTLS backend.
+As of this writing, generally speaking, OpenSSL backend has the most
+functionality as well as the best compatibility with other software.
+
+If you experience SSL issues, especially if you are not using OpenSSL
+backend, you can try rebuilding libcurl and PycURL against another SSL backend.
+
+.. _reported: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515200
+.. _problems: https://bugs.launchpad.net/ubuntu/+source/pycurl/+bug/1111673
diff --git a/MANIFEST.in b/MANIFEST.in
index 4a8e1c6..65b9ada 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -45,3 +45,4 @@ include tests/run.sh
 include tests/run-quickstart.sh
 include tests/vsftpd.conf
 include winbuild.py
+include winbuild/*
diff --git a/Makefile b/Makefile
index c7f2370..5d58628 100644
--- a/Makefile
+++ b/Makefile
@@ -55,14 +55,17 @@ DOCSTRINGS_SOURCES = \
 	doc/docstrings/curl_unsetopt.rst \
 	doc/docstrings/multi.rst \
 	doc/docstrings/multi_add_handle.rst \
+	doc/docstrings/multi_assign.rst \
 	doc/docstrings/multi_close.rst \
 	doc/docstrings/multi_fdset.rst \
 	doc/docstrings/multi_info_read.rst \
 	doc/docstrings/multi_perform.rst \
 	doc/docstrings/multi_remove_handle.rst \
 	doc/docstrings/multi_select.rst \
+	doc/docstrings/multi_setopt.rst \
 	doc/docstrings/multi_socket_action.rst \
 	doc/docstrings/multi_socket_all.rst \
+	doc/docstrings/multi_timeout.rst \
 	doc/docstrings/pycurl_global_cleanup.rst \
 	doc/docstrings/pycurl_global_init.rst \
 	doc/docstrings/pycurl_module.rst \
diff --git a/PKG-INFO b/PKG-INFO
index 1c87624..c420912 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pycurl
-Version: 7.19.5.3
+Version: 7.21.5
 Summary: PycURL -- cURL library module for Python
 Home-page: http://pycurl.sourceforge.net/
 Author: Oleg Pudeyev
diff --git a/README.rst b/README.rst
index 6a9a596..0a5f2a1 100644
--- a/README.rst
+++ b/README.rst
@@ -40,7 +40,7 @@ Overview
 Requirements
 ------------
 
-- Python 2.4 through 2.7 or 3.1 through 3.4.
+- Python 2.6, 2.7 or 3.1 through 3.5.
 - libcurl 7.19.0 or better.
 
 Installation
@@ -101,8 +101,6 @@ vsftpd tests you must explicitly set PYCURL_VSFTPD_PATH variable like so::
     # specify full path to vsftpd
     export PYCURL_VSFTPD_PATH=/usr/local/libexec/vsftpd
 
-These instructions work for Python 2.5 through 2.7 and 3.1 through 3.4.
-
 .. _nose: https://nose.readthedocs.org/
 .. _bottle: http://bottlepy.org/
 .. _vsftpd: http://vsftpd.beasts.org/
@@ -118,8 +116,8 @@ configurations. It supports:
   process test server.
 - Testing against locally compiled libcurl with arbitrary options.
 
-To use the test matrix, first you need to start the test server from
-Python 2.5+ by running::
+To use the test matrix, first start the test server from Python 2.5+ by
+running::
 
     python -m tests.appmanager
 
@@ -170,7 +168,7 @@ License
 
     Copyright (C) 2001-2008 by Kjetil Jacobsen <kjetilja at gmail.com>
     Copyright (C) 2001-2008 by Markus F.X.J. Oberhumer <markus at oberhumer.com>
-    Copyright (C) 2013-2015 by Oleg Pudeyev <oleg at bsdpower.com>
+    Copyright (C) 2013-2016 by Oleg Pudeyev <oleg at bsdpower.com>
 
     All rights reserved.
 
diff --git a/RELEASE-NOTES.rst b/RELEASE-NOTES.rst
index b08ec6c..742ab94 100644
--- a/RELEASE-NOTES.rst
+++ b/RELEASE-NOTES.rst
@@ -1,7 +1,31 @@
 Release Notes
 =============
 
-PycURL 7.19.5.3 - 2015-11-04
+PycURL 7.21.5 - 2016-01-05
+--------------------------
+
+Highlights of this release:
+
+1. Socket callbacks are now fully implemented (``CURLOPT_OPENSOCKETFUNCTION``,
+   ``CURLOPT_SOCKOPTFUNCTION``, ``CURLOPT_CLOSESOCKETFUNCTION``). Unfortunately
+   this required changing ``OPENSOCKETFUNCTION`` API once again in a
+   backwards-incompatible manner. Support for ``SOCKOPTFUNCTION`` and
+   ``CLOSESOCKETFUNCTION`` was added in this release. ``OPENSOCKETFUNCTION``
+   now supports Unix sockets.
+
+2. Many other libcurl options and constants have been added to PycURL.
+
+3. When ``pycurl`` module initialization fails, ``ImportError`` is raised
+   instead of a fatal error terminating the process.
+
+4. Usability of official Windows builds has been greatly improved:
+
+   * Dependencies are linked statically, eliminating possible DLL conflicts.
+   * OpenSSL is used instead of WinSSL.
+   * libcurl is linked against C-Ares and libssh2.
+
+
+PycURL 7.19.5.3 - 2015-11-03
 ----------------------------
 
 PycURL 7.19.5.2 release did not include some of the test suite files in
diff --git a/doc/callbacks.rst b/doc/callbacks.rst
index f72f636..a63b911 100644
--- a/doc/callbacks.rst
+++ b/doc/callbacks.rst
@@ -5,57 +5,105 @@ Callbacks
 
 For more fine-grained control, libcurl allows a number of callbacks to be
 associated with each connection. In pycurl, callbacks are defined using the
-``setopt()`` method for Curl objects with options WRITEFUNCTION,
-READFUNCTION, HEADERFUNCTION, PROGRESSFUNCTION, IOCTLFUNCTION, or
-DEBUGFUNCTION. These options correspond to the libcurl options with CURLOPT_*
+``setopt()`` method for Curl objects with options ``WRITEFUNCTION``,
+``READFUNCTION``, ``HEADERFUNCTION``, ``PROGRESSFUNCTION``, ``IOCTLFUNCTION``, or
+``DEBUGFUNCTION``. These options correspond to the libcurl options with ``CURLOPT_``
 prefix removed. A callback in pycurl must be either a regular Python
 function, a class method or an extension type function.
 
 There are some limitations to some of the options which can be used
 concurrently with the pycurl callbacks compared to the libcurl callbacks.
 This is to allow different callback functions to be associated with different
-Curl objects. More specifically, WRITEDATA cannot be used with WRITEFUNCTION,
-READDATA cannot be used with READFUNCTION, WRITEHEADER cannot be used with
-HEADERFUNCTION, PROGRESSDATA cannot be used with PROGRESSFUNCTION, IOCTLDATA
-cannot be used with IOCTLFUNCTION, and DEBUGDATA cannot be used with
-DEBUGFUNCTION. In practice, these limitations can be overcome by having a
+Curl objects. More specifically, ``WRITEDATA`` cannot be used with
+``WRITEFUNCTION``, ``READDATA`` cannot be used with ``READFUNCTION``,
+``WRITEHEADER`` cannot be used with ``HEADERFUNCTION``, ``PROGRESSDATA``
+cannot be used with ``PROGRESSFUNCTION``, ``IOCTLDATA``
+cannot be used with ``IOCTLFUNCTION``, and ``DEBUGDATA`` cannot be used with
+``DEBUGFUNCTION``. In practice, these limitations can be overcome by having a
 callback function be a class instance method and rather use the class
 instance attributes to store per object data such as files used in the
 callbacks.
 
-The signature of each callback used in pycurl is as follows:
+The signature of each callback used in pycurl is documented below.
 
-.. function:: HEADERFUNCTION(byte string) -> number of characters written
 
-    Callback for writing received headers. Corresponds to
-    `CURLOPT_HEADERFUNCTION`_ in libcurl.
-    
+WRITEFUNCTION
+-------------
+
+.. function:: WRITEFUNCTION(byte string) -> number of characters written
+
+    Callback for writing data. Corresponds to `CURLOPT_WRITEFUNCTION`_
+    in libcurl.
+
     On Python 3, the argument is of type ``bytes``.
 
-    The ``HEADERFUNCTION`` callback may return the number of bytes written.
+    The ``WRITEFUNCTION`` callback may return the number of bytes written.
     If this number is not equal to the size of the byte string, this signifies
     an error and libcurl will abort the request. Returning ``None`` is an
     alternate way of indicating that the callback has consumed all of the
     string passed to it and, hence, succeeded.
 
-.. function:: WRITEFUNCTION(byte string) -> number of characters written
+    `write_test.py test`_ shows how to use ``WRITEFUNCTION``.
+
+
+Example: Callbacks for document header and body
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This example prints the header data to stderr and the body data to stdout.
+Also note that neither callback returns the number of bytes written. For
+WRITEFUNCTION and HEADERFUNCTION callbacks, returning None implies that all
+bytes where written.
+
+::
+
+    ## Callback function invoked when body data is ready
+    def body(buf):
+        # Print body data to stdout
+        import sys
+        sys.stdout.write(buf)
+        # Returning None implies that all bytes were written
+
+    ## Callback function invoked when header data is ready
+    def header(buf):
+        # Print header data to stderr
+        import sys
+        sys.stderr.write(buf)
+        # Returning None implies that all bytes were written
+
+    c = pycurl.Curl()
+    c.setopt(pycurl.URL, "http://www.python.org/")
+    c.setopt(pycurl.WRITEFUNCTION, body)
+    c.setopt(pycurl.HEADERFUNCTION, header)
+    c.perform()
 
-    Callback for writing data. Corresponds to `CURLOPT_WRITEFUNCTION`_
-    in libcurl.
+
+HEADERFUNCTION
+--------------
+
+.. function:: HEADERFUNCTION(byte string) -> number of characters written
+
+    Callback for writing received headers. Corresponds to
+    `CURLOPT_HEADERFUNCTION`_ in libcurl.
 
     On Python 3, the argument is of type ``bytes``.
 
-    The ``WRITEFUNCTION`` callback may return the number of bytes written.
+    The ``HEADERFUNCTION`` callback may return the number of bytes written.
     If this number is not equal to the size of the byte string, this signifies
     an error and libcurl will abort the request. Returning ``None`` is an
     alternate way of indicating that the callback has consumed all of the
     string passed to it and, hence, succeeded.
 
+    `header_test.py test`_ shows how to use ``WRITEFUNCTION``.
+
+
+READFUNCTION
+------------
+
 .. function:: READFUNCTION(number of characters to read) -> byte string
 
     Callback for reading data. Corresponds to `CURLOPT_READFUNCTION`_ in
     libcurl.
-    
+
     On Python 3, the callback must return either a byte string or a Unicode
     string consisting of ASCII code points only.
 
@@ -63,66 +111,77 @@ The signature of each callback used in pycurl is as follows:
     ``READFUNC_PAUSE``. See the libcurl documentation for an explanation
     of these values.
 
-.. function:: PROGRESSFUNCTION(download total, downloaded, upload total, uploaded) -> status
-
-    Callback for progress meter. Corresponds to `CURLOPT_PROGRESSFUNCTION`_
-    in libcurl.
-
-.. function:: DEBUGFUNCTION(debug message type, debug message byte string) -> None
-
-    Callback for debug information. Corresponds to `CURLOPT_DEBUGFUNCTION`_
-    in libcurl.
+    The `file_upload.py example`_ in the distribution contains example code for
+    using ``READFUNCTION``.
 
-    *Changed in version 7.19.5.2:* The second argument to a ``DEBUGFUNCTION``
-    callback is now of type ``bytes`` on Python 3. Previously the argument was
-    of type ``str``.
 
 .. _SEEKFUNCTION:
 
+SEEKFUNCTION
+------------
+
 .. function:: SEEKFUNCTION(offset, origin) -> status
 
     Callback for seek operations. Corresponds to `CURLOPT_SEEKFUNCTION`_
     in libcurl.
 
+
+IOCTLFUNCTION
+-------------
+
 .. function:: IOCTLFUNCTION(ioctl cmd) -> status
 
     Callback for I/O operations. Corresponds to `CURLOPT_IOCTLFUNCTION`_
     in libcurl.
-    
+
     *Note:* this callback is deprecated. Use :ref:`SEEKFUNCTION <SEEKFUNCTION>` instead.
 
-Example: Callbacks for document header and body
------------------------------------------------
 
-This example prints the header data to stderr and the body data to stdout.
-Also note that neither callback returns the number of bytes written. For
-WRITEFUNCTION and HEADERFUNCTION callbacks, returning None implies that all
-bytes where written.
+DEBUGFUNCTION
+-------------
 
-::
+.. function:: DEBUGFUNCTION(debug message type, debug message byte string) -> None
 
-    ## Callback function invoked when body data is ready
-    def body(buf):
-        # Print body data to stdout
-        import sys
-        sys.stdout.write(buf)
-        # Returning None implies that all bytes were written
+    Callback for debug information. Corresponds to `CURLOPT_DEBUGFUNCTION`_
+    in libcurl.
 
-    ## Callback function invoked when header data is ready
-    def header(buf):
-        # Print header data to stderr
-        import sys
-        sys.stderr.write(buf)
-        # Returning None implies that all bytes were written
+    *Changed in version 7.19.5.2:* The second argument to a ``DEBUGFUNCTION``
+    callback is now of type ``bytes`` on Python 3. Previously the argument was
+    of type ``str``.
+
+    `debug_test.py test`_ shows how to use ``DEBUGFUNCTION``.
+
+
+Example: Debug callbacks
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+This example shows how to use the debug callback. The debug message type is
+an integer indicating the type of debug message. The VERBOSE option must be
+enabled for this callback to be invoked.
+
+::
+
+    def test(debug_type, debug_msg):
+        print "debug(%d): %s" % (debug_type, debug_msg)
 
     c = pycurl.Curl()
-    c.setopt(pycurl.URL, "http://www.python.org/")
-    c.setopt(pycurl.WRITEFUNCTION, body)
-    c.setopt(pycurl.HEADERFUNCTION, header)
+    c.setopt(pycurl.URL, "http://curl.haxx.se/")
+    c.setopt(pycurl.VERBOSE, 1)
+    c.setopt(pycurl.DEBUGFUNCTION, test)
     c.perform()
 
+
+PROGRESSFUNCTION
+----------------
+
+.. function:: PROGRESSFUNCTION(download total, downloaded, upload total, uploaded) -> status
+
+    Callback for progress meter. Corresponds to `CURLOPT_PROGRESSFUNCTION`_
+    in libcurl.
+
+
 Example: Download/upload progress callback
-------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This example shows how to use the progress callback. When downloading a
 document, the arguments related to uploads are zero, and vice versa.
@@ -142,33 +201,112 @@ document, the arguments related to uploads are zero, and vice versa.
     c.setopt(c.PROGRESSFUNCTION, progress)
     c.perform()
 
-Example: Debug callbacks
-------------------------
 
-This example shows how to use the debug callback. The debug message type is
-an integer indicating the type of debug message. The VERBOSE option must be
-enabled for this callback to be invoked.
+OPENSOCKETFUNCTION
+------------------
 
-::
+.. function:: OPENSOCKETFUNCTION(purpose, address) -> int
 
-    def test(debug_type, debug_msg):
-        print "debug(%d): %s" % (debug_type, debug_msg)
+    Callback for opening sockets. Corresponds to
+    `CURLOPT_OPENSOCKETFUNCTION`_ in libcurl.
 
-    c = pycurl.Curl()
-    c.setopt(pycurl.URL, "http://curl.haxx.se/")
-    c.setopt(pycurl.VERBOSE, 1)
-    c.setopt(pycurl.DEBUGFUNCTION, test)
-    c.perform()
+    *purpose* is a ``SOCKTYPE_*`` value.
 
-Other examples
---------------
+    *address* is a `namedtuple`_ with ``family``, ``socktype``, ``protocol``
+    and ``addr`` fields, per `CURLOPT_OPENSOCKETFUNCTION`_ documentation.
+
+    *addr* is an object representing the address. Currently the following
+    address families are supported:
+
+    - ``AF_INET``: *addr* is a 2-tuple of ``(host, port)``.
+    - ``AF_INET6``: *addr* is a 4-tuple of ``(host, port, flow info, scope id)``.
+    - ``AF_UNIX``: *addr* is a byte string containing path to the Unix socket.
+
+      Availability: Unix.
+
+    This behavior matches that of Python's `socket module`_.
+
+    The callback should return a socket object, a socket file descriptor
+    or a Python object with a ``fileno`` property containing the socket
+    file descriptor.
+
+    The callback may be unset by calling :ref:`setopt <setopt>` with ``None``
+    as the value or by calling :ref:`unsetopt <unsetopt>`.
+
+    `open_socket_cb_test.py test`_ shows how to use ``OPENSOCKETFUNCTION``.
+
+    *Changed in version 7.21.5:* Previously, the callback received ``family``,
+    ``socktype``, ``protocol`` and ``addr`` parameters (``purpose`` was
+    not passed and ``address`` was flattened). Also, ``AF_INET6`` addresses
+    were exposed as 2-tuples of ``(host, port)`` rather than 4-tuples.
+
+    *Changed in version 7.19.3:* ``addr`` parameter added to the callback.
+
+
+CLOSESOCKETFUNCTION
+-------------------
+
+.. function:: CLOSESOCKETFUNCTION(curlfd) -> int
+
+    Callback for setting socket options. Corresponds to
+    `CURLOPT_CLOSESOCKETFUNCTION`_ in libcurl.
+
+    *curlfd* is the file descriptor to be closed.
+
+    The callback should return an ``int``.
+
+    The callback may be unset by calling :ref:`setopt <setopt>` with ``None``
+    as the value or by calling :ref:`unsetopt <unsetopt>`.
+
+    `close_socket_cb_test.py test`_ shows how to use ``CLOSESOCKETFUNCTION``.
+
+
+SOCKOPTFUNCTION
+---------------
+
+.. function:: SOCKOPTFUNCTION(curlfd, purpose) -> int
+
+    Callback for setting socket options. Corresponds to `CURLOPT_SOCKOPTFUNCTION`_
+    in libcurl.
+
+    *curlfd* is the file descriptor of the newly created socket.
+
+    *purpose* is a ``SOCKTYPE_*`` value.
+
+    The callback should return an ``int``.
+
+    The callback may be unset by calling :ref:`setopt <setopt>` with ``None``
+    as the value or by calling :ref:`unsetopt <unsetopt>`.
+
+    `sockopt_cb_test.py test`_ shows how to use ``SOCKOPTFUNCTION``.
+
+
+SSH_KEYFUNCTION
+---------------
+
+.. function:: SSH_KEYFUNCTION(known_key, found_key, match) -> int
+
+    Callback for known host matching logic. Corresponds to
+    `CURLOPT_SSH_KEYFUNCTION`_ in libcurl.
+
+    *known_key* and *found_key* are instances of ``KhKey`` class which is a
+    `namedtuple`_ with ``key`` and ``keytype`` fields, corresponding to
+    libcurl's ``struct curl_khkey``::
+
+        KhKey = namedtuple('KhKey', ('key', 'keytype'))
+
+    On Python 2, the *key* field of ``KhKey`` is a ``str``. On Python 3, the
+    *key* field is ``bytes``. *keytype* is an ``int``.
+
+    *known_key* may be ``None`` when there is no known matching host key.
+
+    ``SSH_KEYFUNCTION`` callback should return a ``KHSTAT_*`` value.
+
+    The callback may be unset by calling :ref:`setopt <setopt>` with ``None``
+    as the value or by calling :ref:`unsetopt <unsetopt>`.
+
+    `ssh_key_cb_test.py test`_ shows how to use ``SSH_KEYFUNCTION``.
 
-The pycurl distribution also contains a number of test scripts and examples
-which show how to use the various callbacks in libcurl. For instance, the
-file ``examples/file_upload.py`` in the distribution contains example code for
-using READFUNCTION, ``tests/test_cb.py`` shows WRITEFUNCTION and
-HEADERFUNCTION, ``tests/test_debug.py`` shows DEBUGFUNCTION, and
-``tests/test_getinfo.py`` shows PROGRESSFUNCTION.
 
 .. _CURLOPT_HEADERFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_HEADERFUNCTION.html
 .. _CURLOPT_WRITEFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_WRITEFUNCTION.html
@@ -177,3 +315,17 @@ HEADERFUNCTION, ``tests/test_debug.py`` shows DEBUGFUNCTION, and
 .. _CURLOPT_DEBUGFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_DEBUGFUNCTION.html
 .. _CURLOPT_SEEKFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_SEEKFUNCTION.html
 .. _CURLOPT_IOCTLFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_IOCTLFUNCTION.html
+.. _file_upload.py example: https://github.com/pycurl/pycurl/blob/master/examples/file_upload.py
+.. _write_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/write_test.py
+.. _header_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/header_test.py
+.. _debug_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/debug_test.py
+.. _CURLOPT_SSH_KEYFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_SSH_KEYFUNCTION.html
+.. _namedtuple: https://docs.python.org/library/collections.html#collections.namedtuple
+.. _CURLOPT_SOCKOPTFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_SOCKOPTFUNCTION.html
+.. _sockopt_cb_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/sockopt_cb_test.py
+.. _ssh_key_cb_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/ssh_key_cb_test.py
+.. _CURLOPT_CLOSESOCKETFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_CLOSESOCKETFUNCTION.html
+.. _close_socket_cb_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/close_socket_cb_test.py
+.. _CURLOPT_OPENSOCKETFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_OPENSOCKETFUNCTION.html
+.. _open_socket_cb_test.py test: https://github.com/pycurl/pycurl/blob/master/tests/open_socket_cb_test.py
+.. _socket module: https://docs.python.org/library/socket.html
diff --git a/doc/conf.py b/doc/conf.py
index 8415174..c175fbc 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -47,16 +47,16 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'PycURL'
-copyright = u'2001-2015 Kjetil Jacobsen, Markus F.X.J. Oberhumer, Oleg Pudeyev'
+copyright = u'2001-2016 Kjetil Jacobsen, Markus F.X.J. Oberhumer, Oleg Pudeyev'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '7.19.5.3'
+version = '7.21.5'
 # The full version, including alpha/beta/rc tags.
-release = '7.19.5.3'
+release = '7.21.5'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/curlobject.rst b/doc/curlobject.rst
index 48dfc22..2a7b694 100644
--- a/doc/curlobject.rst
+++ b/doc/curlobject.rst
@@ -9,6 +9,7 @@ Curl Object
 
     .. automethod:: pycurl.Curl.close
 
+    .. _setopt:
     .. automethod:: pycurl.Curl.setopt
 
     .. automethod:: pycurl.Curl.perform
@@ -17,6 +18,7 @@ Curl Object
 
     .. automethod:: pycurl.Curl.reset
 
+    .. _unsetopt:
     .. automethod:: pycurl.Curl.unsetopt
 
     .. automethod:: pycurl.Curl.pause
diff --git a/doc/docstrings/curl_setopt.rst b/doc/docstrings/curl_setopt.rst
index 7808afb..ca95499 100644
--- a/doc/docstrings/curl_setopt.rst
+++ b/doc/docstrings/curl_setopt.rst
@@ -83,13 +83,13 @@ values of different types:
 
 It is possible to set integer options - and only them - that PycURL does
 not know about by using the numeric value of the option constant directly.
-For example, ``pycurl.VERBOSE`` has the value 42, and may be set as follows:
+For example, ``pycurl.VERBOSE`` has the value 42, and may be set as follows::
 
     c.setopt(42, 1)
 
 *setopt* can reset an option to its default value, performing the job of
 :py:meth:`pycurl.Curl.unsetopt`, if ``None`` is passed
-for the option value. The following two calls are equivalent:
+for the option value. The following two calls are equivalent::
 
     c.setopt(c.URL, None)
     c.unsetopt(c.URL)
diff --git a/doc/index.rst b/doc/index.rst
index 94334b0..bd92eb2 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -3,7 +3,7 @@
 
 The pycurl package is a Python interface to `libcurl`_.
 pycurl has been successfully built and
-tested with Python versions from 2.4 to 2.7 and 3.1 to 3.4.
+tested with Python versions 2.6, 2.7 and 3.1 to 3.5.
 
 libcurl is a client-side URL transfer library supporting FTP, FTPS, HTTP,
 HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. libcurl also supports HTTPS
diff --git a/doc/release-process.rst b/doc/release-process.rst
index 7c56b98..f0a4d08 100644
--- a/doc/release-process.rst
+++ b/doc/release-process.rst
@@ -4,30 +4,30 @@ Release Process
 1. Ensure changelog is up to date with commits in master.
 2. Run ``git shortlog REL_<previous release>...`` and add new contributors
    to AUTHORS.
-2. Run ``python setup.py manifest``, check that none of the listed files
+3. Run ``python setup.py manifest``, check that none of the listed files
    should be in MANIFEST.in.
-3. Check ``get_data_files()`` in ``setup.py`` to see if any new files should
+4. Check ``get_data_files()`` in ``setup.py`` to see if any new files should
    be included in binary distributions.
-4. Make sure travis is green for master.
-5. Update version numbers in:
+5. Make sure travis is green for master.
+6. Update version numbers in:
    - Changelog (also record release date)
    - doc/conf.py
    - setup.py
    - winbuild.py
    - www/htdocs/index.php (also update release date)
-6. Draft release notes, add to RELEASE-NOTES.rst.
-7. ``make gen docs``.
-8. ``python setup.py sdist``.
-9. Manually test install the built package.
-10. Build windows packages using winbuild.py.
-11. Add windows packages to downloads repo on github.
-12. Tag the new version.
-13. Register new version with pypi - ``python setup.py register``.
-14. Upload source distribution to pypi - ``python setup.py sdist upload``.
+7. Draft release notes, add to RELEASE-NOTES.rst.
+8. ``make gen docs``.
+9. ``python setup.py sdist``.
+10. Manually test install the built package.
+11. Build windows packages using winbuild.py.
+12. Add windows packages to downloads repo on github.
+13. Tag the new version.
+14. Register new version with pypi - ``python setup.py register``.
+15. Upload source distribution to pypi - ``python setup.py sdist upload``.
     This recreates the source distribution.
-15. Add the source distribution to downloads repo on github.
-16. Rsync downloads repo to sourceforge.
-17. Rsync build/www/htdocs to sourceforge.
-18. Push tag to github pycurl repo.
-19. Announce release on mailing list.
-20. Link to announcement from website.
+16. Add the source distribution to downloads repo on github.
+17. Rsync downloads repo to sourceforge.
+18. Rsync build/www/htdocs to sourceforge.
+19. Push tag to github pycurl repo.
+20. Announce release on mailing list.
+21. Link to announcement from website.
diff --git a/examples/ssh_keyfunction.py b/examples/ssh_keyfunction.py
new file mode 100644
index 0000000..93fcc77
--- /dev/null
+++ b/examples/ssh_keyfunction.py
@@ -0,0 +1,15 @@
+import pycurl
+
+sftp_server = 'sftp://web.sourceforge.net'
+
+c = pycurl.Curl()
+c.setopt(c.URL, sftp_server)
+c.setopt(c.VERBOSE, True)
+
+def keyfunction(known_key, found_key, match):
+    return c.KHSTAT_FINE
+
+c.setopt(c.SSH_KNOWNHOSTS, '.known_hosts')
+c.setopt(c.SSH_KEYFUNCTION, keyfunction)
+
+c.perform()
diff --git a/setup.py b/setup.py
index e16e6d6..0f14571 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@
 
 PACKAGE = "pycurl"
 PY_PACKAGE = "curl"
-VERSION = "7.19.5.3"
+VERSION = "7.21.5"
 
 import glob, os, re, sys, subprocess
 import distutils
@@ -191,6 +191,7 @@ class ExtensionConfiguration(object):
             else:
                 raise ConfigurationError('Invalid value "%s" for PYCURL_SSL_LIBRARY' % ssl_lib)
         ssl_options = {
+            '--with-openssl': self.using_openssl,
             '--with-ssl': self.using_openssl,
             '--with-gnutls': self.using_gnutls,
             '--with-nss': self.using_nss,
@@ -214,14 +215,14 @@ class ExtensionConfiguration(object):
                 self.library_dirs.append(arg[2:])
             else:
                 self.extra_link_args.append(arg)
-        
... 3617 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pycurl.git



More information about the Python-modules-commits mailing list