[Python-modules-commits] [pycurl] 01/06: Import pycurl_7.19.5.3.orig.tar.gz

Barry Warsaw barry at moszumanska.debian.org
Wed Nov 18 18:28:53 UTC 2015


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

barry pushed a commit to branch master
in repository pycurl.

commit 8d86b847e4851561d8c00456401cccbda6047f2c
Author: Barry Warsaw <barry at python.org>
Date:   Wed Nov 18 13:23:24 2015 -0500

    Import pycurl_7.19.5.3.orig.tar.gz
---
 AUTHORS                                            |   7 +-
 COPYING-MIT                                        |   2 +-
 ChangeLog                                          | 101 +++++-
 INSTALL.rst                                        |  36 ++
 MANIFEST.in                                        |   3 +
 Makefile                                           |  18 +-
 PKG-INFO                                           |   2 +-
 README.rst                                         |   2 +-
 RELEASE-NOTES.rst                                  |  26 ++
 doc/callbacks.rst                                  |  72 +++-
 doc/conf.py                                        |   6 +-
 doc/curlmultiobject.rst                            |   6 +
 doc/docstrings/curl_setopt.rst                     |   5 +-
 doc/docstrings/multi_assign.rst                    |   7 +
 doc/docstrings/multi_setopt.rst                    |  38 ++
 doc/docstrings/multi_socket_action.rst             |   5 +-
 doc/docstrings/multi_timeout.rst                   |   6 +
 doc/files.rst                                      |  42 +--
 doc/quickstart.rst                                 |  69 ++++
 doc/unicode.rst                                    |   9 +-
 examples/basicfirst.py                             |   7 +-
 examples/linksys.py                                |  14 +-
 examples/quickstart/file_upload_buffer.py          |  18 +
 examples/quickstart/file_upload_real.py            |  18 +
 examples/quickstart/file_upload_real_fancy.py      |  22 ++
 examples/retriever-multi.py                        |   1 -
 examples/retriever.py                              |   7 +-
 examples/sfquery.py                                |   2 +-
 examples/smtp.py                                   |   6 +
 examples/tests/test_gtk.py                         |   1 -
 examples/xmlrpc_curl.py                            |  12 +-
 python/curl/__init__.py                            |   1 -
 requirements-dev-2.4.txt                           |   1 +
 requirements-dev.txt => requirements-dev-3.1.txt   |   3 +
 requirements-dev.txt                               |   2 +
 setup.py                                           | 233 ++++++++----
 src/Makefile                                       |  19 -
 src/docstrings.c                                   |  66 +++-
 src/docstrings.h                                   |   3 +
 src/easy.c                                         | 109 ++++--
 src/module.c                                       |  97 +++--
 src/multi.c                                        |  10 +-
 src/oscompat.c                                     |  10 +-
 src/pycurl.h                                       |  31 +-
 src/pythoncompat.c                                 |  44 +++
 src/threadsupport.c                                |   4 +-
 tests/__init__.py                                  |   2 +
 tests/app.py                                       |  14 +-
 tests/curl_object_test.py                          |   4 +-
 tests/debug_test.py                                |  31 +-
 tests/ext/test-suite.sh                            |   2 +
 tests/fake-curl/libcurl/Makefile                   |  15 +
 tests/fake-curl/libcurl/with_gnutls.c              |  29 ++
 tests/fake-curl/libcurl/with_nss.c                 |  29 ++
 tests/fake-curl/libcurl/with_openssl.c             |  29 ++
 tests/fake-curl/libcurl/with_unknown_ssl.c         |  29 ++
 tests/fake-curl/libcurl/without_ssl.c              |  29 ++
 tests/ftp_test.py                                  |   8 +-
 tests/getinfo_test.py                              |   2 +
 tests/header_test.py                               |   7 +-
 tests/internals_test.py                            |   2 +-
 tests/matrix.py                                    |   2 +-
 tests/matrix/openssl-1.0.1e-fix_pod_syntax-1.patch | 393 +++++++++++++++++++++
 tests/memory_mgmt_test.py                          |  41 ++-
 tests/multi_memory_mgmt_test.py                    |   6 +-
 tests/multi_option_constants_test.py               |   7 +
 tests/multi_socket_select_test.py                  |   2 +-
 tests/multi_test.py                                |   4 +-
 tests/option_constants_test.py                     |  57 ++-
 tests/pause_test.py                                |   2 +
 tests/post_test.py                                 |  80 ++++-
 tests/procmgr.py                                   |   6 +-
 tests/pycurl_object_test.py                        |   9 +-
 tests/reload_test.py                               |   1 -
 tests/reset_test.py                                |  30 +-
 tests/run-quickstart.sh                            |  38 ++
 tests/run.sh                                       |  24 ++
 tests/seek_function_test.py                        |   6 +-
 tests/setopt_lifecycle_test.py                     |   1 -
 tests/setopt_unicode_test.py                       |   4 -
 tests/setup_test.py                                |  99 +++++-
 tests/share_test.py                                |   8 +-
 tests/socket_open_test.py                          |   4 -
 tests/util.py                                      |  39 +-
 tests/write_cb_bogus_test.py                       |   1 -
 winbuild.py                                        | 292 +++++++++++----
 86 files changed, 2196 insertions(+), 395 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index b27c1ba..63e75b8 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-2014 by Oleg Pudeyev <oleg at bsdpower.com>
