Projects
openEuler:Mainline
python-pycurl
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:python-pycurl.spec
Changed
@@ -6,14 +6,16 @@ %global srcname pycurl Name: python-%{srcname} -Version: 7.44.1 -Release: 1 +Version: 7.45.2 +Release: 2 Summary: A Python interface to libcurl -License: LGPLv2+ or MIT +License: LGPL-2.0+ or MIT URL: http://pycurl.sourceforge.net/ Source0: %{pypi_source} # drop link-time vs. run-time TLS backend check (#1446850) +Patch1: 0002-python-pycurl-7.45.2-disable-test_http_version_3.patch + BuildRequires: gcc libcurl-devel openssl-devel vsftpd %description @@ -97,6 +99,18 @@ %{python3_sitearch}/pycurl-%{version}-*.egg-info %changelog +* Tue Mar 21 2023 zhuofeng <zhuofeng2@huawei.com> - 7.45.2-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:temporarily disable test_http_version_3 + +* Thu Jan 19 2023 chendonghui6 <chendonghui6@huawei.com> - 7.45.2-1 +- update version to 7.45.2 + +* Fri Aug 05 2022 yanglongkang <yanglongkang@h-partners.com> - 7.44.1-2 +- Add release for rebuild + * Wed Dec 29 2021 guozhaorui <guozhaorui1@huawei.com> - 7.44.1-1 - update version to 7.44.1 @@ -112,7 +126,7 @@ - SUG:NA - DESC:fix compile error -* Thu Aug 4 2020 shixuantong <shixuantong@huawei.com> - 7.43.0.5-1 +* Tue Aug 4 2020 shixuantong <shixuantong@huawei.com> - 7.43.0.5-1 - update to 7.43.0.5 * Fri Oct 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 7.43.0.2-6
View file
_service:tar_scm:0002-python-pycurl-7.45.2-disable-test_http_version_3.patch
Added
@@ -0,0 +1,29 @@ +From 6c55e6822a064edb8dd6dfe1ee21080f4f30b5cf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com> +Date: Tue, 7 Mar 2023 16:32:19 +0100 +Subject: PATCH tests: temporarily disable test_http_version_3 + +HTTP3 support in curl is only experimental at the moment and is disabled +in the corresponding Fedora package. +--- + tests/option_constants_test.py | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/tests/option_constants_test.py b/tests/option_constants_test.py +index 7b94164..04dc3da 100644 +--- a/tests/option_constants_test.py ++++ b/tests/option_constants_test.py +@@ -508,10 +508,6 @@ class OptionConstantsSettingTest(unittest.TestCase): + def test_http_version_2prior_knowledge(self): + self.curl.setopt(self.curl.HTTP_VERSION, self.curl.CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) + +- @util.min_libcurl(7, 66, 0) +- def test_http_version_3(self): +- self.curl.setopt(self.curl.HTTP_VERSION, self.curl.CURL_HTTP_VERSION_3) +- + @util.min_libcurl(7, 21, 5) + def test_sockopt_constants(self): + assert self.curl.SOCKOPT_OK is not None +-- +2.39.2 +
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/python-pycurl.git</param> - <param name="revision">28468d7d700b1d30583d53bbf0e2bbca5e88706b</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/AUTHORS -> _service:tar_scm:pycurl-7.45.2.tar.gz/AUTHORS
Changed
@@ -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-2021 by Oleg Pudeyev <oleg at bsdpower.com> +Copyright (C) 2013-2022 by Oleg Pudeyev <code at olegp.name> Please see README, COPYING-LGPL and COPYING-MIT for license information. @@ -9,43 +9,60 @@ Aaron Hill <visine19 at hotmail.com> Adam Guthrie <therigu at users.sourceforge.net> Adam Jacob Muller <adam at isprime.com> +Akiomi Kamakura <akiomik at gmail.com> +Alexandre Pion <pion at afnic.fr> +Amir Rossert <amir.rossert at safebreach.com> Amit Mongia <amit_mongia at hotmail.com> Andjelko Horvat <comel at vingd.com> Arshad Khan <khan.m.arshad at gmail.com> +Artur Sobierak <asobierak at gmail.com> +Ashley Whetter <ashleyw at activestate.com> Barry Warsaw <barry at python.org> Bastian Kleineidam Benjamin Peterson <benjamin at python.org> +Bill Collins <bill.collins at hp.com> +Bo Anderson <mail at boanderson.me> Casey Miller <camiller at linkedin.com> +Chih-Hsuan Yen <yan12125 at gmail.com> +Christian Clauss <cclauss at me.com> 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> Daniel Stenberg <daniel at haxx.se> decitre <decitre at gmail.com> +Dima Tisnek <dimaqq at gmail.com> Dmitriy Taychenachev <dmitriy.taychenachev at skypicker.com> Dmitry Ketov <dketov at gmail.com> Domenico Andreoli <cavok at libero.it> Dominique <curl-and-python at d242.net> +Eneas U de Queiroz <cotequeiroz at gmail.com> Eric S. Raymond <esr at thyrsus.com> +Felix Yan <felixonmars at archlinux.org> Francisco Alves <chico at corp.globo.com> Gabi Davar <grizzly.nyo at gmail.com> Gisle Vanem <gvanem at yahoo.no> Gregory Petukhov <lorien at lorien.name> +Hasan <aliyevH at hotmail.com> Hugo <hugovk at users.noreply.github.com> Iain R. Learmonth <irl at fsfe.org> ideal <idealities at gmail.com> Jakob Truelsen <jakob at scalgo.com> Jakub Wilk <jwilk at jwilk.net> +James Deucker <bitwisecook at users.noreply.github.com> Jan Kryl <jan.kryl at nexenta.com> Jayne <corvine at gmail.com> James Deucker <bitwisecook at users.noreply.github.com> JiCiT <jason at infinitebubble.com> Jim Patterson +Josef Schlehofer <pepe.schlehofer at gmail.com> Jozef Melicher <jozef.melicher at eset.sk> K.S.Sreeram <sreeram at tachyontech.net> Kamil Dudka <kdudka at redhat.com> Kevin Ko <kevin.s.ko at gmail.com> +Kevin Schlosser <drschlosser at hotmail.com> Khavish Anshudass Bhundoo <khavishbhundoo at users.noreply.github.com> +Kian-Meng Ang <kianmeng at cpan.org> kxrd <onyeabor at riseup.net> Lipin Dmitriy <blackwithwhite666 at gmail.com> Léo El Amri <leo at superlel.me> @@ -56,25 +73,41 @@ Markus <nepenthesdev at gmail.com> Martin Muenstermann <mamuema at sourceforge.net> Matt King <matt at gnik.com> +Michael Coughlin <michael.w.coughlin at gmail.com> +Michael Treanor <26148512+skeptycal at users.noreply.github.com> +Michał Górny <mgorny at gentoo.org> Nelson Chen <crazysim at gmail.com> Nick Pilon <npilon at oreilly.com> +Nicolas Pauss <nicolas.pauss at intersec.com> Oren <orenyomtov at users.noreply.github.com> Orion Poplawski <orion at cora.nwra.com> Oskari Saarenmaa <os at ohmu.fi> Paul Pacheco +Pierre Grimaud <grimaud.pierre at gmail.com> +René Dudfield <renesd at gmail.com> +resokou <resokou at gmail.com> Roland Sommer <rol at ndsommer.de> Romuald Brunet <romuald at gandi.net> Romulo A. Ceccon <romuloceccon at gmail.com> +Russell McConnachie <okanaganrusty at mcconnachie.ca> +Russell McConnachie <pmcconna at cisco.com> Samuel Dion-Girardeau <samuel.diongirardeau at gmail.com> +Samuel Henrique <samueloph at debian.org> +Scott Talbert <swt at techie.net> +Simon Legner <Simon.Legner at gmail.com> Srinivas <spg349 at nyu.edu> +Steve Kowalik <steven at wedontsleep.org> +Subin <eourm20 at gmail.com> Tal Einat <tal.einat at socialcodeinc.com> Thomas Hunger <teh at camvine.org> Tino Lange <Tino.Lange at gmx.de> toddrme2178 <toddrme2178 at gmail.com> Tom Pierce <tom.pierce0 at gmail.com> Victor Lascurain <bittor at eleka.net> +Vincent Philippon <Vincent.Philippon at ubisoft.com> Vitaly Murashev <vitaly.murashev at gmail.com> Vitezslav Cizek <vcizek at suse.com> +vmurashev <vitaly.murashev at gmail.com> Wei C <gitsouler at users.noreply.github.com> Whitney Sorenson <wsorenson at gmail.com> Wim Lewis <wiml at users.sourceforge.net>
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/COPYING-MIT -> _service:tar_scm:pycurl-7.45.2.tar.gz/COPYING-MIT
Changed
@@ -2,7 +2,7 @@ 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-2021 by Oleg Pudeyev <oleg at bsdpower.com> +Copyright (C) 2013-2022 by Oleg Pudeyev <code at olegp.name> All rights reserved.
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/ChangeLog -> _service:tar_scm:pycurl-7.45.2.tar.gz/ChangeLog
Changed
@@ -1,9 +1,47 @@ +Version 7.45.2 requires libcurl-7.19.0 or better - 2022-12-16 +--------------------------------------------------------------- + + * Python 3.9 compatibility for Py_TRASHCAN_SAFE_BEGIN + (patch by Scott Talbert). + * Add support for CURL_HTTP_VERSION_3 (patch by Scott Talbert). + * Add CURLOPT_TLS13_CIPHERS and CURLOPT_PROXY_TLS13_CIPHERS options + (patch by Scott Talbert). + * Added HTTP09_ALLOWED option (patch by Scott Talbert). + * Removed use of distutils (patch by Scott Talbert). + + +Version 7.45.1 requires libcurl-7.19.0 or better - 2022-03-13 +--------------------------------------------------------------- + + * Fixed build against libcurl < 7.64.1 (patch by Scott Talbert). + + +Version 7.45.0 requires libcurl-7.64.1 or better - 2022-03-09 +--------------------------------------------------------------- + + * Add CURLOPT_MAXLIFETIME_CONN (patch by fsbs). + + * Easy handle duplication support (patch by fsbs). + + * Support for unsetting a number of multi options (patch by fsbs). + + * pycurl classes can now be subclassed (patch by fsbs). + + * Multi callbacks' thread state management fixed (patch by fsbs). + + * Add CURL_LOCK_DATA_PSL (patch by fsbs). + + * Add support for SecureTransport SSL backend (MacOS) + (patch by Scott Talbert). + + Version 7.44.1 requires libcurl-7.19.0 or better - 2021-08-15 --------------------------------------------------------------- * Fixed Python thread initialization causing hangs on operations (patch by Scott Talbert). + Version 7.44.0 requires libcurl-7.19.0 or better - 2021-08-08 --------------------------------------------------------------- @@ -24,6 +62,7 @@ * Compilation fixed against Python 3.10 alpha (patch by Kamil Dudka). + Version 7.43.0.6 requires libcurl-7.19.0 or better - 2020-09-02 ----------------------------------------------------------------- @@ -54,6 +93,7 @@ * surrogateescape error handler is used in multi_info_read to handle invalid UTF-8. + Version 7.43.0.5 requires libcurl-7.19.0 or better - 2020-01-29 ----------------------------------------------------------------- @@ -524,7 +564,7 @@ * Added CURLE_NOT_BUILT_IN and CURLE_UNKNOWN_OPTION (libcurl 7.21.5+). * Added CURL_SEEKFUNC_OK, CURL_SEEKFUNC_FAIL and - CURL_SEEKFUNC_CANTSEEK. All contstants require libcurl 7.19.5+; + CURL_SEEKFUNC_CANTSEEK. All constants require libcurl 7.19.5+; numeric values of CURL_SEEKFUNC_OK and CURL_SEEKFUNC_FAIL were understood earlier but constants only exist as of libcurl 7.19.5. @@ -1397,7 +1437,7 @@ 2002-07-16 Markus F.X.J. Oberhumer <mfx> * Under Python 2.2 or better, Curl and CurlMulti objects now - automatically participate in cyclic garbarge collection + automatically participate in cyclic garbage collection (using the gc module).
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/INSTALL.rst -> _service:tar_scm:pycurl-7.45.2.tar.gz/INSTALL.rst
Changed
@@ -53,7 +53,7 @@ To fix this, you need to tell ``setup.py`` what SSL backend is used:: - python setup.py --with-openssl|gnutls|nss|mbedtls|wolfssl install + python setup.py --with-openssl|gnutls|nss|mbedtls|wolfssl|sectransp install Note: as of PycURL 7.21.5, setup.py accepts ``--with-openssl`` option to indicate that libcurl is built against OpenSSL/LibreSSL/BoringSSL. @@ -86,7 +86,7 @@ The same applies to the SSL backend, if you need to specify it (see the SSL note above):: - export PYCURL_SSL_LIBRARY=openssl|gnutls|nss|mbedtls + export PYCURL_SSL_LIBRARY=openssl|gnutls|nss|mbedtls|sectransp easy_install pycurl
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/MANIFEST.in -> _service:tar_scm:pycurl-7.45.2.tar.gz/MANIFEST.in
Changed
@@ -10,6 +10,7 @@ include INSTALL.rst include MANIFEST.in include Makefile +include pytest.ini include README.rst include RELEASE-NOTES.rst include doc/*.py
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/Makefile -> _service:tar_scm:pycurl-7.45.2.tar.gz/Makefile
Changed
@@ -9,6 +9,9 @@ PYTEST = pytest PYFLAKES = pyflakes +PYTHONMAJOR=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1}') +PYTHONMINOR=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$2}') + # -c on linux # freebsd does not understand -c CHMOD_VERBOSE=-v @@ -111,8 +114,7 @@ # rails-style alias c: console console: - PYTHONSUFFIX=$$(python -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \ - PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \ + PYTHONPATH=$$(ls -d build/lib.*$$PYTHONMAJOR*$$PYTHONMINOR):$$PYTHONPATH \ $(PYTHON) # (needs GNU binutils) @@ -145,8 +147,7 @@ docs: build mkdir -p build/docstrings for file in doc/docstrings/*.rst; do tail -n +3 $$file >build/docstrings/`basename $$file`; done - PYTHONSUFFIX=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \ - PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \ + PYTHONPATH=$$(ls -d build/lib.*$$PYTHONMAJOR*$$PYTHONMINOR):$$PYTHONPATH \ $(PYTHON) -m sphinx doc build/doc cp ChangeLog build/doc @@ -157,8 +158,7 @@ # sphinx-docs has an -a option but it does not seem to always # rebuild everything rm -rf build/doc - PYTHONSUFFIX=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \ - PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \ + PYTHONPATH=$$(ls -d build/lib.*$$PYTHONMAJOR*$$PYTHONMINOR):$$PYTHONPATH \ $(PYTHON) -m sphinx doc build/doc cp ChangeLog build/doc
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/PKG-INFO -> _service:tar_scm:pycurl-7.45.2.tar.gz/PKG-INFO
Changed
@@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: pycurl -Version: 7.44.1 +Version: 7.45.2 Summary: PycURL -- A Python Interface To The cURL library Home-page: http://pycurl.io/ Author: Kjetil Jacobsen, Markus F.X.J. Oberhumer, Oleg Pudeyev @@ -8,86 +8,6 @@ Maintainer: Oleg Pudeyev Maintainer-email: oleg@bsdpower.com License: LGPL/MIT -Description: PycURL -- A Python Interface To The cURL library - ================================================ - - PycURL is a Python interface to `libcurl`_, the multiprotocol file - transfer library. Similarly to the urllib_ Python module, - PycURL can be used to fetch objects identified by a URL from a Python program. - Beyond simple fetches however PycURL exposes most of the functionality of - libcurl, including: - - - Speed - libcurl is very fast and PycURL, being a thin wrapper above - libcurl, is very fast as well. PycURL `was benchmarked`_ to be several - times faster than requests_. - - Features including multiple protocol support, SSL, authentication and - proxy options. PycURL supports most of libcurl's callbacks. - - Multi_ and share_ interfaces. - - Sockets used for network operations, permitting integration of PycURL - into the application's I/O loop (e.g., using Tornado_). - - .. _was benchmarked: http://stackoverflow.com/questions/15461995/python-requests-vs-pycurl-performance - .. _requests: http://python-requests.org/ - .. _Multi: https://curl.haxx.se/libcurl/c/libcurl-multi.html - .. _share: https://curl.haxx.se/libcurl/c/libcurl-share.html - .. _Tornado: http://www.tornadoweb.org/ - - - Requirements - ------------ - - - Python 3.5-3.9. - - libcurl 7.19.0 or better. - - - Installation - ------------ - - Download the source distribution from `PyPI`_. - - Please see `the installation documentation`_ for installation instructions. - - .. _PyPI: https://pypi.python.org/pypi/pycurl - .. _the installation documentation: http://pycurl.io/docs/latest/install.html - - - Documentation - ------------- - - Documentation for the most recent PycURL release is available on - `PycURL website <http://pycurl.io/docs/latest/>`_. - - - Support - ------- - - For support questions please use `curl-and-python mailing list`_. - `Mailing list archives`_ are available for your perusal as well. - - Although not an official support venue, `Stack Overflow`_ has been - popular with some PycURL users. - - Bugs can be reported `via GitHub`_. Please use GitHub only for bug - reports and direct questions to our mailing list instead. - - .. _curl-and-python mailing list: http://cool.haxx.se/mailman/listinfo/curl-and-python - .. _Stack Overflow: http://stackoverflow.com/questions/tagged/pycurl - .. _Mailing list archives: https://curl.haxx.se/mail/list.cgi?list=curl-and-python - .. _via GitHub: https://github.com/pycurl/pycurl/issues - - - License - ------- - - PycURL is dual licensed under the LGPL and an MIT/X derivative license - based on the libcurl license. The complete text of the licenses is available - in COPYING-LGPL_ and COPYING-MIT_ files in the source distribution. - - .. _libcurl: https://curl.haxx.se/libcurl/ - .. _urllib: http://docs.python.org/library/urllib.html - .. _COPYING-LGPL: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-LGPL - .. _COPYING-MIT: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-MIT - Keywords: curl,libcurl,urllib,wget,download,file transfer,http,www Platform: All Classifier: Development Status :: 5 - Production/Stable @@ -103,6 +23,90 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Internet :: File Transfer Protocol (FTP) Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.5 +License-File: COPYING-LGPL +License-File: COPYING-MIT +License-File: AUTHORS + +PycURL -- A Python Interface To The cURL library +================================================ + +PycURL is a Python interface to `libcurl`_, the multiprotocol file +transfer library. Similarly to the urllib_ Python module, +PycURL can be used to fetch objects identified by a URL from a Python program. +Beyond simple fetches however PycURL exposes most of the functionality of +libcurl, including: + +- Speed - libcurl is very fast and PycURL, being a thin wrapper above + libcurl, is very fast as well. PycURL `was benchmarked`_ to be several + times faster than requests_. +- Features including multiple protocol support, SSL, authentication and + proxy options. PycURL supports most of libcurl's callbacks. +- Multi_ and share_ interfaces. +- Sockets used for network operations, permitting integration of PycURL + into the application's I/O loop (e.g., using Tornado_). + +.. _was benchmarked: http://stackoverflow.com/questions/15461995/python-requests-vs-pycurl-performance +.. _requests: http://python-requests.org/ +.. _Multi: https://curl.haxx.se/libcurl/c/libcurl-multi.html +.. _share: https://curl.haxx.se/libcurl/c/libcurl-share.html +.. _Tornado: http://www.tornadoweb.org/ + + +Requirements +------------ + +- Python 3.5-3.10. +- libcurl 7.19.0 or better. + + +Installation +------------ + +Download the source distribution from `PyPI`_. + +Please see `the installation documentation`_ for installation instructions. + +.. _PyPI: https://pypi.python.org/pypi/pycurl +.. _the installation documentation: http://pycurl.io/docs/latest/install.html + + +Documentation +------------- + +Documentation for the most recent PycURL release is available on +`PycURL website <http://pycurl.io/docs/latest/>`_. + + +Support +------- + +For support questions please use `curl-and-python mailing list`_. +`Mailing list archives`_ are available for your perusal as well. + +Although not an official support venue, `Stack Overflow`_ has been +popular with some PycURL users. + +Bugs can be reported `via GitHub`_. Please use GitHub only for bug +reports and direct questions to our mailing list instead. + +.. _curl-and-python mailing list: http://cool.haxx.se/mailman/listinfo/curl-and-python +.. _Stack Overflow: http://stackoverflow.com/questions/tagged/pycurl +.. _Mailing list archives: https://curl.haxx.se/mail/list.cgi?list=curl-and-python +.. _via GitHub: https://github.com/pycurl/pycurl/issues + + +License +------- + +PycURL is dual licensed under the LGPL and an MIT/X derivative license +based on the libcurl license. The complete text of the licenses is available +in COPYING-LGPL_ and COPYING-MIT_ files in the source distribution. + +.. _libcurl: https://curl.haxx.se/libcurl/ +.. _urllib: http://docs.python.org/library/urllib.html +.. _COPYING-LGPL: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-LGPL +.. _COPYING-MIT: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-MIT
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/README.rst -> _service:tar_scm:pycurl-7.45.2.tar.gz/README.rst
Changed
@@ -29,7 +29,7 @@ Requirements ------------ -- Python 3.5-3.8. +- Python 3.5-3.10. - libcurl 7.19.0 or better. @@ -172,7 +172,7 @@ 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-2021 by Oleg Pudeyev <oleg at bsdpower.com> + Copyright (C) 2013-2022 by Oleg Pudeyev <code at olegp.name> All rights reserved.
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/RELEASE-NOTES.rst -> _service:tar_scm:pycurl-7.45.2.tar.gz/RELEASE-NOTES.rst
Changed
@@ -1,6 +1,24 @@ Release Notes ============= +PycURL 7.45.2 - 2022-12-16 +-------------------------- + +This release fixes several minor issues and adds support for several libcurl +options. + +PycURL 7.45.1 - 2022-03-13 +-------------------------- + +This release fixes build when libcurl < 7.64.1 is used. + +PycURL 7.45.0 - 2022-03-09 +-------------------------- + +This release adds support for SecureTransport SSL backend (MacOS), adds +ability to unset a number of multi options, adds ability to duplicate easy +handles and permits pycurl classes to be subclassed. + PycURL 7.44.1 - 2021-08-15 --------------------------
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/doc/conf.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/doc/conf.py
Changed
@@ -47,16 +47,16 @@ # General information about the project. project = u'PycURL' -copyright = u'2001-2021 Kjetil Jacobsen, Markus F.X.J. Oberhumer, Oleg Pudeyev' +copyright = u'2001-2022 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.44.1' +version = '7.45.2' # The full version, including alpha/beta/rc tags. -release = '7.44.1' +release = '7.45.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.
View file
_service:tar_scm:pycurl-7.45.2.tar.gz/doc/docstrings/curl_duphandle.rst
Added
@@ -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
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/doc/docstrings/multi_select.rst -> _service:tar_scm:pycurl-7.45.2.tar.gz/doc/docstrings/multi_select.rst
Changed
@@ -1,4 +1,4 @@ -select(timeout) -> number of ready file descriptors or -1 on timeout +select(timeout) -> number of ready file descriptors or 0 on timeout Returns result from doing a select() on the curl multi file descriptor with the given timeout. @@ -18,7 +18,7 @@ if ret != pycurl.E_CALL_MULTI_PERFORM: break while num_handles: ret = m.select(1.0) - if ret == -1: continue + if ret == 0: continue while 1: ret, num_handles = m.perform() if ret != pycurl.E_CALL_MULTI_PERFORM: break
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/doc/unimplemented.rst -> _service:tar_scm:pycurl-7.45.2.tar.gz/doc/unimplemented.rst
Changed
@@ -55,7 +55,7 @@ -------------------- Some symbols are present in libcurl's `symbols in versions`_ document but -are not documented by libcurl. These symbols are not impemented by PycURL. +are not documented by libcurl. These symbols are not implemented by PycURL. As of this writing, the following symbols are thusly omitted:
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/pycurl.egg-info/PKG-INFO -> _service:tar_scm:pycurl-7.45.2.tar.gz/pycurl.egg-info/PKG-INFO
Changed
@@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: pycurl -Version: 7.44.1 +Version: 7.45.2 Summary: PycURL -- A Python Interface To The cURL library Home-page: http://pycurl.io/ Author: Kjetil Jacobsen, Markus F.X.J. Oberhumer, Oleg Pudeyev @@ -8,86 +8,6 @@ Maintainer: Oleg Pudeyev Maintainer-email: oleg@bsdpower.com License: LGPL/MIT -Description: PycURL -- A Python Interface To The cURL library - ================================================ - - PycURL is a Python interface to `libcurl`_, the multiprotocol file - transfer library. Similarly to the urllib_ Python module, - PycURL can be used to fetch objects identified by a URL from a Python program. - Beyond simple fetches however PycURL exposes most of the functionality of - libcurl, including: - - - Speed - libcurl is very fast and PycURL, being a thin wrapper above - libcurl, is very fast as well. PycURL `was benchmarked`_ to be several - times faster than requests_. - - Features including multiple protocol support, SSL, authentication and - proxy options. PycURL supports most of libcurl's callbacks. - - Multi_ and share_ interfaces. - - Sockets used for network operations, permitting integration of PycURL - into the application's I/O loop (e.g., using Tornado_). - - .. _was benchmarked: http://stackoverflow.com/questions/15461995/python-requests-vs-pycurl-performance - .. _requests: http://python-requests.org/ - .. _Multi: https://curl.haxx.se/libcurl/c/libcurl-multi.html - .. _share: https://curl.haxx.se/libcurl/c/libcurl-share.html - .. _Tornado: http://www.tornadoweb.org/ - - - Requirements - ------------ - - - Python 3.5-3.9. - - libcurl 7.19.0 or better. - - - Installation - ------------ - - Download the source distribution from `PyPI`_. - - Please see `the installation documentation`_ for installation instructions. - - .. _PyPI: https://pypi.python.org/pypi/pycurl - .. _the installation documentation: http://pycurl.io/docs/latest/install.html - - - Documentation - ------------- - - Documentation for the most recent PycURL release is available on - `PycURL website <http://pycurl.io/docs/latest/>`_. - - - Support - ------- - - For support questions please use `curl-and-python mailing list`_. - `Mailing list archives`_ are available for your perusal as well. - - Although not an official support venue, `Stack Overflow`_ has been - popular with some PycURL users. - - Bugs can be reported `via GitHub`_. Please use GitHub only for bug - reports and direct questions to our mailing list instead. - - .. _curl-and-python mailing list: http://cool.haxx.se/mailman/listinfo/curl-and-python - .. _Stack Overflow: http://stackoverflow.com/questions/tagged/pycurl - .. _Mailing list archives: https://curl.haxx.se/mail/list.cgi?list=curl-and-python - .. _via GitHub: https://github.com/pycurl/pycurl/issues - - - License - ------- - - PycURL is dual licensed under the LGPL and an MIT/X derivative license - based on the libcurl license. The complete text of the licenses is available - in COPYING-LGPL_ and COPYING-MIT_ files in the source distribution. - - .. _libcurl: https://curl.haxx.se/libcurl/ - .. _urllib: http://docs.python.org/library/urllib.html - .. _COPYING-LGPL: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-LGPL - .. _COPYING-MIT: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-MIT - Keywords: curl,libcurl,urllib,wget,download,file transfer,http,www Platform: All Classifier: Development Status :: 5 - Production/Stable @@ -103,6 +23,90 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Internet :: File Transfer Protocol (FTP) Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.5 +License-File: COPYING-LGPL +License-File: COPYING-MIT +License-File: AUTHORS + +PycURL -- A Python Interface To The cURL library +================================================ + +PycURL is a Python interface to `libcurl`_, the multiprotocol file +transfer library. Similarly to the urllib_ Python module, +PycURL can be used to fetch objects identified by a URL from a Python program. +Beyond simple fetches however PycURL exposes most of the functionality of +libcurl, including: + +- Speed - libcurl is very fast and PycURL, being a thin wrapper above + libcurl, is very fast as well. PycURL `was benchmarked`_ to be several + times faster than requests_. +- Features including multiple protocol support, SSL, authentication and + proxy options. PycURL supports most of libcurl's callbacks. +- Multi_ and share_ interfaces. +- Sockets used for network operations, permitting integration of PycURL + into the application's I/O loop (e.g., using Tornado_). + +.. _was benchmarked: http://stackoverflow.com/questions/15461995/python-requests-vs-pycurl-performance +.. _requests: http://python-requests.org/ +.. _Multi: https://curl.haxx.se/libcurl/c/libcurl-multi.html +.. _share: https://curl.haxx.se/libcurl/c/libcurl-share.html +.. _Tornado: http://www.tornadoweb.org/ + + +Requirements +------------ + +- Python 3.5-3.10. +- libcurl 7.19.0 or better. + + +Installation +------------ + +Download the source distribution from `PyPI`_. + +Please see `the installation documentation`_ for installation instructions. + +.. _PyPI: https://pypi.python.org/pypi/pycurl +.. _the installation documentation: http://pycurl.io/docs/latest/install.html + + +Documentation +------------- + +Documentation for the most recent PycURL release is available on +`PycURL website <http://pycurl.io/docs/latest/>`_. + + +Support +------- + +For support questions please use `curl-and-python mailing list`_. +`Mailing list archives`_ are available for your perusal as well. + +Although not an official support venue, `Stack Overflow`_ has been +popular with some PycURL users. + +Bugs can be reported `via GitHub`_. Please use GitHub only for bug +reports and direct questions to our mailing list instead. + +.. _curl-and-python mailing list: http://cool.haxx.se/mailman/listinfo/curl-and-python +.. _Stack Overflow: http://stackoverflow.com/questions/tagged/pycurl +.. _Mailing list archives: https://curl.haxx.se/mail/list.cgi?list=curl-and-python +.. _via GitHub: https://github.com/pycurl/pycurl/issues + + +License +------- + +PycURL is dual licensed under the LGPL and an MIT/X derivative license +based on the libcurl license. The complete text of the licenses is available +in COPYING-LGPL_ and COPYING-MIT_ files in the source distribution. + +.. _libcurl: https://curl.haxx.se/libcurl/ +.. _urllib: http://docs.python.org/library/urllib.html +.. _COPYING-LGPL: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-LGPL +.. _COPYING-MIT: https://raw.githubusercontent.com/pycurl/pycurl/master/COPYING-MIT
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/pycurl.egg-info/SOURCES.txt -> _service:tar_scm:pycurl-7.45.2.tar.gz/pycurl.egg-info/SOURCES.txt
Changed
@@ -7,6 +7,7 @@ Makefile README.rst RELEASE-NOTES.rst +pytest.ini requirements-dev.txt setup.py winbuild.py @@ -30,6 +31,7 @@ doc/unimplemented.rst doc/docstrings/curl.rst doc/docstrings/curl_close.rst +doc/docstrings/curl_duphandle.rst doc/docstrings/curl_errstr.rst doc/docstrings/curl_errstr_raw.rst doc/docstrings/curl_getinfo.rst @@ -123,6 +125,7 @@ tests/curl_object_test.py tests/debug_test.py tests/default_write_cb_test.py +tests/duphandle_test.py tests/error_constants_test.py tests/error_test.py tests/failonerror_test.py @@ -137,6 +140,7 @@ tests/internals_test.py tests/matrix.py tests/memory_mgmt_test.py +tests/multi_callback_test.py tests/multi_memory_mgmt_test.py tests/multi_option_constants_test.py tests/multi_socket_select_test.py @@ -169,6 +173,7 @@ tests/share_test.py tests/sockopt_cb_test.py tests/ssh_key_cb_test.py +tests/subclass_test.py tests/unset_range_test.py tests/user_agent_string_test.py tests/util.py
View file
_service:tar_scm:pycurl-7.45.2.tar.gz/pytest.ini
Added
@@ -0,0 +1,9 @@ +pytest +python_files = tests/*.py +norecursedirs = examples win +markers = + ssh: mark a test as requiring ssh + online: mark a test as requiring internet access + gssapi: mark a test as requiring GSSAPI + http2: mark a test as requiring HTTP/2 + standalone: mark a test as being standalone
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/python/curl/__init__.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/python/curl/__init__.py
Changed
@@ -1,7 +1,7 @@ '''A high-level interface to the pycurl extension''' # ** mfx NOTE: the CGI class uses "black magic" using COOKIEFILE in -# combination with a non-existant file name. See the libcurl docs +# combination with a non-existent file name. See the libcurl docs # for more info. import sys, pycurl
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/setup.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/setup.py
Changed
@@ -6,17 +6,11 @@ PACKAGE = "pycurl" PY_PACKAGE = "curl" -VERSION = "7.44.1" +VERSION = "7.45.2" -import glob, os, re, sys, subprocess -import distutils -try: - from setuptools import setup -except ImportError: - from distutils.core import setup -from distutils.extension import Extension -from distutils.util import split_quoted -from distutils.version import LooseVersion +import glob, os, re, shlex, sys, subprocess +from setuptools import setup +from setuptools.extension import Extension py3 = sys.version_info0 == 3 @@ -128,7 +122,7 @@ msg += ":\n" + stderr.decode() raise ConfigurationError(msg) curl_has_ssl = False - for feature in split_quoted(stdout.decode()): + for feature in shlex.split(stdout.decode()): if feature == 'SSL': # this means any ssl library, not just openssl. # we set the ssl flag to check for ssl library mismatch @@ -145,6 +139,7 @@ '--with-gnutls': self.using_gnutls, '--with-nss': self.using_nss, '--with-mbedtls': self.using_mbedtls, + '--with-sectransp': self.using_sectransp, } def detect_ssl_option(self): @@ -162,7 +157,7 @@ if 'PYCURL_SSL_LIBRARY' in os.environ: ssl_lib = os.environ'PYCURL_SSL_LIBRARY' - if ssl_lib in 'openssl', 'wolfssl', 'gnutls', 'nss', 'mbedtls': + if ssl_lib in 'openssl', 'wolfssl', 'gnutls', 'nss', 'mbedtls', 'sectransp': ssl_lib_detected = ssl_lib getattr(self, 'using_%s' % ssl_lib)() else: @@ -184,7 +179,7 @@ if not ssl_lib_detected: # self.sslhintbuf is a hack - for arg in split_quoted(self.sslhintbuf): + for arg in shlex.split(self.sslhintbuf): if arg:2 == "-l": if arg2: == 'ssl': self.using_openssl() @@ -253,7 +248,7 @@ if stderr: msg += ":\n" + stderr.decode() raise ConfigurationError(msg) - for arg in split_quoted(stdout.decode()): + for arg in shlex.split(stdout.decode()): if arg:2 == "-I": # do not add /usr/include if not re.search(r"^\/+usr\/+include\/*$", arg2:): @@ -279,7 +274,7 @@ # for hints as to which SSL library libcurl is linked against. # More information: https://github.com/pycurl/pycurl/pull/147 # - # The final point is we should link agaist the SSL library in use + # The final point is we should link against the SSL library in use # even if libcurl does not tell us to, because *we* invoke functions # in that SSL library. This means any SSL libraries found in # --static-libs are forwarded to our libraries. @@ -326,15 +321,16 @@ sys.stderr.write('''\ Warning: libcurl is configured to use SSL, but we have not been able to \ determine which SSL backend it is using. If your Curl is built against \ -OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS or mbedTLS please specify the SSL backend \ -manually. For other SSL backends please ignore this message.''') +OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS, mbedTLS, or Secure Transport \ +please specify the SSL backend manually. For other SSL backends please \ +ignore this message.''') else: if self.detect_ssl_option(): sys.stderr.write("Warning: SSL backend specified manually but libcurl does not use SSL\n") # libraries and options - all libraries and options are forwarded # but if --libs succeeded, --static-libs output is ignored - for arg in split_quoted(optbuf): + for arg in shlex.split(optbuf): if arg:2 == "-l": self.libraries.append(arg2:) elif arg:2 == "-L": @@ -371,6 +367,9 @@ elif ssl_version.startswith('mbedTLS/'): self.using_mbedtls() ssl_lib_detected = 'mbedtls' + elif ssl_version.startswith('SecureTransport'): + self.using_sectransp() + ssl_lib_detected = 'sectransp' return ssl_lib_detected def detect_ssl_lib_on_centos6_plus(self): @@ -411,6 +410,10 @@ return ssl_lib_detected def configure_windows(self): + OPENSSL_DIR = scan_argv(self.argv, "--openssl-dir=") + if OPENSSL_DIR is not None: + self.include_dirs.append(os.path.join(OPENSSL_DIR, "include")) + self.library_dirs.append(os.path.join(OPENSSL_DIR, "lib")) # Windows users have to pass --curl-dir parameter to specify path # to libcurl, because there is no curl-config on windows at all. curl_dir = scan_argv(self.argv, "--curl-dir=") @@ -572,45 +575,17 @@ self.define_macros.append(('HAVE_CURL_SSL', 1)) self.ssl_lib_detected = 'mbedtls' -def get_bdist_msi_version_hack(): - # workaround for distutils/msi version requirement per - # epydoc.sourceforge.net/stdlib/distutils.version.StrictVersion-class.html - - # only x.y.z version numbers are supported, whereas our versions might be x.y.z.p. - # bugs.python.org/issue6040#msg133094 - from distutils.command.bdist_msi import bdist_msi - import inspect - import types - import re - - class bdist_msi_version_hack(bdist_msi): - """ MSI builder requires version to be in the x.x.x format """ - def run(self): - def monkey_get_version(self): - """ monkey patch replacement for metadata.get_version() that - returns MSI compatible version string for bdist_msi - """ - # get filename of the calling function - if inspect.stack()11.endswith('bdist_msi.py'): - # strip revision from version (if any), e.g. 11.0.0-r31546 - match = re.match(r'(\d+\.\d+\.\d+)', self.version) - assert match - return match.group(1) - else: - return self.version - - # monkeypatching get_version() call for DistributionMetadata - self.distribution.metadata.get_version = \ - types.MethodType(monkey_get_version, self.distribution.metadata) - bdist_msi.run(self) - - return bdist_msi_version_hack + def using_sectransp(self): + self.define_macros.append(('HAVE_CURL_SECTRANSP', 1)) + self.define_macros.append(('HAVE_CURL_SSL', 1)) + self.ssl_lib_detected = 'sectransp' def strip_pycurl_options(argv): if sys.platform == 'win32': options = '--curl-dir=', '--libcurl-lib-name=', '--use-libcurl-dll', - '--avoid-stdio', '--with-openssl', + '--avoid-stdio', '--with-openssl', '--openssl-dir=', else: options = '--openssl-dir=', '--curl-config=', '--avoid-stdio' @@ -627,6 +602,7 @@ 'gnutls': 'GnuTLS', 'nss': 'NSS', 'mbedtls': 'mbedTLS', + 'sectransp': 'Secure Transport', } def get_extension(argv, split_extension_source=False): @@ -761,12 +737,12 @@ authors_para = parasAUTHORS_PARAGRAPH authors = author for author in authors_para.strip().split("\n") - log = subprocess.check_output('git', 'log', '--format=%an (%ae)') + log = subprocess.check_output('git', 'log', '--format=%an (%ae)').decode() for author in log.strip().split("\n"): author = author.replace('@', ' at ').replace('(', '<').replace(')', '>') if author not in authors: authors.append(author) - authors.sort() + authors.sort(key=lambda s: s.lower()) parasAUTHORS_PARAGRAPH = "\n".join(authors) f = open('AUTHORS', 'w') try: @@ -852,7 +828,7 @@ Requirements ------------ -- Python 3.5-3.9. +- Python 3.5-3.10. - libcurl 7.19.0 or better. @@ -926,23 +902,16 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: Internet :: File Transfer Protocol (FTP)', 'Topic :: Internet :: WWW/HTTP', , packages=PY_PACKAGE, package_dir={ PY_PACKAGE: os.path.join('python', 'curl') }, python_requires='>=3.5', + platforms='All', ) -if sys.platform == "win32": - setup_args'cmdclass' = {'bdist_msi': get_bdist_msi_version_hack()} - -##print distutils.__version__ -if LooseVersion(distutils.__version__) > LooseVersion("1.0.1"): - setup_args"platforms" = "All" -if LooseVersion(distutils.__version__) < LooseVersion("1.0.3"): - setup_args"licence" = setup_args"license" - unix_help = '''\ PycURL Unix options: --curl-config=/path/to/curl-config use specified curl-config binary @@ -954,6 +923,7 @@ --with-nss libcurl is linked against NSS --with-mbedtls libcurl is linked against mbedTLS --with-wolfssl libcurl is linked against wolfSSL + --with-sectransp libcurl is linked against Secure Transport ''' windows_help = '''\ @@ -962,6 +932,7 @@ --use-libcurl-dll link against libcurl DLL, if not given link against libcurl statically --libcurl-lib-name=libcurl_imp.lib override libcurl import library name + --openssl-dir=/path/to/openssl/dir path to OpenSSL/LibreSSL/BoringSSL headers and libraries --with-openssl libcurl is linked against OpenSSL/LibreSSL/BoringSSL --with-ssl legacy alias for --with-openssl --link-arg=foo.lib also link against specified library @@ -988,7 +959,8 @@ elif len(sys.argv) > 1 and sys.argv1 == 'docstrings-sources': gen_docstrings_sources() else: - convert_docstrings() + if sys.argv1 not in 'clean' and (not os.path.exists('src/docstrings.c') or not os.path.exists('src/docstrings.h')): + convert_docstrings() setup_args'data_files' = get_data_files() if 'PYCURL_RELEASE' in os.environ and os.environ'PYCURL_RELEASE'.lower() in '1', 'yes', 'true':
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/docstrings.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/docstrings.c
Changed
@@ -24,6 +24,30 @@ .. _curl_easy_cleanup:\n\ https://curl.haxx.se/libcurl/c/curl_easy_cleanup.html"; +PYCURL_INTERNAL const char curl_duphandle_doc = "duphandle() -> Curl\n\ +\n\ +Clone a curl handle. This function will return a new curl handle,\n\ +a duplicate, using all the options previously set in the input curl handle.\n\ +Both handles can subsequently be used independently.\n\ +\n\ +The new handle will not inherit any state information, no connections,\n\ +no SSL sessions and no cookies. It also will not inherit any share object\n\ +states or options (it will be made as if SHARE was unset).\n\ +\n\ +Corresponds to `curl_easy_duphandle`_ in libcurl.\n\ +\n\ +Example usage::\n\ +\n\ + import pycurl\n\ + curl = pycurl.Curl()\n\ + curl.setopt(pycurl.URL, \"https://python.org\")\n\ + dup = curl.duphandle()\n\ + curl.perform()\n\ + dup.perform()\n\ +\n\ +.. _curl_easy_duphandle:\n\ + https://curl.se/libcurl/c/curl_easy_duphandle.html"; + PYCURL_INTERNAL const char curl_errstr_doc = "errstr() -> string\n\ \n\ Return the internal libcurl error buffer of this handle as a string.\n\ @@ -532,7 +556,7 @@ .. _curl_multi_remove_handle:\n\ https://curl.haxx.se/libcurl/c/curl_multi_remove_handle.html"; -PYCURL_INTERNAL const char multi_select_doc = "select(timeout) -> number of ready file descriptors or -1 on timeout\n\ +PYCURL_INTERNAL const char multi_select_doc = "select(timeout) -> number of ready file descriptors or 0 on timeout\n\ \n\ Returns result from doing a select() on the curl multi file descriptor\n\ with the given timeout.\n\ @@ -552,7 +576,7 @@ if ret != pycurl.E_CALL_MULTI_PERFORM: break\n\ while num_handles:\n\ ret = m.select(1.0)\n\ - if ret == -1: continue\n\ + if ret == 0: continue\n\ while 1:\n\ ret, num_handles = m.perform()\n\ if ret != pycurl.E_CALL_MULTI_PERFORM: break";
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/docstrings.h -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/docstrings.h
Changed
@@ -3,6 +3,7 @@ extern const char curl_doc; extern const char curl_close_doc; +extern const char curl_duphandle_doc; extern const char curl_errstr_doc; extern const char curl_errstr_raw_doc; extern const char curl_getinfo_doc;
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/easy.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/easy.c
Changed
@@ -1,6 +1,183 @@ #include "pycurl.h" #include "docstrings.h" + +/************************************************************************* +// CurlSlistObject +**************************************************************************/ + +PYCURL_INTERNAL void +util_curlslist_update(CurlSlistObject **old, struct curl_slist *slist) +{ + /* Decref previous object */ + Py_XDECREF(*old); + /* Create a new object */ + *old = PyObject_New(CurlSlistObject, p_CurlSlist_Type); + assert(*old != NULL); + /* Store curl_slist into the new object */ + (*old)->slist = slist; +} + +PYCURL_INTERNAL void +do_curlslist_dealloc(CurlSlistObject *self) { + if (self->slist != NULL) { + curl_slist_free_all(self->slist); + self->slist = NULL; + } + CurlSlist_Type.tp_free(self); +} + +PYCURL_INTERNAL PyTypeObject CurlSlist_Type = { +#if PY_MAJOR_VERSION >= 3 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "pycurl.CurlSlist", /* tp_name */ + sizeof(CurlSlistObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)do_curlslist_dealloc, /* tp_dealloc */ + 0, /* tp_print / tp_vectorcall_offset */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved / tp_as_async */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PY_MAJOR_VERSION >= 3 + 0, /* tp_del */ + 0, /* tp_version_tag */ + 0, /* tp_finalize */ +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#endif +}; + + +/************************************************************************* +// CurlHttppostObject +**************************************************************************/ + +PYCURL_INTERNAL void +util_curlhttppost_update(CurlObject *obj, struct curl_httppost *httppost, PyObject *reflist) +{ + /* Decref previous object */ + Py_XDECREF(obj->httppost); + /* Create a new object */ + obj->httppost = PyObject_New(CurlHttppostObject, p_CurlHttppost_Type); + assert(obj->httppost != NULL); + /* Store curl_httppost and reflist into the new object */ + obj->httppost->httppost = httppost; + obj->httppost->reflist = reflist; +} + +PYCURL_INTERNAL void +do_curlhttppost_dealloc(CurlHttppostObject *self) { + if (self->httppost != NULL) { + curl_formfree(self->httppost); + self->httppost = NULL; + } + Py_CLEAR(self->reflist); + CurlHttppost_Type.tp_free(self); +} + +PYCURL_INTERNAL PyTypeObject CurlHttppost_Type = { +#if PY_MAJOR_VERSION >= 3 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "pycurl.CurlHttppost", /* tp_name */ + sizeof(CurlHttppostObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)do_curlhttppost_dealloc, /* tp_dealloc */ + 0, /* tp_print / tp_vectorcall_offset */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved / tp_as_async */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PY_MAJOR_VERSION >= 3 + 0, /* tp_del */ + 0, /* tp_version_tag */ + 0, /* tp_finalize */ +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#endif +}; + + /************************************************************************* // static utility functions **************************************************************************/ @@ -11,7 +188,7 @@ assert_curl_state(const CurlObject *self) { assert(self != NULL); - assert(Py_TYPE(self) == p_Curl_Type); + assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_Curl_Type) == 1); #ifdef WITH_THREAD (void) pycurl_get_thread_state(self); #endif @@ -91,12 +268,12 @@ int res; int *ptr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", empty_keywords)) { + if (subtype == p_Curl_Type && !PyArg_ParseTupleAndKeywords(args, kwds, "", empty_keywords)) { return NULL; } /* Allocate python curl object */ - self = (CurlObject *) p_Curl_Type->tp_alloc(p_Curl_Type, 0); + self = (CurlObject *) subtype->tp_alloc(subtype, 0); if (self == NULL) return NULL; @@ -123,6 +300,156 @@ return NULL; } +/* duphandle */ +PYCURL_INTERNAL CurlObject * +do_curl_duphandle(CurlObject *self) +{ + PyTypeObject *subtype; + CurlObject *dup; + int res; + int *ptr; + + /* Allocate python curl object */ + subtype = Py_TYPE(self); + dup = (CurlObject *) subtype->tp_alloc(subtype, 0); + if (dup == NULL) + return NULL; + + /* tp_alloc is expected to return zeroed memory */ + for (ptr = (int *) &dup->dict; + ptr < (int *) (((char *) dup) + sizeof(CurlObject)); + ++ptr) + assert(*ptr == 0); + + /* Clone the curl handle */ + dup->handle = curl_easy_duphandle(self->handle); + if (dup->handle == NULL) + goto error; + + /* Set curl error buffer and zero it */ + res = curl_easy_setopt(dup->handle, CURLOPT_ERRORBUFFER, dup->error); + if (res != CURLE_OK) { + goto error; + } + memset(dup->error, 0, sizeof(dup->error)); + + /* Set backreference */ + res = curl_easy_setopt(dup->handle, CURLOPT_PRIVATE, (char *) dup); + if (res != CURLE_OK) { + goto error; + } + + /* Copy attribute dictionary */ + if (self->dict != NULL) { + dup->dict = PyDict_Copy(self->dict); + if (dup->dict == NULL) { + goto error; + } + } + + /* Checking for CURLE_OK is not required here. + * All values have already been successfully setopt'ed with self->handle. */ + + /* Assign and incref python callback and update data pointers */ + if (self->w_cb != NULL) { + dup->w_cb = my_Py_NewRef(self->w_cb); + curl_easy_setopt(dup->handle, CURLOPT_WRITEDATA, dup); + } + if (self->h_cb != NULL) { + dup->h_cb = my_Py_NewRef(self->h_cb); + curl_easy_setopt(dup->handle, CURLOPT_WRITEHEADER, dup); + } + if (self->r_cb != NULL) { + dup->r_cb = my_Py_NewRef(self->r_cb); + curl_easy_setopt(dup->handle, CURLOPT_READDATA, dup); + } + if (self->pro_cb != NULL) { + dup->pro_cb = my_Py_NewRef(self->pro_cb); + curl_easy_setopt(dup->handle, CURLOPT_PROGRESSDATA, dup); + } +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 32, 0) + if (self->xferinfo_cb != NULL) { + dup->xferinfo_cb = my_Py_NewRef(self->xferinfo_cb); + curl_easy_setopt(dup->handle, CURLOPT_XFERINFODATA, dup); + } +#endif + if (self->debug_cb != NULL) { + dup->debug_cb = my_Py_NewRef(self->debug_cb); + curl_easy_setopt(dup->handle, CURLOPT_DEBUGDATA, dup); + } + if (self->ioctl_cb != NULL) { + dup->ioctl_cb = my_Py_NewRef(self->ioctl_cb); + curl_easy_setopt(dup->handle, CURLOPT_IOCTLDATA, dup); + } + if (self->opensocket_cb != NULL) { + dup->opensocket_cb = my_Py_NewRef(self->opensocket_cb); + curl_easy_setopt(dup->handle, CURLOPT_OPENSOCKETDATA, dup); + } +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 21, 7) + if (self->closesocket_cb != NULL) { + dup->closesocket_cb = my_Py_NewRef(self->closesocket_cb); + curl_easy_setopt(dup->handle, CURLOPT_CLOSESOCKETDATA, dup); + } +#endif + if (self->sockopt_cb != NULL) { + dup->sockopt_cb = my_Py_NewRef(self->sockopt_cb); + curl_easy_setopt(dup->handle, CURLOPT_SOCKOPTDATA, dup); + } +#ifdef HAVE_CURL_7_19_6_OPTS + if (self->ssh_key_cb != NULL) { + dup->ssh_key_cb = my_Py_NewRef(self->ssh_key_cb); + curl_easy_setopt(dup->handle, CURLOPT_SSH_KEYDATA, dup); + } +#endif + if (self->seek_cb != NULL) { + dup->seek_cb = my_Py_NewRef(self->seek_cb); + curl_easy_setopt(dup->handle, CURLOPT_SEEKDATA, dup); + } + + /* Assign and incref python file objects */ + dup->readdata_fp = my_Py_XNewRef(self->readdata_fp); + dup->writedata_fp = my_Py_XNewRef(self->writedata_fp); + dup->writeheader_fp = my_Py_XNewRef(self->writeheader_fp); + + /* Assign and incref postfields object */ + dup->postfields_obj = my_Py_XNewRef(self->postfields_obj); + + /* Assign and incref ca certs related references */ + dup->ca_certs_obj = my_Py_XNewRef(self->ca_certs_obj); + + /* Assign and incref every curl_slist allocated by setopt */ + dup->httpheader = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->httpheader); +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) + dup->proxyheader = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->proxyheader); +#endif + dup->http200aliases = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->http200aliases); + dup->quote = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->quote); + dup->postquote = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->postquote); + dup->prequote = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->prequote); + dup->telnetoptions = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->telnetoptions); +#ifdef HAVE_CURLOPT_RESOLVE + dup->resolve = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->resolve); +#endif +#ifdef HAVE_CURL_7_20_0_OPTS + dup->mail_rcpt = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->mail_rcpt); +#endif +#ifdef HAVE_CURLOPT_CONNECT_TO + dup->connect_to = (CurlSlistObject *)my_Py_XNewRef((PyObject *)self->connect_to); +#endif + + /* Assign and incref httppost */ + dup->httppost = (CurlHttppostObject *)my_Py_XNewRef((PyObject *)self->httppost); + + /* Success - return cloned object */ + return dup; + +error: + Py_CLEAR(dup->dict); + Py_DECREF(dup); /* this also closes dup->handle */ + PyErr_SetString(ErrorObject, "cloning curl failed"); + return NULL; +} + /* util function shared by close() and clear() */ PYCURL_INTERNAL void @@ -137,14 +464,17 @@ /* Decrement refcount for multi_stack. */ if (self->multi_stack != NULL) { CurlMultiObject *multi_stack = self->multi_stack; - self->multi_stack = NULL; if (multi_stack->multi_handle != NULL && handle != NULL) { /* TODO this is where we could remove the easy object from the multi object's easy_object_dict, but this requires us to have a reference to the multi object which right now we don't. */ + /* Allow threads because callbacks can be invoked */ + PYCURL_BEGIN_ALLOW_THREADS_EASY (void) curl_multi_remove_handle(multi_stack->multi_handle, handle); + PYCURL_END_ALLOW_THREADS_EASY } + self->multi_stack = NULL; Py_DECREF(multi_stack); } } @@ -194,14 +524,36 @@ } if (flags & PYCURL_MEMGROUP_HTTPPOST) { - /* Decrement refcounts for httppost related references. */ - Py_CLEAR(self->httppost_ref_list); + /* Decrement refcounts for httppost object. */ + Py_CLEAR(self->httppost); } if (flags & PYCURL_MEMGROUP_CACERTS) { /* Decrement refcounts for ca certs related references. */ Py_CLEAR(self->ca_certs_obj); } + + if (flags & PYCURL_MEMGROUP_SLIST) { + /* Decrement refcounts for slist objects. */ + Py_CLEAR(self->httpheader); +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) + Py_CLEAR(self->proxyheader); +#endif + Py_CLEAR(self->http200aliases); + Py_CLEAR(self->quote); + Py_CLEAR(self->postquote); + Py_CLEAR(self->prequote); + Py_CLEAR(self->telnetoptions); +#ifdef HAVE_CURLOPT_RESOLVE + Py_CLEAR(self->resolve); +#endif +#ifdef HAVE_CURL_7_20_0_OPTS + Py_CLEAR(self->mail_rcpt); +#endif +#ifdef HAVE_CURLOPT_CONNECT_TO + Py_CLEAR(self->connect_to); +#endif + } } @@ -213,7 +565,7 @@ /* Zero handle and thread-state to disallow any operations to be run * from now on */ assert(self != NULL); - assert(Py_TYPE(self) == p_Curl_Type); + assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_Curl_Type) == 1); handle = self->handle; self->handle = NULL; if (handle == NULL) { @@ -247,32 +599,6 @@ if (self->weakreflist != NULL) { PyObject_ClearWeakRefs((PyObject *) self); } - - /* Free all variables allocated by setopt */ -#undef SFREE -#define SFREE(v) if ((v) != NULL) (curl_formfree(v), (v) = NULL) - SFREE(self->httppost); -#undef SFREE -#define SFREE(v) if ((v) != NULL) (curl_slist_free_all(v), (v) = NULL) - SFREE(self->httpheader); -#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) - SFREE(self->proxyheader); -#endif - SFREE(self->http200aliases); - SFREE(self->quote); - SFREE(self->postquote); - SFREE(self->prequote); - SFREE(self->telnetoptions); -#ifdef HAVE_CURLOPT_RESOLVE - SFREE(self->resolve); -#endif -#ifdef HAVE_CURL_7_20_0_OPTS - SFREE(self->mail_rcpt); -#endif -#ifdef HAVE_CURLOPT_CONNECT_TO - SFREE(self->connect_to); -#endif -#undef SFREE } @@ -280,13 +606,13 @@ do_curl_dealloc(CurlObject *self) { PyObject_GC_UnTrack(self); - Py_TRASHCAN_SAFE_BEGIN(self); + CPy_TRASHCAN_BEGIN(self, do_curl_dealloc); Py_CLEAR(self->dict); util_curl_close(self); Curl_Type.tp_free(self); - Py_TRASHCAN_SAFE_END(self); + CPy_TRASHCAN_END(self); } @@ -351,6 +677,27 @@ VISIT(self->ca_certs_obj); + VISIT((PyObject *) self->httpheader); +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) + VISIT((PyObject *) self->proxyheader); +#endif + VISIT((PyObject *) self->http200aliases); + VISIT((PyObject *) self->quote); + VISIT((PyObject *) self->postquote); + VISIT((PyObject *) self->prequote); + VISIT((PyObject *) self->telnetoptions); +#ifdef HAVE_CURLOPT_RESOLVE + VISIT((PyObject *) self->resolve); +#endif +#ifdef HAVE_CURL_7_20_0_OPTS + VISIT((PyObject *) self->mail_rcpt); +#endif +#ifdef HAVE_CURLOPT_CONNECT_TO + VISIT((PyObject *) self->connect_to); +#endif + + VISIT((PyObject *) self->httppost); + return 0; #undef VISIT } @@ -368,31 +715,6 @@ /* Decref easy interface related objects */ util_curl_xdecref(self, PYCURL_MEMGROUP_EASY, self->handle); - /* Free all variables allocated by setopt */ -#undef SFREE -#define SFREE(v) if ((v) != NULL) (curl_formfree(v), (v) = NULL) - SFREE(self->httppost); -#undef SFREE -#define SFREE(v) if ((v) != NULL) (curl_slist_free_all(v), (v) = NULL) - SFREE(self->httpheader); -#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) - SFREE(self->proxyheader); -#endif - SFREE(self->http200aliases); - SFREE(self->quote); - SFREE(self->postquote); - SFREE(self->prequote); - SFREE(self->telnetoptions); -#ifdef HAVE_CURLOPT_RESOLVE - SFREE(self->resolve); -#endif -#ifdef HAVE_CURL_7_20_0_OPTS - SFREE(self->mail_rcpt); -#endif -#ifdef HAVE_CURLOPT_CONNECT_TO - SFREE(self->connect_to); -#endif -#undef SFREE res = util_curl_init(self); if (res < 0) { Py_DECREF(self); /* this also closes self->handle */ @@ -438,6 +760,7 @@ {"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, 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
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/easyopt.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/easyopt.c
Changed
@@ -46,6 +46,12 @@ #define SETOPT2(o,x) \ if ((res = curl_easy_setopt(self->handle, (o), (x))) != CURLE_OK) goto error #define SETOPT(x) SETOPT2((CURLoption)option, (x)) +#define CLEAR_OBJECT(object_option, object_field) \ + case object_option: \ + if ((res = curl_easy_setopt(self->handle, object_option, NULL)) != CURLE_OK) \ + goto error; \ + Py_CLEAR(object_field); \ + break #define CLEAR_CALLBACK(callback_option, data_option, callback_field) \ case callback_option: \ if ((res = curl_easy_setopt(self->handle, callback_option, NULL)) != CURLE_OK) \ @@ -65,13 +71,6 @@ Py_XDECREF(self->share); self->share = NULL; break; - case CURLOPT_HTTPPOST: - SETOPT((void *) 0); - curl_formfree(self->httppost); - util_curl_xdecref(self, PYCURL_MEMGROUP_HTTPPOST, self->handle); - self->httppost = NULL; - /* FIXME: what about data->set.httpreq ?? */ - break; case CURLOPT_INFILESIZE: SETOPT((long) -1); break; @@ -108,10 +107,6 @@ case CURLOPT_SERVICE_NAME: case CURLOPT_PROXY_SERVICE_NAME: #endif - case CURLOPT_HTTPHEADER: -#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) - case CURLOPT_PROXYHEADER: -#endif #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 52, 0) case CURLOPT_PROXY_CAPATH: case CURLOPT_PROXY_CAINFO: @@ -130,6 +125,27 @@ break; #endif + CLEAR_OBJECT(CURLOPT_HTTPHEADER, self->httpheader); +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) + CLEAR_OBJECT(CURLOPT_PROXYHEADER, self->proxyheader); +#endif + CLEAR_OBJECT(CURLOPT_HTTP200ALIASES, self->http200aliases); + CLEAR_OBJECT(CURLOPT_QUOTE, self->quote); + CLEAR_OBJECT(CURLOPT_POSTQUOTE, self->postquote); + CLEAR_OBJECT(CURLOPT_PREQUOTE, self->prequote); + CLEAR_OBJECT(CURLOPT_TELNETOPTIONS, self->telnetoptions); +#ifdef HAVE_CURLOPT_RESOLVE + CLEAR_OBJECT(CURLOPT_RESOLVE, self->resolve); +#endif +#ifdef HAVE_CURL_7_20_0_OPTS + CLEAR_OBJECT(CURLOPT_MAIL_RCPT, self->mail_rcpt); +#endif +#ifdef HAVE_CURLOPT_CONNECT_TO + CLEAR_OBJECT(CURLOPT_CONNECT_TO, self->connect_to); +#endif + /* FIXME: what about data->set.httpreq ?? */ + CLEAR_OBJECT(CURLOPT_HTTPPOST, self->httppost); + CLEAR_CALLBACK(CURLOPT_OPENSOCKETFUNCTION, CURLOPT_OPENSOCKETDATA, self->opensocket_cb); #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 21, 7) CLEAR_CALLBACK(CURLOPT_CLOSESOCKETFUNCTION, CURLOPT_CLOSESOCKETDATA, self->closesocket_cb); @@ -298,6 +314,10 @@ case CURLOPT_PROXY_SSLKEY: case CURLOPT_PROXY_SSLKEYTYPE: #endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 61, 0) + case CURLOPT_TLS13_CIPHERS: + case CURLOPT_PROXY_TLS13_CIPHERS: +#endif #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 62, 0) case CURLOPT_DOH_URL: #endif @@ -690,16 +710,9 @@ CURLERROR_SET_RETVAL(); goto error; } - /* Finally, free previously allocated httppost, ZAP any - * buffer references, and update */ - curl_formfree(self->httppost); - util_curl_xdecref(self, PYCURL_MEMGROUP_HTTPPOST, self->handle); - self->httppost = post; - - /* The previous list of INCed references was ZAPed above; save - * the new one so that we can clean it up on the next - * self->httppost free. */ - self->httppost_ref_list = ref_params; + /* Finally, decref previous httppost object and replace it with a + * new one. */ + util_curlhttppost_update(self, post, ref_params); Py_RETURN_NONE; @@ -713,48 +726,48 @@ static PyObject * do_curl_setopt_list(CurlObject *self, int option, int which, PyObject *obj) { - struct curl_slist **old_slist = NULL; + CurlSlistObject **old_slist_obj = NULL; struct curl_slist *slist = NULL; Py_ssize_t len; int res; switch (option) { case CURLOPT_HTTP200ALIASES: - old_slist = &self->http200aliases; + old_slist_obj = &self->http200aliases; break; case CURLOPT_HTTPHEADER: - old_slist = &self->httpheader; + old_slist_obj = &self->httpheader; break; #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) case CURLOPT_PROXYHEADER: - old_slist = &self->proxyheader; + old_slist_obj = &self->proxyheader; break; #endif case CURLOPT_POSTQUOTE: - old_slist = &self->postquote; + old_slist_obj = &self->postquote; break; case CURLOPT_PREQUOTE: - old_slist = &self->prequote; + old_slist_obj = &self->prequote; break; case CURLOPT_QUOTE: - old_slist = &self->quote; + old_slist_obj = &self->quote; break; case CURLOPT_TELNETOPTIONS: - old_slist = &self->telnetoptions; + old_slist_obj = &self->telnetoptions; break; #ifdef HAVE_CURLOPT_RESOLVE case CURLOPT_RESOLVE: - old_slist = &self->resolve; + old_slist_obj = &self->resolve; break; #endif #ifdef HAVE_CURL_7_20_0_OPTS case CURLOPT_MAIL_RCPT: - old_slist = &self->mail_rcpt; + old_slist_obj = &self->mail_rcpt; break; #endif #ifdef HAVE_CURLOPT_CONNECT_TO case CURLOPT_CONNECT_TO: - old_slist = &self->connect_to; + old_slist_obj = &self->connect_to; break; #endif default: @@ -768,7 +781,7 @@ Py_RETURN_NONE; /* Just to be sure we do not bug off here */ - assert(old_slist != NULL && slist == NULL); + assert(old_slist_obj != NULL && slist == NULL); /* Handle regular list operations on the other options */ slist = pycurl_list_or_tuple_to_slist(which, obj, len); @@ -781,9 +794,9 @@ curl_slist_free_all(slist); CURLERROR_RETVAL(); } - /* Finally, free previously allocated list and update */ - curl_slist_free_all(*old_slist); - *old_slist = slist; + /* Finally, decref previous slist object and replace it with a + * new one. */ + util_curlslist_update(old_slist_obj, slist); Py_RETURN_NONE; }
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/easyperform.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/easyperform.c
Changed
@@ -100,7 +100,7 @@ #ifdef WITH_THREAD /* Save handle to current thread (used as context for python callbacks) */ saved_state = self->state; - PYCURL_BEGIN_ALLOW_THREADS + PYCURL_BEGIN_ALLOW_THREADS_EASY /* We must allow threads here because unpausing a handle can cause some of its callbacks to be invoked immediately, from inside @@ -110,7 +110,7 @@ res = curl_easy_pause(self->handle, bitmask); #ifdef WITH_THREAD - PYCURL_END_ALLOW_THREADS + PYCURL_END_ALLOW_THREADS_EASY /* Restore the thread-state to whatever it was on entry */ self->state = saved_state;
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/module.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/module.c
Changed
@@ -28,6 +28,8 @@ /* Type objects */ PYCURL_INTERNAL PyObject *ErrorObject = NULL; PYCURL_INTERNAL PyTypeObject *p_Curl_Type = NULL; +PYCURL_INTERNAL PyTypeObject *p_CurlSlist_Type = NULL; +PYCURL_INTERNAL PyTypeObject *p_CurlHttppost_Type = NULL; PYCURL_INTERNAL PyTypeObject *p_CurlMulti_Type = NULL; PYCURL_INTERNAL PyTypeObject *p_CurlShare_Type = NULL; #ifdef HAVE_CURL_7_19_6_OPTS @@ -374,6 +376,11 @@ case CURLSSLBACKEND_NSS: case CURLSSLBACKEND_WOLFSSL: case CURLSSLBACKEND_MBEDTLS: +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 64, 1) + case CURLSSLBACKEND_SECURETRANSPORT: +#else + case CURLSSLBACKEND_DARWINSSL: +#endif runtime_supported_backend_found = 1; break; default: @@ -404,6 +411,8 @@ runtime_ssl_lib = "nss"; } else if (!strncmp(vi->ssl_version, "mbedTLS/", 8)) { runtime_ssl_lib = "mbedtls"; + } else if (!strncmp(vi->ssl_version, "Secure Transport", 16)) { + runtime_ssl_lib = "secure-transport"; } else { runtime_ssl_lib = "none/other"; } @@ -416,9 +425,13 @@ /* Initialize the type of the new type objects here; doing it here * is required for portability to Windows without requiring C++. */ p_Curl_Type = &Curl_Type; + p_CurlSlist_Type = &CurlSlist_Type; + p_CurlHttppost_Type = &CurlHttppost_Type; p_CurlMulti_Type = &CurlMulti_Type; p_CurlShare_Type = &CurlShare_Type; Py_SET_TYPE(&Curl_Type, &PyType_Type); + Py_SET_TYPE(&CurlSlist_Type, &PyType_Type); + Py_SET_TYPE(&CurlHttppost_Type, &PyType_Type); Py_SET_TYPE(&CurlMulti_Type, &PyType_Type); Py_SET_TYPE(&CurlShare_Type, &PyType_Type); @@ -426,12 +439,19 @@ if (PyType_Ready(&Curl_Type) < 0) goto error; + if (PyType_Ready(&CurlSlist_Type) < 0) + goto error; + + if (PyType_Ready(&CurlHttppost_Type) < 0) + goto error; + if (PyType_Ready(&CurlMulti_Type) < 0) goto error; if (PyType_Ready(&CurlShare_Type) < 0) goto error; + #if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&curlmodule); if (m == NULL) @@ -1057,9 +1077,19 @@ #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 45, 0) insint_c(d, "DEFAULT_PROTOCOL", CURLOPT_DEFAULT_PROTOCOL); #endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 61, 0) + insint_c(d, "TLS13_CIPHERS", CURLOPT_TLS13_CIPHERS); + insint_c(d, "PROXY_TLS13_CIPHERS", CURLOPT_PROXY_TLS13_CIPHERS); +#endif #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 62, 0) insint_c(d, "DOH_URL", CURLOPT_DOH_URL); #endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 64, 0) + insint_c(d, "HTTP09_ALLOWED", CURLOPT_HTTP09_ALLOWED); +#endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 80, 0) + insint_c(d, "MAXLIFETIME_CONN", CURLOPT_MAXLIFETIME_CONN); +#endif insint_m(d, "M_TIMERFUNCTION", CURLMOPT_TIMERFUNCTION); insint_m(d, "M_SOCKETFUNCTION", CURLMOPT_SOCKETFUNCTION); @@ -1106,6 +1136,9 @@ insint_c(d, "CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE", CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); insint_c(d, "TCP_FASTOPEN", CURLOPT_TCP_FASTOPEN); #endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 66, 0) + insint_c(d, "CURL_HTTP_VERSION_3", CURL_HTTP_VERSION_3); +#endif insint_c(d, "CURL_HTTP_VERSION_LAST", CURL_HTTP_VERSION_LAST); /* CURL_NETRC_OPTION: constants for setopt(NETRC, x) */ @@ -1430,6 +1463,9 @@ #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 57, 0) insint_s(d, "LOCK_DATA_CONNECT", CURL_LOCK_DATA_CONNECT); #endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 61, 0) + insint_s(d, "LOCK_DATA_PSL", CURL_LOCK_DATA_PSL); +#endif /* Initialize callback locks if ssl is enabled */ #if defined(PYCURL_NEED_SSL_TSL)
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/multi.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/multi.c
Changed
@@ -11,7 +11,7 @@ assert_multi_state(const CurlMultiObject *self) { assert(self != NULL); - assert(Py_TYPE(self) == p_CurlMulti_Type); + assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_CurlMulti_Type) == 1); #ifdef WITH_THREAD if (self->state != NULL) { assert(self->multi_handle != NULL); @@ -51,12 +51,12 @@ CurlMultiObject *self; int *ptr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", empty_keywords)) { + if (subtype == p_CurlMulti_Type && !PyArg_ParseTupleAndKeywords(args, kwds, "", empty_keywords)) { return NULL; } /* Allocate python curl-multi object */ - self = (CurlMultiObject *) p_CurlMulti_Type->tp_alloc(p_CurlMulti_Type, 0); + self = (CurlMultiObject *) subtype->tp_alloc(subtype, 0); if (!self) { return NULL; } @@ -94,11 +94,11 @@ if (self->multi_handle != NULL) { CURLM *multi_handle = self->multi_handle; - self->multi_handle = NULL; /* Allow threads because callbacks can be invoked */ PYCURL_BEGIN_ALLOW_THREADS curl_multi_cleanup(multi_handle); PYCURL_END_ALLOW_THREADS + self->multi_handle = NULL; } } @@ -117,7 +117,7 @@ do_multi_dealloc(CurlMultiObject *self) { PyObject_GC_UnTrack(self); - Py_TRASHCAN_SAFE_BEGIN(self); + CPy_TRASHCAN_BEGIN(self, do_multi_dealloc); util_multi_xdecref(self); util_multi_close(self); @@ -127,7 +127,7 @@ } CurlMulti_Type.tp_free(self); - Py_TRASHCAN_SAFE_END(self); + CPy_TRASHCAN_END(self); } @@ -183,8 +183,12 @@ /* acquire thread */ self = (CurlMultiObject *)userp; - if (!PYCURL_ACQUIRE_THREAD_MULTI()) + if (!PYCURL_ACQUIRE_THREAD_MULTI()) { + PyGILState_STATE tmp_warn_state = PyGILState_Ensure(); + PyErr_WarnEx(PyExc_RuntimeWarning, "multi_socket_callback failed to acquire thread", 1); + PyGILState_Release(tmp_warn_state); return 0; + } /* check args */ if (self->s_cb == NULL) @@ -232,8 +236,12 @@ /* acquire thread */ self = (CurlMultiObject *)userp; - if (!PYCURL_ACQUIRE_THREAD_MULTI()) + if (!PYCURL_ACQUIRE_THREAD_MULTI()) { + PyGILState_STATE tmp_warn_state = PyGILState_Ensure(); + PyErr_WarnEx(PyExc_RuntimeWarning, "multi_timer_callback failed to acquire thread", 1); + PyGILState_Release(tmp_warn_state); return ret; + } /* check args */ if (self->t_cb == NULL) @@ -407,6 +415,34 @@ static PyObject * +do_multi_setopt_none(CurlMultiObject *self, int option, PyObject *obj) +{ + switch(option) { +#ifdef HAVE_CURL_7_30_0_PIPELINE_OPTS + case CURLMOPT_PIPELINING_SITE_BL: + case CURLMOPT_PIPELINING_SERVER_BL: + curl_multi_setopt(self->multi_handle, option, NULL); + break; +#endif + case CURLMOPT_SOCKETFUNCTION: + curl_multi_setopt(self->multi_handle, CURLMOPT_SOCKETFUNCTION, NULL); + curl_multi_setopt(self->multi_handle, CURLMOPT_SOCKETDATA, NULL); + Py_CLEAR(self->s_cb); + break; + case CURLMOPT_TIMERFUNCTION: + curl_multi_setopt(self->multi_handle, CURLMOPT_TIMERFUNCTION, NULL); + curl_multi_setopt(self->multi_handle, CURLMOPT_TIMERDATA, NULL); + Py_CLEAR(self->t_cb); + break; + default: + PyErr_SetString(PyExc_TypeError, "unsetting is not supported for this option"); + return NULL; + } + Py_RETURN_NONE; +} + + +static PyObject * do_multi_setopt(CurlMultiObject *self, PyObject *args) { int option, which; @@ -425,6 +461,11 @@ if (option % 10000 >= MOPTIONS_SIZE) goto error; + /* Handle unsetting of options */ + if (obj == Py_None) { + return do_multi_setopt_none(self, option, obj); + } + /* Handle the case of integer arguments */ if (PyInt_Check(obj)) { return do_multi_setopt_int(self, option, obj); @@ -797,7 +838,7 @@ Py_DECREF(ok_list); CURLERROR_MSG("Unable to fetch curl handle from curl object"); } - assert(Py_TYPE(co) == p_Curl_Type); + assert(PyObject_IsInstance((PyObject *) co, (PyObject *) p_Curl_Type) == 1); if (msg->msg != CURLMSG_DONE) { /* FIXME: what does this mean ??? */ }
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/pycurl.h -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/pycurl.h
Changed
@@ -220,6 +220,9 @@ # define PYCURL_NEED_MBEDTLS_TSL # define COMPILE_SSL_LIB "mbedtls" # define COMPILE_SUPPORTED_SSL_BACKEND_FOUND 1 +# elif defined(HAVE_CURL_SECTRANSP) +# define COMPILE_SSL_LIB "secure-transport" +# define COMPILE_SUPPORTED_SSL_BACKEND_FOUND 1 # else # ifdef _MSC_VER /* sigh */ @@ -237,7 +240,7 @@ * no reason to require users match those */ # define COMPILE_SSL_LIB "none/other" # define COMPILE_SUPPORTED_SSL_BACKEND_FOUND 0 -# endif /* HAVE_CURL_OPENSSL || HAVE_CURL_WOLFSSL || HAVE_CURL_GNUTLS || HAVE_CURL_NSS || HAVE_CURL_MBEDTLS */ +# endif /* HAVE_CURL_OPENSSL || HAVE_CURL_WOLFSSL || HAVE_CURL_GNUTLS || HAVE_CURL_NSS || HAVE_CURL_MBEDTLS || HAVE_CURL_SECTRANSP */ #else # define COMPILE_SSL_LIB "none/other" # define COMPILE_SUPPORTED_SSL_BACKEND_FOUND 0 @@ -263,6 +266,19 @@ # define PYCURL_END_ALLOW_THREADS \ Py_END_ALLOW_THREADS \ self->state = NULL; +# define PYCURL_BEGIN_ALLOW_THREADS_EASY \ + if (self->multi_stack == NULL) { \ + self->state = PyThreadState_Get(); \ + assert(self->state != NULL); \ + } else { \ + self->multi_stack->state = PyThreadState_Get(); \ + assert(self->multi_stack->state != NULL); \ + } \ + Py_BEGIN_ALLOW_THREADS +# define PYCURL_END_ALLOW_THREADS_EASY \ + PYCURL_END_ALLOW_THREADS \ + if (self->multi_stack != NULL) \ + self->multi_stack->state = NULL; #else # define PYCURL_DECLARE_THREAD_STATE # define PYCURL_ACQUIRE_THREAD() (1) @@ -318,6 +334,10 @@ PYCURL_INTERNAL PyObject * PyText_FromString_Ignore(const char *string); +/* Py_NewRef and Py_XNewRef - not part of Python's C API before 3.10 */ +static inline PyObject* my_Py_NewRef(PyObject *obj) { Py_INCREF(obj); return obj; } +static inline PyObject* my_Py_XNewRef(PyObject *obj) { Py_XINCREF(obj); return obj; } + struct CurlObject; PYCURL_INTERNAL void @@ -371,16 +391,30 @@ #define PYCURL_MEMGROUP_POSTFIELDS 64 /* CA certs object */ #define PYCURL_MEMGROUP_CACERTS 128 +/* Curl slist objects */ +#define PYCURL_MEMGROUP_SLIST 256 #define PYCURL_MEMGROUP_EASY \ (PYCURL_MEMGROUP_CALLBACK | PYCURL_MEMGROUP_FILE | \ PYCURL_MEMGROUP_HTTPPOST | PYCURL_MEMGROUP_POSTFIELDS | \ - PYCURL_MEMGROUP_CACERTS) + PYCURL_MEMGROUP_CACERTS | PYCURL_MEMGROUP_SLIST) #define PYCURL_MEMGROUP_ALL \ (PYCURL_MEMGROUP_ATTRDICT | PYCURL_MEMGROUP_EASY | \ PYCURL_MEMGROUP_MULTI | PYCURL_MEMGROUP_SHARE) +typedef struct CurlSlistObject { + PyObject_HEAD + struct curl_slist *slist; +} CurlSlistObject; + +typedef struct CurlHttppostObject { + PyObject_HEAD + struct curl_httppost *httppost; + /* List of INC'ed references associated with httppost. */ + PyObject *reflist; +} CurlHttppostObject; + typedef struct CurlObject { PyObject_HEAD PyObject *dict; /* Python attributes dictionary */ @@ -392,26 +426,24 @@ #endif struct CurlMultiObject *multi_stack; struct CurlShareObject *share; - struct curl_httppost *httppost; - /* List of INC'ed references associated with httppost. */ - PyObject *httppost_ref_list; - struct curl_slist *httpheader; + struct CurlHttppostObject *httppost; + struct CurlSlistObject *httpheader; #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 37, 0) - struct curl_slist *proxyheader; + struct CurlSlistObject *proxyheader; #endif - struct curl_slist *http200aliases; - struct curl_slist *quote; - struct curl_slist *postquote; - struct curl_slist *prequote; - struct curl_slist *telnetoptions; + struct CurlSlistObject *http200aliases; + struct CurlSlistObject *quote; + struct CurlSlistObject *postquote; + struct CurlSlistObject *prequote; + struct CurlSlistObject *telnetoptions; #ifdef HAVE_CURLOPT_RESOLVE - struct curl_slist *resolve; + struct CurlSlistObject *resolve; #endif #ifdef HAVE_CURL_7_20_0_OPTS - struct curl_slist *mail_rcpt; + struct CurlSlistObject *mail_rcpt; #endif #ifdef HAVE_CURLOPT_CONNECT_TO - struct curl_slist *connect_to; + struct CurlSlistObject *connect_to; #endif /* callbacks */ PyObject *w_cb; @@ -558,6 +590,11 @@ PYCURL_INTERNAL PyObject * do_curl_setopt_filelike(CurlObject *self, int option, PyObject *obj); +PYCURL_INTERNAL void +util_curlslist_update(CurlSlistObject **old, struct curl_slist *slist); +PYCURL_INTERNAL void +util_curlhttppost_update(CurlObject *obj, struct curl_httppost *httppost, PyObject *reflist); + PYCURL_INTERNAL PyObject * do_curl_getinfo_raw(CurlObject *self, PyObject *args); #if PY_MAJOR_VERSION >= 3 @@ -619,11 +656,15 @@ #if !defined(PYCURL_SINGLE_FILE) /* Type objects */ extern PyTypeObject Curl_Type; +extern PyTypeObject CurlSlist_Type; +extern PyTypeObject CurlHttppost_Type; extern PyTypeObject CurlMulti_Type; extern PyTypeObject CurlShare_Type; extern PyObject *ErrorObject; extern PyTypeObject *p_Curl_Type; +extern PyTypeObject *p_CurlSlist_Type; +extern PyTypeObject *p_CurlHttppost_Type; extern PyTypeObject *p_CurlMulti_Type; extern PyTypeObject *p_CurlShare_Type; extern PyObject *khkey_type; @@ -647,9 +688,17 @@ #endif /* !PYCURL_SINGLE_FILE */ #if PY_MAJOR_VERSION >= 3 -# define PYCURL_TYPE_FLAGS Py_TPFLAGS_HAVE_GC +# define PYCURL_TYPE_FLAGS Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE +#else +# define PYCURL_TYPE_FLAGS Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_WEAKREFS | Py_TPFLAGS_BASETYPE +#endif + +#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8 +# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc) +# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END #else -# define PYCURL_TYPE_FLAGS Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_WEAKREFS +# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_SAFE_BEGIN(op) +# define CPy_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op) #endif /* vi:ts=4:et:nowrap
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/share.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/share.c
Changed
@@ -11,7 +11,7 @@ assert_share_state(const CurlShareObject *self) { assert(self != NULL); - assert(Py_TYPE(self) == p_CurlShare_Type); + assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_CurlShare_Type) == 1); #ifdef WITH_THREAD assert(self->lock != NULL); #endif @@ -38,7 +38,7 @@ #endif int *ptr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", empty_keywords)) { + if (subtype == p_CurlShare_Type && !PyArg_ParseTupleAndKeywords(args, kwds, "", empty_keywords)) { return NULL; } @@ -119,7 +119,7 @@ do_share_dealloc(CurlShareObject *self) { PyObject_GC_UnTrack(self); - Py_TRASHCAN_SAFE_BEGIN(self); + CPy_TRASHCAN_BEGIN(self, do_share_dealloc); Py_CLEAR(self->dict); util_share_close(self); @@ -133,7 +133,7 @@ } CurlShare_Type.tp_free(self); - Py_TRASHCAN_SAFE_END(self); + CPy_TRASHCAN_END(self); } @@ -187,6 +187,9 @@ #if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 57, 0) case CURL_LOCK_DATA_CONNECT: #endif +#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 61, 0) + case CURL_LOCK_DATA_PSL: +#endif break; default: goto error;
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/src/threadsupport.c -> _service:tar_scm:pycurl-7.45.2.tar.gz/src/threadsupport.c
Changed
@@ -13,7 +13,7 @@ */ if (self == NULL) return NULL; - assert(Py_TYPE(self) == p_Curl_Type); + assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_Curl_Type) == 1); if (self->state != NULL) { /* inside perform() */ @@ -43,7 +43,7 @@ */ if (self == NULL) return NULL; - assert(Py_TYPE(self) == p_CurlMulti_Type); + assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_CurlMulti_Type) == 1); if (self->state != NULL) { /* inside multi_perform() */
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/app.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/app.py
Changed
@@ -30,6 +30,7 @@ def not_found(): return bottle.HTTPResponse('not found', 404) +@app.route('/postfields', method='get') @app.route('/postfields', method='post') def postfields(): return json.dumps(dict(bottle.request.forms)) @@ -88,7 +89,7 @@ # Thanks to bdarnell for the idea: https://github.com/pycurl/pycurl/issues/124 @app.route('/header_utf8') def header_utf8(): - header_value = bottle.request.headersbottle.request.query'h' + header_value = bottle.request.headers.get(bottle.request.query'h', '' if py3 else b'') if py3: # header_value is a string, headers are decoded in latin1 header_value = header_value.encode('latin1').decode('utf8')
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/certs/ca.crt -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/certs/ca.crt
Changed
@@ -1,8 +1,8 @@ -----BEGIN CERTIFICATE----- -MIIEMTCCAxmgAwIBAgIUFrIR/j704ZfessaZ6fpA3BE0HNEwDQYJKoZIhvcNAQEL +MIIDwzCCAqugAwIBAgIUSxsCNrFED1qO/AQe5iz0sFzgdRowDQYJKoZIhvcNAQEL BQAwZjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxGjAYBgNVBAoM EVB5Y1VSTCB0ZXN0IHN1aXRlMRIwEAYDVQQLDAlsb2NhbGhvc3QxEjAQBgNVBAMM -CWxvY2FsaG9zdDAeFw0yMDA4MTMxNzI1MTRaFw00NzEyMzAxNzI1MTRaMGYxCzAJ +CWxvY2FsaG9zdDAeFw0yMjA1MDYxNTI5MDVaFw00OTA5MjExNTI5MDVaMGYxCzAJ BgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMRowGAYDVQQKDBFQeWNVUkwg dGVzdCBzdWl0ZTESMBAGA1UECwwJbG9jYWxob3N0MRIwEAYDVQQDDAlsb2NhbGhv c3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtrtJgPWnNZCHEmvJg @@ -11,15 +11,13 @@ uSfg4BVEW+lGs2FGCLElRWmrOPPMQsyP5llwuVhaRQ5QN8wQgkd5n2wXF2tsQ2dO YmJ5fVDjs0P0f0TNCWhS9zxd/orV7UqWIiGWiZt2jdEsAZTNmVaUbZaisXNfXrUT aFjYUcUh31K6xYc0nEqyY5R6s2/StZh7Png47BdaH/Y4pw1XWErUgUqQQdQ/tQwu -G8BTAgMBAAGjgdYwgdMwHQYDVR0OBBYEFC7U1Afby9PQYRB7dkgUzZH9mkbBMIGj -BgNVHSMEgZswgZiAFC7U1Afby9PQYRB7dkgUzZH9mkbBoWqkaDBmMQswCQYDVQQG -EwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEaMBgGA1UECgwRUHljVVJMIHRlc3Qg -c3VpdGUxEjAQBgNVBAsMCWxvY2FsaG9zdDESMBAGA1UEAwwJbG9jYWxob3N0ghQW -shH+PvThl96yxpnp+kDcETQc0TAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUA -A4IBAQAX3ENYqtAZLRz0p/EzRpIia+8fgwAjQrg9ucMX/UMVXHaUq/cgTPR2YhUn -aIwhANqdZnSQ2nUHlDgCmUQmH2hLKhkR7PVOMuYDAQmPusII4iUdmwGFLPTudxRV -fMKE8VBDKrRNSvWIS6Y9ucJi04jE705+wjUzB5eylP0R5kj7qt9VmPFYGgGb+jLz -hNHmaI7NVC6cIhafMWcbI2uGdpPlGDK79HVtR53EtmCDlIVZ/DfIsVQ3KA0SwdD5 -TzqIM/V2vCKEsGbFMgVc5S4RLK5mu0/wTP3Y/PSy9zTz/z1l5BMEvbBxNhu3uqAi -kBlHhSUHg81tR609TkQ/zl9ehe33 +G8BTAgMBAAGjaTBnMB0GA1UdDgQWBBQu1NQH28vT0GEQe3ZIFM2R/ZpGwTAfBgNV +HSMEGDAWgBQu1NQH28vT0GEQe3ZIFM2R/ZpGwTAPBgNVHRMBAf8EBTADAQH/MBQG +A1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOCAQEAQOYupzgDcLn3 +dT7lPXDrWSWFQQoNGDD3suu3UPIHuLIBTghADOTgAW9QxmcB5z7EWXj8TLRssAZ7 +6bwPR1g466IgDpR7U+q9YIyBVW98MgYyaSX6TuRyrRxEugH5mzIKQ7Ed9qYiJrVA +5npHkQOXdlcdsjLsjD/itfbk/M13GuCMkixXM3RGcruUbd143aKFGVvGPhl31L14 +AOjQsbC1OQQ6rPsA5FObSqLjm6L+cq53PqOaRIiTRdiaKD2Xj8hXWrs5zivx60qM +GQkUnTfyPuQ7EXf7jQrjwrCYN8lk+KbuE9FKKS89b6ZyfK7iZp6AR3IdYRAVo1FE +H7ZnvduIZQ== -----END CERTIFICATE-----
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/certs/server.crt -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/certs/server.crt
Changed
@@ -1,20 +1,21 @@ -----BEGIN CERTIFICATE----- -MIIDPzCCAicCFERGPoslPJ3jHZfE8sJaHNmaFqfcMA0GCSqGSIb3DQEBCwUAMGYx -CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMRowGAYDVQQKDBFQeWNV -UkwgdGVzdCBzdWl0ZTESMBAGA1UECwwJbG9jYWxob3N0MRIwEAYDVQQDDAlsb2Nh -bGhvc3QwHhcNMjAwODEzMTc0MTI2WhcNNDcxMjMwMTc0MTI2WjBSMQswCQYDVQQG -EwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEaMBgGA1UECgwRUHljVVJMIHRlc3Qg -c3VpdGUxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAOYnLv7lONDJDKbYYhIcVfWNRdqfGk+hFpPHVi8RfD49g90WKdSv -hmIrPCtfoeXVZvSgh+tXuDZRiuczuoRq0uOM4pkNMXyQanlDn5AFthBNnDbc4DXb -6lBXIdUbJZB+YXpiMQvQsmO0XFMD9nZ8CeeZutkxF34TcDE1YE4yCZIgpttLX1VG -8OVFJomXeavrfQ8fjrRpDfOfmuM4I7YgCl5IxOAVyhFPGHNhpE8M/fJnk7UZ7iuB -08Qca87/b0hvlGacL2AwWfwAdz2JcxVdmtKMhd03+PMqbUNYD7XlHJiKw+89VLv9 -lZGLJEO92lNRlJ06su5HzQSEycLpiKvDHBECAwEAATANBgkqhkiG9w0BAQsFAAOC -AQEAboEGBE+LJhRBMXtcxGbewEK6KByid7VR3/j+e2jSQiy9l8UTrKDx+hinwIPp -g/qNbVJC/aqa1kuaQrF8fHidM8t1A1brCjsZ+sEfc3q1K0jPZEzvSabRWznM21L+ -eZYnmINMrq4vlSjh5Oz1QGdoImjq+o4qWokOt8p38FYBMKgrMLBbW6N+olU8htuu -x1o9y6CscwkFrhGvENe6nCrE9QTVEH0Ka1BMFOwfCUIztgz5YWgvJpSzw+2l6lo0 -4lh8olZ09Fzu+VcjUU9t0yiFFh1qwKTLWJA7NJMWOtEwTbfx/K+5m2Xiuzp6BPM5 -DcPA3/hx8YLKkxA570MOszh6Dg== +MIIDXjCCAkagAwIBAgIUGSiMniv/FqlCAJXut6b+TJx1gzYwDQYJKoZIhvcNAQEL +BQAwZjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxGjAYBgNVBAoM +EVB5Y1VSTCB0ZXN0IHN1aXRlMRIwEAYDVQQLDAlsb2NhbGhvc3QxEjAQBgNVBAMM +CWxvY2FsaG9zdDAeFw0yMjA1MDYyMTU4NTJaFw00OTA5MjEyMTU4NTJaMFIxCzAJ +BgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMRowGAYDVQQKDBFQeWNVUkwg +dGVzdCBzdWl0ZTESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA5icu/uU40MkMpthiEhxV9Y1F2p8aT6EWk8dWLxF8Pj2D +3RYp1K+GYis8K1+h5dVm9KCH61e4NlGK5zO6hGrS44zimQ0xfJBqeUOfkAW2EE2c +NtzgNdvqUFch1RslkH5hemIxC9CyY7RcUwP2dnwJ55m62TEXfhNwMTVgTjIJkiCm +20tfVUbw5UUmiZd5q+t9Dx+OtGkN85+a4zgjtiAKXkjE4BXKEU8Yc2GkTwz98meT +tRnuK4HTxBxrzv9vSG+UZpwvYDBZ/AB3PYlzFV2a0oyF3Tf48yptQ1gPteUcmIrD +7z1Uu/2VkYskQ73aU1GUnTqy7kfNBITJwumIq8McEQIDAQABoxgwFjAUBgNVHREE +DTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEBAC0y9o5FUCzpSEqBK7Ns +1FiAR/cNS6MKmpCKjN4sNvALSThCTdDB4QVBEOe+eTZP/q105oyf8boSktCG/3MO +B6Jwdo5AnBHiE2QGfacMluUkuYRGf1XqWl9oa1AeuqCS+ilGk485akiI0A/z6ZRz +ynGvk/9bqYYhqIPV2ioxFdHaXNlNKT36BV1NFrW3ebZSa3w7nHIrEakZuVmc67vH +dCuxHf8l2Bya/xT1yktq4MaiFzUY9ZZLSnpWPuGzXnika0IeREF7rm9ubozq8mSq +JyTC0KAZvwt7BmbEO98NcfL8gtYAVqDBR/t6gW4TSxKGc0PB3j/+73Nj5hGBasxd +2cc= -----END CERTIFICATE-----
View file
_service:tar_scm:pycurl-7.45.2.tar.gz/tests/duphandle_test.py
Added
@@ -0,0 +1,144 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vi:ts=4:et + +from . import localhost +import pycurl +import unittest +import gc +import weakref +try: + import json +except ImportError: + import simplejson as json + +from . import appmanager +from . import util + +setup_module, teardown_module = appmanager.setup(('app', 8380)) + +class DuphandleTest(unittest.TestCase): + def setUp(self): + self.orig = util.DefaultCurl() + + def test_duphandle_attribute_dict(self): + self.orig.orig_attr = 'orig-value' + # attribute dict should be copied - the *object*, not the reference + dup = self.orig.duphandle() + assert dup.orig_attr == 'orig-value' + # cloned dict should be a separate object + dup.dup_attr = 'dup-value' + try: + self.orig.dup_attr == 'does not exist' + except AttributeError as error: + assert 'trying to obtain a non-existing attribute: dup_attr' in str(error.args) + else: + self.fail('should have raised AttributeError') + # dealloc self.orig - original dict is freed from memory + self.orig.close() + del self.orig + # cloned dict should still exist + assert dup.orig_attr == 'orig-value' + assert dup.dup_attr == 'dup-value' + dup.close() + + def slist_check(self, handle, value, persistance=True): + body = util.BytesIO() + handle.setopt(pycurl.WRITEFUNCTION, body.write) + handle.setopt(pycurl.URL, 'http://%s:8380/header_utf8?h=x-test-header' % localhost) + handle.perform() + result = body.getvalue().decode('utf-8') + assert (result == value) == persistance + + def slist_test(self, clear_func, *args): + # new slist object is created with ref count = 1 + self.orig.setopt(pycurl.HTTPHEADER, 'x-test-header: orig-slist') + # ref is copied and object incref'ed + dup1 = self.orig.duphandle() + # slist object is decref'ed and ref set to null + clear_func(*args) + # null ref is copied - no effect + dup2 = self.orig.duphandle() + # check slist object persistance + self.slist_check(dup1, 'orig-slist', True) + self.slist_check(dup2, 'orig-slist', False) + # check overwriting - orig slist is decref'ed to 0 and finally deallocated + # util_curlslist_update() and util_curlslist_dealloc() + dup1.setopt(pycurl.HTTPHEADER, 'x-test-header: dup-slist') + self.slist_check(dup1, 'dup-slist', True) + # cleanup + dup1.close() + dup2.close() + self.orig.close() + + def test_duphandle_slist_xdecref(self): + # util_curl_xdecref() + self.slist_test(self.orig.reset) + + def test_duphandle_slist_unsetopt(self): + # util_curl_unsetopt() + self.slist_test(self.orig.unsetopt, pycurl.HTTPHEADER) + + def httppost_check(self, handle, value, persistance=True): + body = util.BytesIO() + handle.setopt(pycurl.WRITEFUNCTION, body.write) + handle.setopt(pycurl.URL, 'http://%s:8380/postfields' % localhost) + handle.perform() + result = json.loads(body.getvalue()) + assert (result == value) == persistance + + def httppost_test(self, clear_func, *args): + self.orig.setopt(pycurl.HTTPPOST, + ('field', (pycurl.FORM_CONTENTS, 'orig-httppost')), + ) + dup1 = self.orig.duphandle() + clear_func(*args) + dup2 = self.orig.duphandle() + self.httppost_check(dup1, {'field': 'orig-httppost'}, True) + self.httppost_check(dup2, {'field': 'orig-httppost'}, False) + # util_curlhttppost_update() and util_curlhttppost_dealloc() + dup1.setopt(pycurl.HTTPPOST, + ('field', (pycurl.FORM_CONTENTS, 'dup-httppost')), + ) + self.httppost_check(dup1, {'field': 'dup-httppost'}, True) + dup1.close() + dup2.close() + self.orig.close() + + def test_duphandle_httppost_xdecref(self): + # util_curl_xdecref() + self.httppost_test(self.orig.reset) + + def test_duphandle_httppost_unsetopt(self): + # util_curl_unsetopt() + self.httppost_test(self.orig.unsetopt, pycurl.HTTPPOST) + + def test_duphandle_references(self): + body = util.BytesIO() + def callback(data): + body.write(data) + callback_ref = weakref.ref(callback) + # preliminary checks of gc and weakref working as expected + assert gc.get_referrers(callback) == + assert callback_ref() is not None + # setopt - callback ref is copied and callback incref'ed + self.orig.setopt(pycurl.WRITEFUNCTION, callback) + assert gc.get_referrers(callback) == self.orig + # duphandle - callback ref is copied and callback incref'ed + dup = self.orig.duphandle() + assert set(gc.get_referrers(callback)) == {self.orig, dup} + # dealloc self.orig and decref callback + self.orig.close() + del self.orig + assert gc.get_referrers(callback) == dup + # decref callback again - back to ref count = 1 + del callback + assert callback_ref() is not None + # check that callback object still exists and is invoked + dup.setopt(pycurl.URL, 'http://%s:8380/success' % localhost) + dup.perform() + result = body.getvalue().decode('utf-8') + assert result == 'success' + # final decref - callback is deallocated + dup.close() + assert callback_ref() is None
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/error_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/error_test.py
Changed
@@ -29,7 +29,8 @@ err, msg = exc.args self.assertEqual(pycurl.E_URL_MALFORMAT, err) # possibly fragile - self.assertEqual('No URL set!', msg) + # curl < 7.83.0 has an exclamation mark in this error message + self.assertIn(msg, 'No URL set!', 'No URL set') else: self.fail('Expected pycurl.error to be raised') @@ -43,9 +44,10 @@ self.curl.perform() except pycurl.error: # might be fragile - self.assertEqual('No URL set!', self.curl.errstr()) + # curl < 7.83.0 has an exclamation mark in this error message + self.assertIn(self.curl.errstr(), 'No URL set!', 'No URL set') # repeated checks do not clear value - self.assertEqual('No URL set!', self.curl.errstr()) + self.assertIn(self.curl.errstr(), 'No URL set!', 'No URL set') # check the type - on all python versions self.assertEqual(str, type(self.curl.errstr())) else:
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/fake-curl/libcurl/Makefile -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/fake-curl/libcurl/Makefile
Changed
@@ -13,10 +13,16 @@ CC = `curl-config --cc` CFLAGS += `curl-config --cflags` +UNAME := $(shell uname -s) +ifeq ($(UNAME),Darwin) + SONAME_FLAG = -install_name +else + SONAME_FLAG = -soname +endif .c.so: $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fPIC \ - -Wl,-soname,$@ -o $@ $< + -Wl,$(SONAME_FLAG),$@ -o $@ $< show-targets: ls *c |sed -e 's/.c$$/.so/' | awk '{print $$1 " \\"}'
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/memory_mgmt_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/memory_mgmt_test.py
Changed
@@ -297,7 +297,7 @@ gc.collect() after_object_count = len(gc.get_objects()) - self.assert_(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count)) + self.assertTrue(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count)) c.close() def test_form_bufferptr_memory_leak_gh267(self): @@ -317,7 +317,7 @@ gc.collect() after_object_count = len(gc.get_objects()) - self.assert_(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count)) + self.assertTrue(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count)) c.close() def do_data_refcounting(self, option):
View file
_service:tar_scm:pycurl-7.45.2.tar.gz/tests/multi_callback_test.py
Added
@@ -0,0 +1,100 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vi:ts=4:et + +from . import localhost +import pycurl +import pytest +import sys +import unittest + +from . import appmanager +from . import util + +setup_module, teardown_module = appmanager.setup(('app', 8380)) + +class MultiCallbackTest(unittest.TestCase): + def setUp(self): + self.easy = util.DefaultCurl() + self.easy.setopt(pycurl.URL, 'http://%s:8380/long_pause' % localhost) + self.multi = pycurl.CurlMulti() + self.multi.setopt(pycurl.M_SOCKETFUNCTION, self.socket_callback) + self.multi.setopt(pycurl.M_TIMERFUNCTION, self.timer_callback) + self.socket_result = None + self.timer_result = None + self.sockets = {} + + def tearDown(self): + self.multi.close() + self.easy.close() + + def socket_callback(self, ev_bitmask, sock_fd, multi, data): + self.socket_result = (sock_fd, ev_bitmask) + if ev_bitmask & pycurl.POLL_REMOVE: + self.sockets.pop(sock_fd) + else: + self.socketssock_fd = ev_bitmask | self.sockets.get(sock_fd, 0) + + def timer_callback(self, timeout_ms): + self.timer_result = timeout_ms + + def partial_transfer(self): + perform = True + def write_callback(data): + nonlocal perform + perform = False + self.easy.setopt(pycurl.WRITEFUNCTION, write_callback) + self.multi.add_handle(self.easy) + self.multi.socket_action(pycurl.SOCKET_TIMEOUT, 0) + while self.sockets and perform: + for socket, action in tuple(self.sockets.items()): + self.multi.socket_action(socket, action) + + # multi.socket_action must call both SOCKETFUNCTION and TIMERFUNCTION at + # various points during the transfer (at least at the start and end) + @pytest.mark.xfail(sys.platform == 'darwin', reason='https://github.com/pycurl/pycurl/issues/729') + def test_multi_socket_action(self): + self.multi.add_handle(self.easy) + self.timer_result = None + self.socket_result = None + self.multi.socket_action(pycurl.SOCKET_TIMEOUT, 0) + assert self.socket_result is not None + assert self.timer_result is not None + + # multi.add_handle must call TIMERFUNCTION to schedule a kick-start + def test_multi_add_handle(self): + self.multi.add_handle(self.easy) + assert self.timer_result is not None + + # (mid-transfer) multi.remove_handle must call SOCKETFUNCTION to remove sockets + @pytest.mark.xfail(sys.platform == 'darwin', reason='https://github.com/pycurl/pycurl/issues/729') + def test_multi_remove_handle(self): + self.multi.add_handle(self.easy) + self.multi.socket_action(pycurl.SOCKET_TIMEOUT, 0) + self.socket_result = None + self.multi.remove_handle(self.easy) + assert self.socket_result is not None + + # (mid-transfer) easy.pause(PAUSE_ALL) must call SOCKETFUNCTION to remove sockets + # (mid-transfer) easy.pause(PAUSE_CONT) must call TIMERFUNCTION to resume + @pytest.mark.xfail(sys.platform == 'darwin', reason='https://github.com/pycurl/pycurl/issues/729') + def test_easy_pause_unpause(self): + self.partial_transfer() + self.socket_result = None + # libcurl will now inform us that we should remove some sockets + self.easy.pause(pycurl.PAUSE_ALL) + assert self.socket_result is not None + self.socket_result = None + self.timer_result = None + # libcurl will now tell us to add those sockets and schedule a kickstart + self.easy.pause(pycurl.PAUSE_CONT) + assert self.socket_result is not None + assert self.timer_result is not None + + # (mid-transfer) easy.close() must call SOCKETFUNCTION to remove sockets + @pytest.mark.xfail(sys.platform == 'darwin', reason='https://github.com/pycurl/pycurl/issues/729') + def test_easy_close(self): + self.partial_transfer() + self.socket_result = None + self.easy.close() + assert self.socket_result is not None
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/multi_option_constants_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/multi_option_constants_test.py
Changed
@@ -63,6 +63,7 @@ input = (util.u('test1'), util.u('test2')) self.m.setopt(option, input) self.m.setopt(option, ()) + self.m.setopt(option, None) try: self.m.setopt(option, 1) @@ -70,3 +71,19 @@ except TypeError: exc = sys.exc_info()1 assert 'integers are not supported for this option' in str(exc) + + def test_multi_callback_opts(self): + def callback(*args, **kwargs): + pass + self.m.setopt(pycurl.M_SOCKETFUNCTION, callback) + self.m.setopt(pycurl.M_TIMERFUNCTION, callback) + self.m.setopt(pycurl.M_SOCKETFUNCTION, None) + self.m.setopt(pycurl.M_TIMERFUNCTION, None) + + def test_multi_unsetopt_unsupported(self): + try: + self.m.setopt(pycurl.M_MAXCONNECTS, None) + self.fail('expected to raise') + except TypeError: + exc = sys.exc_info()1 + assert 'unsetting is not supported for this option' in str(exc)
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/option_constants_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/option_constants_test.py
Changed
@@ -241,7 +241,7 @@ curl.close() @util.min_libcurl(7, 42, 0) - @util.only_ssl_backends('nss') + @util.only_ssl_backends('nss', 'secure-transport') def test_ssl_falsestart(self): curl = pycurl.Curl() curl.setopt(curl.SSL_FALSESTART, 1) @@ -263,7 +263,7 @@ curl.setopt(curl.ISSUERCERT, '/bogus-issuercert') curl.close() - @util.only_ssl + @util.only_ssl_backends('openssl', 'gnutls', 'nss') def test_capath(self): curl = pycurl.Curl() curl.setopt(curl.CAPATH, '/bogus-capath') @@ -271,7 +271,7 @@ # CURLOPT_PROXY_CAPATH was introduced in libcurl-7.52.0 @util.min_libcurl(7, 52, 0) - @util.only_ssl + @util.only_ssl_backends('openssl', 'gnutls', 'nss') def test_proxy_capath(self): curl = pycurl.Curl() curl.setopt(curl.PROXY_CAPATH, '/bogus-capath') @@ -331,7 +331,7 @@ curl.setopt(curl.RANDOM_FILE, '/bogus-random') curl.close() - @util.only_ssl_backends('openssl', 'gnutls') + @util.only_ssl_backends('openssl', 'gnutls', 'secure-transport') def test_egdsocket(self): curl = pycurl.Curl() curl.setopt(curl.EGDSOCKET, '/bogus-egdsocket') @@ -373,6 +373,26 @@ curl.setopt(curl.SSL_OPTIONS, curl.SSLOPT_NO_REVOKE) curl.close() + @util.min_libcurl(7, 64, 0) + def test_http09_allowed_option(self): + curl = pycurl.Curl() + curl.setopt(curl.HTTP09_ALLOWED, 1) + curl.close() + + @util.min_libcurl(7, 61, 0) + @util.only_ssl_backends('openssl') + def test_tls13_ciphers(self): + curl = pycurl.Curl() + curl.setopt(curl.TLS13_CIPHERS, 'TLS_CHACHA20_POLY1305_SHA256') + curl.close() + + @util.min_libcurl(7, 61, 0) + @util.only_ssl_backends('openssl') + def test_proxy_tls13_ciphers(self): + curl = pycurl.Curl() + curl.setopt(curl.PROXY_TLS13_CIPHERS, 'TLS_CHACHA20_POLY1305_SHA256') + curl.close() + class OptionConstantsSettingTest(unittest.TestCase): def setUp(self): self.curl = pycurl.Curl() @@ -476,6 +496,10 @@ def test_http_version_2prior_knowledge(self): self.curl.setopt(self.curl.HTTP_VERSION, self.curl.CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) + @util.min_libcurl(7, 66, 0) + def test_http_version_3(self): + self.curl.setopt(self.curl.HTTP_VERSION, self.curl.CURL_HTTP_VERSION_3) + @util.min_libcurl(7, 21, 5) def test_sockopt_constants(self): assert self.curl.SOCKOPT_OK is not None
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/post_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/post_test.py
Changed
@@ -86,7 +86,7 @@ def test_post_file(self): path = os.path.join(os.path.dirname(__file__), '..', 'README.rst') - f = open(path) + f = open(path, newline='') try: contents = f.read() finally:
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/reload_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/reload_test.py
Changed
@@ -14,6 +14,6 @@ reload_fn = reload except NameError: # python 3 - import imp - reload_fn = imp.reload + import importlib + reload_fn = importlib.reload reload_fn(pycurl)
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/run.sh -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/run.sh
Changed
@@ -7,8 +7,9 @@ test -n "$PYTEST" || PYTEST=pytest mkdir -p tests/tmp -export PYTHONSUFFIX=$($PYTHON -V 2>&1 |awk '{print $2}' |awk -F. '{print $1 "." $2}') -export PYTHONPATH=$(ls -d build/lib.*$PYTHONSUFFIX):$PYTHONPATH +export PYTHONMAJOR=$($PYTHON -V 2>&1 |awk '{print $2}' |awk -F. '{print $1}') +export PYTHONMINOR=$($PYTHON -V 2>&1 |awk '{print $2}' |awk -F. '{print $2}') +export PYTHONPATH=$(ls -d build/lib.*$PYTHONMAJOR*$PYTHONMINOR):$PYTHONPATH extra_attrs= if test "$CI" = true; then @@ -25,4 +26,4 @@ fi $PYTHON -c 'import pycurl; print(pycurl.version)' -$PYTEST +$PYTEST -v
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/runwsgi.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/runwsgi.py
Changed
@@ -35,10 +35,12 @@ import ssl cert_dir = os.path.join(os.path.dirname(__file__), 'certs') - self.srv.socket = ssl.wrap_socket( + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain( + os.path.join(cert_dir, 'server.crt'), + keyfile=os.path.join(cert_dir, 'server.key')) + self.srv.socket = context.wrap_socket( self.srv.socket, - keyfile=os.path.join(cert_dir, 'server.key'), - certfile=os.path.join(cert_dir, 'server.crt'), server_side=True) self.serve()
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/setopt_lifecycle_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/setopt_lifecycle_test.py
Changed
@@ -17,6 +17,7 @@ setup_module, teardown_module = appmanager.setup(('app', 8380)) class TestString(str): + __test__ = False def __del__(self): self.replace('1', '2') #print self
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/setopt_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/setopt_test.py
Changed
@@ -58,13 +58,13 @@ io = util.BytesIO() self.curl.setopt(self.curl.WRITEDATA, io) self.curl.perform() - self.assertEquals(util.b('foo'), io.getvalue()) + self.assertEqual(util.b('foo'), io.getvalue()) self.curl.unsetopt(self.curl.HTTPHEADER) io = util.BytesIO() self.curl.setopt(self.curl.WRITEDATA, io) self.curl.perform() - self.assertEquals(util.b(''), io.getvalue()) + self.assertEqual(util.b(''), io.getvalue()) def test_set_httpheader_none(self): self.curl.setopt(self.curl.HTTPHEADER, ('x-test: foo',)) @@ -72,13 +72,13 @@ io = util.BytesIO() self.curl.setopt(self.curl.WRITEDATA, io) self.curl.perform() - self.assertEquals(util.b('foo'), io.getvalue()) + self.assertEqual(util.b('foo'), io.getvalue()) self.curl.setopt(self.curl.HTTPHEADER, None) io = util.BytesIO() self.curl.setopt(self.curl.WRITEDATA, io) self.curl.perform() - self.assertEquals(util.b(''), io.getvalue()) + self.assertEqual(util.b(''), io.getvalue()) @util.min_libcurl(7, 37, 0) def test_proxyheader_list(self):
View file
_service:tar_scm:pycurl-7.45.2.tar.gz/tests/subclass_test.py
Added
@@ -0,0 +1,88 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vi:ts=4:et + +try: + import unittest2 as unittest +except ImportError: + import unittest +import pycurl + +CLASSES = (pycurl.Curl, pycurl.CurlMulti, pycurl.CurlShare) + +class SubclassTest(unittest.TestCase): + def test_baseclass_init(self): + # base classes do not accept any arguments on initialization + for baseclass in CLASSES: + try: + baseclass(0) + except TypeError: + pass + else: + raise AssertionError('Base class accepted invalid args') + try: + baseclass(a=1) + except TypeError: + pass + else: + raise AssertionError('Base class accepted invalid kwargs') + + def test_subclass_create(self): + for baseclass in CLASSES: + # test creation of a subclass + class MyCurlClass(baseclass): + pass + # test creation of its object + obj = MyCurlClass() + # must be of type subclass, but also an instance of base class + assert type(obj) == MyCurlClass + assert isinstance(obj, baseclass) + + def test_subclass_init(self): + for baseclass in CLASSES: + class MyCurlClass(baseclass): + def __init__(self, x, y=4): + self.x = x + self.y = y + # subclass __init__ must be able to accept args and kwargs + obj = MyCurlClass(3) + assert obj.x == 3 + assert obj.y == 4 + obj = MyCurlClass(5, y=6) + assert obj.x == 5 + assert obj.y == 6 + # and it must throw TypeError if arguments don't match + try: + MyCurlClass(1, 2, 3, kwarg=4) + except TypeError: + pass + else: + raise AssertionError('Subclass accepted invalid arguments') + + def test_subclass_method(self): + for baseclass in CLASSES: + class MyCurlClass(baseclass): + def my_method(self, x): + return x + 1 + obj = MyCurlClass() + # methods must be able to accept arguments and return a value + assert obj.my_method(1) == 2 + + def test_subclass_method_override(self): + # setopt args for each base class + args = { + pycurl.Curl: (pycurl.VERBOSE, 1), + pycurl.CurlMulti: (pycurl.M_MAXCONNECTS, 3), + pycurl.CurlShare: (pycurl.SH_SHARE, pycurl.LOCK_DATA_COOKIE), + } + for baseclass in CLASSES: + class MyCurlClass(baseclass): + def setopt(self, option, value): + # base method must not be overwritten + assert super().setopt != self.setopt + # base method mut be callable, setopt must return None + assert super().setopt(option, value) is None + # return something else + return 'my setopt' + obj = MyCurlClass() + assert obj.setopt(*argsbaseclass) == 'my setopt'
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/unset_range_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/unset_range_test.py
Changed
@@ -5,6 +5,7 @@ import os.path import pycurl import unittest +import urllib.request class UnsetRangeTest(unittest.TestCase): def setUp(self): @@ -20,7 +21,8 @@ # download bytes 0-9 of the script itself through the file:// protocol self.read = 0 - self.curl.setopt(pycurl.URL, 'file://' + os.path.abspath(__file__).replace('\\', '/')) + url = 'file:' + urllib.request.pathname2url(os.path.abspath(__file__)) + self.curl.setopt(pycurl.URL, url) self.curl.setopt(pycurl.WRITEFUNCTION, write_cb) self.curl.setopt(pycurl.RANGE, '0-9') self.curl.perform()
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/util.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/util.py
Changed
@@ -2,7 +2,7 @@ # vi:ts=4:et import tempfile -import os, sys, socket +import sys, socket import time as _time import functools import unittest @@ -175,6 +175,8 @@ current_backend = 'gnutls' elif 'NSS/' in pycurl.version: current_backend = 'nss' + elif 'SecureTransport' in pycurl.version: + current_backend = 'secure-transport' else: current_backend = 'none' if current_backend not in backends: @@ -254,40 +256,6 @@ break return ok -# -# prepare sys.path in case we are still in the build directory -# see also: distutils/command/build.py (build_platlib) -# - -def get_sys_path(p=None): - if p is None: - p = sys.path - p = p: - try: - from distutils.util import get_platform - except ImportError: - return p - p0 = "" - if p: - p0 = p0 - # - plat = get_platform() - plat_specifier = "%s-%s" % (plat, sys.version:3) - ##print plat, plat_specifier - # - for prefix in (p0, os.curdir, os.pardir,): - if not prefix: - continue - d = os.path.join(prefix, "build") - for subdir in ("lib", "lib." + plat_specifier, "lib." + plat): - dir = os.path.normpath(os.path.join(d, subdir)) - if os.path.isdir(dir): - if dir not in p: - p.insert(1, dir) - # - return p - - def DefaultCurl(): import pycurl
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/write_abort_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/write_abort_test.py
Changed
@@ -6,6 +6,7 @@ import pycurl import sys import unittest +import urllib.request class WriteAbortTest(unittest.TestCase): def setUp(self): @@ -27,7 +28,8 @@ pass # download the script itself through the file:// protocol into write_cb - self.curl.setopt(pycurl.URL, 'file://' + os.path.abspath(__file__).replace('\\', '/')) + url = 'file:' + urllib.request.pathname2url(os.path.abspath(__file__)) + self.curl.setopt(pycurl.URL, url) self.curl.setopt(pycurl.WRITEFUNCTION, write_cb) try: self.curl.perform()
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/tests/write_cb_bogus_test.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/tests/write_cb_bogus_test.py
Changed
@@ -6,6 +6,7 @@ import pycurl import sys import unittest +import urllib.request class WriteAbortTest(unittest.TestCase): def setUp(self): @@ -28,7 +29,8 @@ def check(self, write_cb): # download the script itself through the file:// protocol into write_cb - self.curl.setopt(pycurl.URL, 'file://' + os.path.abspath(__file__).replace('\\', '/')) + url = 'file:' + urllib.request.pathname2url(os.path.abspath(__file__)) + self.curl.setopt(pycurl.URL, url) self.curl.setopt(pycurl.WRITEFUNCTION, write_cb) try: self.curl.perform()
View file
_service:tar_scm:pycurl-7.44.1.tar.gz/winbuild.py -> _service:tar_scm:pycurl-7.45.2.tar.gz/winbuild.py
Changed
@@ -103,7 +103,7 @@ # whether to build binary wheels build_wheels = True # pycurl version to build, we should know this ourselves - pycurl_version = '7.44.1' + pycurl_version = '7.45.2' # Sometimes vc14 does not include windows sdk path in vcvars which breaks stuff. # another application for this is to supply normaliz.lib for vc9
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2