+Copyright (C) 2013-2015 by Oleg Pudeyev <oleg at bsdpower.com>
 
 Please see README, COPYING-LGPL and COPYING-MIT for license information.
 
@@ -11,15 +11,20 @@ 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>
 Bastian Kleineidam
 Christopher Warner <cwarner at kernelcode.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>
 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>
 Gisle Vanem <gvanem at yahoo.no>
+Gregory Petukhov <lorien at lorien.name>
 Jakob Truelsen <jakob at scalgo.com>
 Jayne <corvine at gmail.com>
 JiCiT
diff --git a/COPYING-MIT b/COPYING-MIT
index bb06eea..cffe3d3 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-2014 by Oleg Pudeyev <oleg at bsdpower.com>
+Copyright (C) 2013-2015 by Oleg Pudeyev <oleg at bsdpower.com>
 
 All rights reserved.
 
diff --git a/ChangeLog b/ChangeLog
index 4cd24c0..efa07f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,96 @@
+Version 7.19.5.3 [requires libcurl-7.19.0 or better] - 2015-11-03
+-----------------------------------------------------------------
+
+        * python and nosetests binaries can now be overridden when running
+          the test suite (patch by Kamil Dudka).
+
+        * Files needed to run the test suite are distributed in sdist
+          (patch by Kamil Dudka).
+
+
+Version 7.19.5.2 [requires libcurl-7.19.0 or better] - 2015-11-02
+-----------------------------------------------------------------
+
+        * C sources made 64-bit clean on Windows.
+
+        * Support for building against Python 3.5 added to winbuild.py.
+
+        * Fixed build on Windows when using MS SDK 8.1+ or MSVC 14/2015
+          (patch by Gisle Vanem).
+
+        * Added automatic SSL library detection on CentOS 6 by loading
+          libcurl shared library in setup.py. This automatic detection is
+          meant to permit installing pycurl seamlessly via `pip install pycurl`
+          on CentOS; as such, it is only employed when no other configuration
+          options or configuration environment variables are given to setup.py
+          (original patch by Francisco Alves).
+
+        * Added --libcurl-dll option to setup.py to take SSL library
+          information out of libcurl shared library (original patch by
+          Francisco Alves). This option is only usable
+          with Python 2.5 or higher.
+
+        * --with-ssl, --with-gnutls and --with-nss options to setup.py now
+          result in PycURL explicitly linking against the respective SSL
+          library. Previously setup.py relied on curl-config to supply the
+          needed libraries in this case.
+
+        * List and tuples are now accepted in all positions of HTTPPOST
+          option values.
+
+        * Tuples are now accepted for options taking list values (e.g.
+          HTTPHEADER).
+
+        * Fixed a use after free in HTTPPOST when using FORM_BUFFERPTR with
+          a Unicode string (patch by Clint Clayton).
+
+        * Fixed a memory leak in HTTPPOST for multiple FORM_BUFFERPTR
+          (patch by Clint Clayton).
+
+        * CURLMOPT_* option constants were mistakenly defined on Curl
+          instances but not on CurlMulti instances. These option constants
+          are now defined on CurlMulti instances and on pycurl module,
+          but not on Curl instances.
+
+        * Fixed several memory leaks when setting string options to
+          Unicode values failed.
+
+        * Fixed a memory leak when using POSTFIELDS with unicode objects
+          on Python 2 (patch by Clint Clayton).
+
+        * Official support for Python 2.4 and 2.5 dropped. PycURL is no
+          longer tested against these Python versions on Travis.
+
+        * Added CURLAUTH_NEGOTIATE (libcurl 7.38.0+), CURLAUTH_NTLM_WB
+          (libcurl 7.22.0+), CURLAUTH_ONLY (libcurl 7.21.3+),
+
+        * Added CURLOPT_SERVICE_NAME (libcurl 7.43.0+).
+
+        * Added CURLOPT_PROXY_SERVICE_NAME (libcurl 7.43.0+).
+
+        * Added CURLE_SSL_CRL_BADFILE, CURLE_SSL_INVALIDCERTSTATUS
+          (libcurl 7.41.0+), CURLE_SSL_ISSUER_ERROR and
+          CURLE_SSL_PINNEDPUBKEYNOTMATCH (libcurl 7.39.0+).
+
+        * Added CURLOPT_SSL_VERIFYSTATUS (libcurl 7.41.0+).
+
+        * Added CURL_SSLVERSION_TLSv1_0, CURL_SSLVERSION_TLSv1_1
+          and CURL_SSLVERSION_TLSv1_2 (libcurl 7.34.0+).
+
+        * The second argument of DEBUGFUNCTION callback is now of type bytes on
+          Python 3. When response body contains non-ASCII data and
+          DEBUGFUNCTION is enabled, this argument would receive non-ASCII data.
+          Which encoding this data is in is unknown by PycURL, and e.g. in
+          the case of HTTP requires parsing response headers. GitHub issue
+          #210, patch by Barry Warsaw with help from Gregory Petukhov.
+
+        * Fixed build on GCC 4.4.5 (patch by Travis Jensen).
+
+        * Added CURLOPT_GSSAPI_DELEGATION, CURLGSSAPI_DELEGATION_FLAG,
+          CURLGSSAPI_DELEGATION_NONE and CURLGSSAPI_DELEGATION_POLICY_FLAG
+          (libcurl 7.22.0+, patch by Dmitry Ketov).
+
+
 Version 7.19.5.1 [requires libcurl-7.19.0 or better] - 2015-01-06
 -----------------------------------------------------------------
 
@@ -5,7 +98,7 @@ Version 7.19.5.1 [requires libcurl-7.19.0 or better] - 2015-01-06
 
         * setup.py now prints PycURL-specific option help when -h is used.
 
-        * LibreSSL is now supported (patch by JiCiT.)
+        * LibreSSL is now supported (patch by JiCiT).
 
         * Fixed an oversight that broke PycURL building against libcurl 7.19.4
           through 7.21.1. The bug was introduced in PycURL 7.19.5.
@@ -16,6 +109,7 @@ Version 7.19.5.1 [requires libcurl-7.19.0 or better] - 2015-01-06
         * Added CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT (libcurl 7.20.0+)
           and CURLOPT_MAIL_AUTH (libcurl 7.25.0+).
 
+
 Version 7.19.5 [requires libcurl-7.21.2 or better] - 2014-07-12
 ---------------------------------------------------------------
 
@@ -77,6 +171,7 @@ Version 7.19.5 [requires libcurl-7.21.2 or better] - 2014-07-12
 
         * Documentation is now processed by sphinx.
 
+
 Version 7.19.3.1 [requires libcurl-7.19.0 or better] - 2014-02-05
 -----------------------------------------------------------------
 
@@ -93,6 +188,7 @@ Version 7.19.3.1 [requires libcurl-7.19.0 or better] - 2014-02-05
           pre-7.19.3 behavior with respect to automatic SSL detection
           (patch by Andjelko Horvat).
 
+
 Version 7.19.3 [requires libcurl-7.19.0 or better] - 2014-01-09
 ---------------------------------------------------------------
 
@@ -184,6 +280,7 @@ Version 7.19.3 [requires libcurl-7.19.0 or better] - 2014-01-09
           be modified to accept this new argument.
           https://github.com/pycurl/pycurl/pull/18
 
+
 Version 7.19.0.3 [requires libcurl-7.19.0 or better] - 2013-12-24
 -----------------------------------------------------------------
 
@@ -191,6 +288,7 @@ Version 7.19.0.3 [requires libcurl-7.19.0 or better] - 2013-12-24
           due to botched 7.19.0.2 files on PyPi.
           http://curl.haxx.se/mail/curlpython-2013-12/0021.html
 
+
 Version 7.19.0.2 [requires libcurl-7.19.0 or better] - 2013-10-08
 -----------------------------------------------------------------
 
@@ -203,6 +301,7 @@ Version 7.19.0.2 [requires libcurl-7.19.0 or better] - 2013-10-08
           via curl_easy_pause call and returning READFUNC_PAUSE from
           read callback function.
 
+
 Version 7.19.0.1 [requires libcurl-7.19.0 or better] - 2013-09-23
 -----------------------------------------------------------------
 
diff --git a/INSTALL.rst b/INSTALL.rst
index 72190ba..7581f10 100644
--- a/INSTALL.rst
+++ b/INSTALL.rst
@@ -32,6 +32,10 @@ LD_LIBRARY_PATH environment variable accordingly.  This normally
 applies only if there is more than one version of libcurl installed,
 e.g. one in /usr/lib and one in /usr/local/lib.
 
+
+SSL
+^^^
+
 PycURL requires that the SSL library that it is built against is the same
 one libcurl, and therefore PycURL, uses at runtime. PycURL's ``setup.py``
 uses ``curl-config`` to attempt to figure out which SSL library libcurl
@@ -49,6 +53,14 @@ To fix this, you need to tell ``setup.py`` what SSL backend is used::
 
     python setup.py --with-[ssl|gnutls|nss] install
 
+You can also ask ``setup.py`` to obtain SSL backend information from installed
+libcurl shared library, as follows:
+
+    python setup.py --libcurl-dll=libcurl.so
+
+An unqualified ``libcurl.so`` would use the system libcurl, or you can
+specify a full path.
+
 
 easy_install / pip
 ------------------
@@ -75,6 +87,30 @@ argument is --with-ssl, to match libcurl, but the environment variable value is
 "openssl".
 
 
+pip and cached pycurl package
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you have already installed pycurl and are trying to reinstall it via
+pip with different SSL options for example, pip may reinstall the package it
+has previously compiled instead of recompiling pycurl with newly specified
+options. More details are given in `this Stack Overflow post`_.
+
+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
 -------
 
diff --git a/MANIFEST.in b/MANIFEST.in
index 97730e6..4a8e1c6 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -38,7 +38,10 @@ include tests/certs/*.crt
 include tests/certs/*.key
 include tests/ext/*.sh
 include tests/fake-curl/*
+include tests/fake-curl/libcurl/*
 include tests/fixtures/form_submission.txt
 include tests/matrix/*.patch
+include tests/run.sh
+include tests/run-quickstart.sh
 include tests/vsftpd.conf
 include winbuild.py
diff --git a/Makefile b/Makefile
index 99120e7..c7f2370 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,8 @@ RSYNC_FILES = \
 
 RSYNC_EXCLUDES = \
 	'--exclude=htdocs/download/' \
-	'--exclude=upload/Ignore/'
+	'--exclude=upload/Ignore/' \
+	'--exclude=htdocs/travis-deps/'
 
 RSYNC_TARGET = /home/groups/p/py/pycurl/
 
@@ -91,15 +92,10 @@ build-release: $(RELEASE_SOURCES)
 	PYCURL_RELEASE=1 $(PYTHON) setup.py build
 
 do-test:
-	mkdir -p tests/tmp
-	PYTHONSUFFIX=$$(python -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \
-	PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \
-	$(PYTHON) -c 'import pycurl; print(pycurl.version)'
-	PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \
-	$(NOSETESTS) -a '!standalone'
-	PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \
-	$(NOSETESTS) -a standalone
+	cd tests/fake-curl/libcurl && make
+	./tests/run.sh
 	./tests/ext/test-suite.sh
+	pyflakes python examples tests setup.py winbuild.py
 
 test: build do-test
 test-release: build-release do-test
@@ -124,7 +120,6 @@ clean:
 	-rm -f *.pyc *.pyo */*.pyc */*.pyo */*/*.pyc */*/*.pyo
 	-rm -f MANIFEST
 	-rm -f src/allpycurl.c $(GEN_SOURCES)
-	cd src && $(MAKE) clean
 
 distclean: clean
 
@@ -133,6 +128,9 @@ maintainer-clean: distclean
 dist sdist: distclean
 	$(PYTHON) setup.py sdist
 
+run-quickstart:
+	./tests/run-quickstart.sh
+
 # Rebuild missing or changed documentation.
 # Editing docstrings in Python or C source will not cause the documentation
 # to be rebuilt with this target, use docs-force instead.
diff --git a/PKG-INFO b/PKG-INFO
index 3998554..1c87624 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pycurl
-Version: 7.19.5.1
+Version: 7.19.5.3
 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 c8eed16..6a9a596 100644
--- a/README.rst
+++ b/README.rst
@@ -170,7 +170,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-2014 by Oleg Pudeyev <oleg at bsdpower.com>
+    Copyright (C) 2013-2015 by Oleg Pudeyev <oleg at bsdpower.com>
 
     All rights reserved.
 
diff --git a/RELEASE-NOTES.rst b/RELEASE-NOTES.rst
index 3027e95..b08ec6c 100644
--- a/RELEASE-NOTES.rst
+++ b/RELEASE-NOTES.rst
@@ -1,6 +1,32 @@
 Release Notes
 =============
 
+PycURL 7.19.5.3 - 2015-11-04
+----------------------------
+
+PycURL 7.19.5.2 release did not include some of the test suite files in
+its manifest, leading to inability to run the test suite from the sdist
+tarball. This is now fixed thanks to Kamil Dudka.
+
+
+PycURL 7.19.5.2 - 2015-11-02
+----------------------------
+
+Breaking change: DEBUGFUNCTION now takes bytes rather than (Unicode) string
+as its argument on Python 3.
+
+Breaking change: CURLMOPT_* option constants moved from Easy to Multi
+class. They remain available in pycurl module.
+
+SSL library detection improved again, --libcurl-dll option to setup.py added.
+
+Options that required tuples now also accept lists, and vice versa.
+
+This release fixes several memory leaks and one use after free issue.
+
+Support for several new libcurl options and constants has been added.
+
+
 PycURL 7.19.5.1 - 2015-01-06
 ----------------------------
 
diff --git a/doc/callbacks.rst b/doc/callbacks.rst
index f203541..f72f636 100644
--- a/doc/callbacks.rst
+++ b/doc/callbacks.rst
@@ -25,30 +25,72 @@ callbacks.
 
 The signature of each callback used in pycurl is as follows:
 
-.. function:: WRITEFUNCTION(string) -> number of characters written
+.. function:: HEADERFUNCTION(byte string) -> number of characters written
 
-    The ``WRITEFUNCTION`` callback may also return
-    ``None``, which is an alternate way of indicating that the callback has
-    consumed all of the string passed to it.
+    Callback for writing received headers. Corresponds to
+    `CURLOPT_HEADERFUNCTION`_ in libcurl.
+    
+    On Python 3, the argument is of type ``bytes``.
 
-.. function:: READFUNCTION(number of characters to read) -> string
+    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.
+
+.. 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 ``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:: 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.
 
     In addition, ``READFUNCTION`` may return ``READFUNC_ABORT`` or
     ``READFUNC_PAUSE``. See the libcurl documentation for an explanation
     of these values.
 
-.. function:: HEADERFUNCTION(string) -> number of characters written
+.. function:: PROGRESSFUNCTION(download total, downloaded, upload total, uploaded) -> status
+
+    Callback for progress meter. Corresponds to `CURLOPT_PROGRESSFUNCTION`_
+    in libcurl.
 
-    The ``HEADERFUNCTION`` callback may also return
-    ``None``, which is an alternate way of indicating that the callback has
-    consumed all of the string passed to it.
+.. function:: DEBUGFUNCTION(debug message type, debug message byte string) -> None
 
-.. function:: PROGRESSFUNCTION(download total, downloaded, upload total, uploaded) -> status
+    Callback for debug information. Corresponds to `CURLOPT_DEBUGFUNCTION`_
+    in libcurl.
+
+    *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:
 
-.. function:: DEBUGFUNCTION(debug message type, debug message string) -> None
+.. function:: SEEKFUNCTION(offset, origin) -> status
+
+    Callback for seek operations. Corresponds to `CURLOPT_SEEKFUNCTION`_
+    in libcurl.
 
 .. 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
 -----------------------------------------------
 
@@ -127,3 +169,11 @@ 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
+.. _CURLOPT_READFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_READFUNCTION.html
+.. _CURLOPT_PROGRESSFUNCTION: http://curl.haxx.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html
+.. _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
diff --git a/doc/conf.py b/doc/conf.py
index a6b8d22..8415174 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-2014 Kjetil Jacobsen, Markus F.X.J. Oberhumer, Oleg Pudeyev'
+copyright = u'2001-2015 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.1'
+version = '7.19.5.3'
 # The full version, including alpha/beta/rc tags.
-release = '7.19.5.1'
+release = '7.19.5.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/curlmultiobject.rst b/doc/curlmultiobject.rst
index 3920771..d33b798 100644
--- a/doc/curlmultiobject.rst
+++ b/doc/curlmultiobject.rst
@@ -15,8 +15,14 @@ CurlMulti Object
 
     .. automethod:: pycurl.CurlMulti.perform
 
+    .. automethod:: pycurl.CurlMulti.setopt
+
     .. automethod:: pycurl.CurlMulti.fdset
 
     .. automethod:: pycurl.CurlMulti.select
 
     .. automethod:: pycurl.CurlMulti.info_read
+
+    .. automethod:: pycurl.CurlMulti.timeout
+
+    .. automethod:: pycurl.CurlMulti.assign
diff --git a/doc/docstrings/curl_setopt.rst b/doc/docstrings/curl_setopt.rst
index fc8a046..7808afb 100644
--- a/doc/docstrings/curl_setopt.rst
+++ b/doc/docstrings/curl_setopt.rst
@@ -43,10 +43,11 @@ values of different types:
     c.setopt(pycurl.URL, b"http://www.python.org/")
 
 - ``HTTP200ALIASES``, ``HTTPHEADER``, ``POSTQUOTE``, ``PREQUOTE`` and
-  ``QUOTE`` accept a list of strings. The same rules apply to the strings
-  as do to string option values. Example::
+  ``QUOTE`` accept a list or tuple of strings. The same rules apply to these
+  strings as do to string option values. Example::
 
     c.setopt(pycurl.HTTPHEADER, ["Accept:"])
+    c.setopt(pycurl.HTTPHEADER, ("Accept:",))
 
 - ``READDATA`` accepts a file object or any Python object which has
   a ``read`` method. On Python 2, a file object will be passed directly
diff --git a/doc/docstrings/multi_assign.rst b/doc/docstrings/multi_assign.rst
new file mode 100644
index 0000000..5d60cb4
--- /dev/null
+++ b/doc/docstrings/multi_assign.rst
@@ -0,0 +1,7 @@
+assign(sockfd, object) -> None
+
+Creates an association in the multi handle between the given socket and
+a private object in the application.
+Corresponds to `curl_multi_assign`_ in libcurl.
+
+.. _curl_multi_assign: http://curl.haxx.se/libcurl/c/curl_multi_assign.html
diff --git a/doc/docstrings/multi_setopt.rst b/doc/docstrings/multi_setopt.rst
new file mode 100644
index 0000000..a19a711
--- /dev/null
+++ b/doc/docstrings/multi_setopt.rst
@@ -0,0 +1,38 @@
+setopt(option, value) -> None
+
+Set curl multi option. Corresponds to `curl_multi_setopt`_ in libcurl.
+
+*option* specifies which option to set. PycURL defines constants
+corresponding to ``CURLMOPT_*`` constants in libcurl, except that
+the ``CURLMOPT_`` prefix is replaced with ``M_`` prefix.
+For example, ``CURLMOPT_PIPELINING`` is
+exposed in PycURL as ``pycurl.M_PIPELINING``. For convenience, ``CURLMOPT_*``
+constants are also exposed on CurlMulti objects::
+
+    import pycurl
+    m = pycurl.CurlMulti()
+    m.setopt(pycurl.M_PIPELINING, 1)
+    # Same as:
+    m.setopt(m.M_PIPELINING, 1)
+
+*value* specifies the value to set the option to. Different options accept
+values of different types:
+
+- Options specified by `curl_multi_setopt`_ as accepting ``1`` or an
+  integer value accept Python integers, long integers (on Python 2.x) and
+  booleans::
+
+    m.setopt(pycurl.M_PIPELINING, True)
+    m.setopt(pycurl.M_PIPELINING, 1)
+    # Python 2.x only:
+    m.setopt(pycurl.M_PIPELINING, 1L)
+
+- ``*FUNCTION`` options accept a function. Supported callbacks are
+  ``CURLMOPT_SOCKETFUNCTION`` AND ``CURLMOPT_TIMERFUNCTION``. Please refer to
+  the PycURL test suite for examples on using the callbacks.
+
+Raises TypeError when the option value is not of a type accepted by the
+respective option, and pycurl.error exception when libcurl rejects the
+option or its value.
+
+.. _curl_multi_setopt: http://curl.haxx.se/libcurl/c/curl_multi_setopt.html
diff --git a/doc/docstrings/multi_socket_action.rst b/doc/docstrings/multi_socket_action.rst
index 4fd38ad..8d475dd 100644
--- a/doc/docstrings/multi_socket_action.rst
+++ b/doc/docstrings/multi_socket_action.rst
@@ -1,4 +1,7 @@
-socket_action(sockfd, ev_bitmask) -> Tuple.
+socket_action(sockfd, ev_bitmask) -> tuple
 
 Returns result from doing a socket_action() on the curl multi file descriptor
 with the given timeout.
+Corresponds to `curl_multi_socket_action`_ in libcurl.
+
+.. _curl_multi_socket_action: http://curl.haxx.se/libcurl/c/curl_multi_socket_action.html
diff --git a/doc/docstrings/multi_timeout.rst b/doc/docstrings/multi_timeout.rst
new file mode 100644
index 0000000..f4b321d
--- /dev/null
+++ b/doc/docstrings/multi_timeout.rst
@@ -0,0 +1,6 @@
+timeout() -> int
+
+Returns how long to wait for action before proceeding.
+Corresponds to `curl_multi_timeout`_ in libcurl.
+
+.. _curl_multi_timeout: http://curl.haxx.se/libcurl/c/curl_multi_timeout.html
diff --git a/doc/files.rst b/doc/files.rst
index 8585a51..5bc0b08 100644
--- a/doc/files.rst
+++ b/doc/files.rst
@@ -1,29 +1,31 @@
 File Handling
 =============
 
-In PycURL 7.19.0.3 and below, CURLOPT_READDATA, CURLOPT_WRITEDATA and
-CURLOPT_WRITEHEADER options accepted file objects and directly passed
-the underlying C library FILE pointers to libcurl.
+In PycURL 7.19.0.3 and below, ``CURLOPT_READDATA``, ``CURLOPT_WRITEDATA`` and
+``CURLOPT_WRITEHEADER`` options accepted file objects and directly passed
+the underlying C library ``FILE`` pointers to libcurl.
 
-Python 3 no longer implements files as C library FILE objects.
+Python 3 no longer implements files as C library ``FILE`` objects.
 In PycURL 7.19.3 and above, when running on Python 3, these options
-are implemented as calls to CURLOPT_READFUNCTION, CURLOPT_WRITEFUNCTION
-and CURLOPT_HEADERFUNCTION, respectively, with the write method of the
+are implemented as calls to ``CURLOPT_READFUNCTION``, ``CURLOPT_WRITEFUNCTION``
+and ``CURLOPT_HEADERFUNCTION``, respectively, with the write method of the
 Python file object as the parameter. As a result, any Python file-like
-object implementing a write method can be passed to CURLOPT_READDATA,
-CURLOPT_WRITEDATA or CURLOPT_WRITEHEADER options.
+object implementing a ``read`` method can be passed to ``CURLOPT_READDATA``,
+and any Python file-like object implementing a ``write`` method can be
+passed to ``CURLOPT_WRITEDATA`` or ``CURLOPT_WRITEHEADER`` options.
 
 When running PycURL 7.19.3 and above on Python 2, the old behavior of
-passing FILE pointers to libcurl remains when a true file object is given
-to CURLOPT_READDATA, CURLOPT_WRITEDATA and CURLOPT_WRITEHEADER options.
-For consistency with Python 3 behavior these options also accept file-like
-objects implementing a write method as arguments, in which case the
-Python 3 code path is used converting these options to CURLOPT_*FUNCTION
-option calls.
+passing ``FILE`` pointers to libcurl remains when a true file object is given
+to ``CURLOPT_READDATA``, ``CURLOPT_WRITEDATA`` and ``CURLOPT_WRITEHEADER``
+options. For consistency with Python 3 behavior these options also accept
+file-like objects implementing a ``read`` or ``write`` method, as appropriate,
+as arguments, in which case the Python 3 code path is used converting these
+options to ``CURLOPT_*FUNCTION`` option calls.
 
-Files given to PycURL as arguments to CURLOPT_READDATA, CURLOPT_WRITEDATA or
-CURLOPT_WRITEHEADER must be opened for writing in binary mode. Files opened
-in text mode (without "b" flag to open()) expect string objects and writing
-to them from PycURL will fail. Similarly when passing f.write method of
-an open file to CURLOPT_WRITEFUNCTION or CURLOPT_HEADERFUNCTION, or f.read
-to CURLOPT_READFUNCTION, the file must have been be opened in binary mode.
+Files given to PycURL as arguments to ``CURLOPT_READDATA``,
+``CURLOPT_WRITEDATA`` or ``CURLOPT_WRITEHEADER`` must be opened for reading or
+writing in binary mode. Files opened in text mode (without ``"b"`` flag to
+``open()``) expect string objects and reading from or writing to them from
+PycURL will fail. Similarly when passing ``f.write`` method of an open file to
+``CURLOPT_WRITEFUNCTION`` or ``CURLOPT_HEADERFUNCTION``, or ``f.read`` to
+``CURLOPT_READFUNCTION``, the file must have been be opened in binary mode.
diff --git a/doc/quickstart.rst b/doc/quickstart.rst
index 78ff1b1..b2b5624 100644
--- a/doc/quickstart.rst
+++ b/doc/quickstart.rst
@@ -277,3 +277,72 @@ This code is available as ``examples/quickstart/form_post.py``.
 methods can be specified via ``CUSTOMREQUEST`` option::
 
     c.setopt(c.CUSTOMREQUEST, 'PATCH')
+
+File Upload
+-----------
+
+To upload a file, use ``HTTPPOST`` option. To upload a physical file,
+use ``FORM_FILE`` as follows::
+
+    import pycurl
+
+    c = pycurl.Curl()
+    c.setopt(c.URL, 'http://pycurl.sourceforge.net/tests/testfileupload.php')
+
+    c.setopt(c.HTTPPOST, [
+        ('fileupload', (
+            # upload the contents of this file
+            c.FORM_FILE, __file__,
+        )),
+    ])
+
+    c.perform()
+    c.close()
+
+This code is available as ``examples/quickstart/file_upload_real.py``.
+
+``libcurl`` provides a number of options to tweak file uploads and multipart
+form submissions in general. These are documented on `curl_formadd page`_.
+For example, to set a different filename and content type::
+
+    import pycurl
+
+    c = pycurl.Curl()
+    c.setopt(c.URL, 'http://pycurl.sourceforge.net/tests/testfileupload.php')
+
+    c.setopt(c.HTTPPOST, [
+        ('fileupload', (
+            # upload the contents of this file
+            c.FORM_FILE, __file__,
+            # specify a different file name for the upload
+            c.FORM_FILENAME, 'helloworld.py',
+            # specify a different content type
+            c.FORM_CONTENTTYPE, 'application/x-python',
+        )),
+    ])
+
+    c.perform()
+    c.close()
+
+This code is available as ``examples/quickstart/file_upload_real_fancy.py``.
+
+If the file data is in memory, use ``BUFFER``/``BUFFERPTR`` as follows::
+
+    import pycurl
+
+    c = pycurl.Curl()
+    c.setopt(c.URL, 'http://pycurl.sourceforge.net/tests/testfileupload.php')
+
+    c.setopt(c.HTTPPOST, [
+        ('fileupload', (
+            c.FORM_BUFFER, 'readme.txt',
+            c.FORM_BUFFERPTR, 'This is a fancy readme file',
+        )),
+    ])
+
+    c.perform()
+    c.close()
+
+This code is available as ``examples/quickstart/file_upload_buffer.py``.
+
+.. _curl_formadd page: http://curl.haxx.se/libcurl/c/curl_formadd.html
diff --git a/doc/unicode.rst b/doc/unicode.rst
index cbb6073..c57775c 100644
--- a/doc/unicode.rst
+++ b/doc/unicode.rst
@@ -21,6 +21,13 @@ Specifically:
   contain ASCII code points only [#ascii]_, and transparently encode these to
   byte strings.
 
+Why doesn't PycURL automatically encode and decode, say, HTTP request or
+response data? The key to remember is that libcurl supports over 20 protocols,
+and PycURL generally has no knowledge of what protocol is being used by
+a particular request as PycURL does not track application state. Having
+to manually encode and decode data is unfortunately the price of libcurl's
+flexibility.
+
 
 Setting Options - Python 2.x
 ----------------------------
@@ -222,7 +229,7 @@ How PycURL Handles Unicode Strings
 ----------------------------------
 
 If PycURL is given a Unicode string which contains non-ASCII code points,
-and as such cannot be encoded to ASCII,PycURL will return an error to libcurl,
+and as such cannot be encoded to ASCII, PycURL will return an error to libcurl,
 and libcurl in turn will fail the request with an error like
 "read function error/data error". PycURL will then raise ``pycurl.error``
 with this latter message. The encoding exception that was the
diff --git a/examples/basicfirst.py b/examples/basicfirst.py
index 6eacd45..a9d2983 100644
--- a/examples/basicfirst.py
+++ b/examples/basicfirst.py
@@ -1,17 +1,22 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 # vi:ts=4:et
-
 import sys
 import pycurl
 
+PY3 = sys.version_info[0] > 2
+
+
 class Test:
     def __init__(self):
         self.contents = ''
+        if PY3:
+            self.contents = self.contents.encode('ascii')
 
     def body_callback(self, buf):
         self.contents = self.contents + buf
 
+
 sys.stderr.write("Testing %s\n" % pycurl.version)
 
 t = Test()
diff --git a/examples/linksys.py b/examples/linksys.py
index 3c6f837..116e8ed 100644
--- a/examples/linksys.py
+++ b/examples/linksys.py
@@ -32,7 +32,7 @@
 #
 # By Eric S. Raymond, August April 2003.  All rites reversed.
 
-import sys, re, copy, curl, exceptions
+import sys, re, curl, exceptions
 
 def print_stderr(arg):
     sys.stderr.write(arg)
@@ -99,7 +99,7 @@ class LinksysSession:
         return result
     def get_MAC_address(self, page, prefix):
         return self.screen_scrape("", prefix+r":[^M]*\(MAC Address: *([^)]*)")
-    def set_flag(page, flag, value):
+    def set_flag(self, page, flag, value):
         if value:
             self.actions.append(page, flag, "1")
         else:
@@ -107,7 +107,7 @@ class LinksysSession:
     def set_IP_address(self, page, cgi, role, ip):
         ind = 0
         for octet in ip.split("."):
-            self.actions.append(("", "F1", role + `ind+1`, octet))
+            self.actions.append(("", "F1", role + repr(ind+1), octet))
             ind += 1
 
     # Scrape configuration data off the main page
@@ -227,7 +227,6 @@ if __name__ == "__main__":
             cmd.Cmd.__init__(self)
             self.session = LinksysSession()
             if os.isatty(0):
-                import readline
                 print("Type ? or `help' for help.")
                 self.prompt = self.session.host + ": "
             else:
@@ -533,7 +532,7 @@ requests should be forwarded to.
 Some ISPs may require you to set host and domain for use with dynamic-address
 allocation.""")
 
-        def help_wireless(self):
+        def help_wireless_desc(self):
             print("""\
 The channel, ssid, ssid_broadcast, wep, and wireless commands control
 wireless routing.""")
@@ -559,8 +558,9 @@ wireless routing.""")
         try:
             interpreter.cmdloop()
             fatal = True
-        except LinksysError, (message, fatal):
-            print "linksys:", message
+        except LinksysError:
+            message, fatal = sys.exc_info()[1].args
+            print("linksys: " + message)
 
 # The following sets edit modes for GNU EMACS
 # Local Variables:
diff --git a/examples/quickstart/file_upload_buffer.py b/examples/quickstart/file_upload_buffer.py
new file mode 100644
index 0000000..0d6e991
--- /dev/null
+++ b/examples/quickstart/file_upload_buffer.py
@@ -0,0 +1,18 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+# vi:ts=4:et
+
+import pycurl
+
+c = pycurl.Curl()
+c.setopt(c.URL, 'http://pycurl.sourceforge.net/tests/testfileupload.php')
+
+c.setopt(c.HTTPPOST, [
+    ('fileupload', (
+        c.FORM_BUFFER, 'readme.txt',
+        c.FORM_BUFFERPTR, 'This is a fancy readme file',
+    )),
+])
+
... 3662 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