-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adapters: fix for requests 2.32.2+ #72
base: master
Are you sure you want to change the base?
Conversation
Since this project seems to be abandoned, but its longevity is important to my team, we've forked the project as
We've migrated this PR there, merged it, and released to PyPI as part of v0.4.0. |
…ocket psf/requests#6710 msabramo/requests-unixsocket#72 Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
requests 2.32 security fix recommends a fix: psf/requests#6710 This was proposed (but not yet merged) to requests-unixsocket in: msabramo/requests-unixsocket#72 Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@msabramo Can we get this merged? This is a crucial fix |
I've tested this PR and pytest 8.2.1 fails in 4 units Here is pytest output:+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-requests-unixsocket-0.3.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-requests-unixsocket-0.3.0-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/requests-unixsocket-0.3.0
configfile: pytest.ini
collected 5 items
requests_unixsocket/tests/test_requests_unixsocket.py FFF.F [100%]
========================================================================================= FAILURES ==========================================================================================
________________________________________________________________________________ test_unix_domain_adapter_ok ________________________________________________________________________________
requests_unixsocket/tests/test_requests_unixsocket.py:26: in test_unix_domain_adapter_ok
r = getattr(session, method)(url)
/usr/lib/python3.10/site-packages/requests/sessions.py:602: in get
return self.request("GET", url, **kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:589: in request
resp = self.send(prep, **send_kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:703: in send
r = adapter.send(request, **kwargs)
/usr/lib/python3.10/site-packages/requests/adapters.py:561: in send
self.cert_verify(conn, request.url, verify, cert)
/usr/lib/python3.10/site-packages/requests/adapters.py:320: in cert_verify
conn.cert_reqs = "CERT_NONE"
E AttributeError: 'NoneType' object has no attribute 'cert_reqs'
______________________________________________________________________ test_unix_domain_adapter_url_with_query_params _______________________________________________________________________
requests_unixsocket/tests/test_requests_unixsocket.py:53: in test_unix_domain_adapter_url_with_query_params
r = getattr(session, method)(url)
/usr/lib/python3.10/site-packages/requests/sessions.py:602: in get
return self.request("GET", url, **kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:589: in request
resp = self.send(prep, **send_kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:703: in send
r = adapter.send(request, **kwargs)
/usr/lib/python3.10/site-packages/requests/adapters.py:561: in send
self.cert_verify(conn, request.url, verify, cert)
/usr/lib/python3.10/site-packages/requests/adapters.py:320: in cert_verify
conn.cert_reqs = "CERT_NONE"
E AttributeError: 'NoneType' object has no attribute 'cert_reqs'
_________________________________________________________________________ test_unix_domain_adapter_connection_error _________________________________________________________________________
requests_unixsocket/tests/test_requests_unixsocket.py:76: in test_unix_domain_adapter_connection_error
getattr(session, method)(
/usr/lib/python3.10/site-packages/requests/sessions.py:602: in get
return self.request("GET", url, **kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:589: in request
resp = self.send(prep, **send_kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:703: in send
r = adapter.send(request, **kwargs)
/usr/lib/python3.10/site-packages/requests/adapters.py:561: in send
self.cert_verify(conn, request.url, verify, cert)
/usr/lib/python3.10/site-packages/requests/adapters.py:320: in cert_verify
conn.cert_reqs = "CERT_NONE"
E AttributeError: 'NoneType' object has no attribute 'cert_reqs'
___________________________________________________________________________ test_unix_domain_adapter_monkeypatch ____________________________________________________________________________
requests_unixsocket/tests/test_requests_unixsocket.py:101: in test_unix_domain_adapter_monkeypatch
r = getattr(requests, method)(url)
../../BUILDROOT/python-requests-unixsocket-0.3.0-2.fc37.x86_64/usr/lib/python3.10/site-packages/requests_unixsocket/__init__.py:51: in get
return request('get', url, **kwargs)
../../BUILDROOT/python-requests-unixsocket-0.3.0-2.fc37.x86_64/usr/lib/python3.10/site-packages/requests_unixsocket/__init__.py:46: in request
return session.request(method=method, url=url, **kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:589: in request
resp = self.send(prep, **send_kwargs)
/usr/lib/python3.10/site-packages/requests/sessions.py:703: in send
r = adapter.send(request, **kwargs)
/usr/lib/python3.10/site-packages/requests/adapters.py:561: in send
self.cert_verify(conn, request.url, verify, cert)
/usr/lib/python3.10/site-packages/requests/adapters.py:320: in cert_verify
conn.cert_reqs = "CERT_NONE"
E AttributeError: 'NoneType' object has no attribute 'cert_reqs'
================================================================================== short test summary info ==================================================================================
FAILED requests_unixsocket/tests/test_requests_unixsocket.py::test_unix_domain_adapter_ok - AttributeError: 'NoneType' object has no attribute 'cert_reqs'
FAILED requests_unixsocket/tests/test_requests_unixsocket.py::test_unix_domain_adapter_url_with_query_params - AttributeError: 'NoneType' object has no attribute 'cert_reqs'
FAILED requests_unixsocket/tests/test_requests_unixsocket.py::test_unix_domain_adapter_connection_error - AttributeError: 'NoneType' object has no attribute 'cert_reqs'
FAILED requests_unixsocket/tests/test_requests_unixsocket.py::test_unix_domain_adapter_monkeypatch - AttributeError: 'NoneType' object has no attribute 'cert_reqs'
================================================================================ 4 failed, 1 passed in 0.37s ================================================================================ |
Missing return, use |
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
24811e2
to
8b02ed5
Compare
@layercak3 thanks I don't understand how I could fail to copy-n-paste in such a way, embarrassing :/ |
The original proposal was initially missing the |
Just retested 0.3.0 against + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-requests-unixsocket-0.3.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-requests-unixsocket-0.3.0-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/requests-unixsocket-0.3.0
configfile: pytest.ini
collected 5 items
requests_unixsocket/tests/test_requests_unixsocket.py ..... [100%]
===================================================================================== 5 passed in 0.18s ===================================================================================== |
in order to get the following fix: msabramo/requests-unixsocket#72
in order to get the following fix: msabramo/requests-unixsocket#72
… to ddev (#17702) * Upgrade `requests` to `2.32.3` * Add changelog entry * Bump the `requests-unixsocket` version to requests-unixsocket2==0.4.0 in order to get the following fix: msabramo/requests-unixsocket#72 * update license * changelog * Apply suggestions from code review Co-authored-by: Steven Yuen <steven.yuen@datadoghq.com> * Regenerate LICENSE-3rdparty.csv * conflicts * sync license * changelog --------- Co-authored-by: steveny91 <steven.yuen@datadoghq.com>
… to ddev (#17702) * Upgrade `requests` to `2.32.3` * Add changelog entry * Bump the `requests-unixsocket` version to requests-unixsocket2==0.4.0 in order to get the following fix: msabramo/requests-unixsocket#72 * update license * changelog * Apply suggestions from code review Co-authored-by: Steven Yuen <steven.yuen@datadoghq.com> * Regenerate LICENSE-3rdparty.csv * conflicts * sync license * changelog --------- Co-authored-by: steveny91 <steven.yuen@datadoghq.com> (cherry picked from commit e1e61e5)
… to ddev (#17702) * Upgrade `requests` to `2.32.3` * Add changelog entry * Bump the `requests-unixsocket` version to requests-unixsocket2==0.4.0 in order to get the following fix: msabramo/requests-unixsocket#72 * update license * changelog * Apply suggestions from code review Co-authored-by: Steven Yuen <steven.yuen@datadoghq.com> * Regenerate LICENSE-3rdparty.csv * conflicts * sync license * changelog --------- Co-authored-by: steveny91 <steven.yuen@datadoghq.com> e1e61e5
… to ddev (#17702) (#17776) * Upgrade `requests` to `2.32.3` * Add changelog entry * Bump the `requests-unixsocket` version to requests-unixsocket2==0.4.0 in order to get the following fix: msabramo/requests-unixsocket#72 * update license * changelog * Apply suggestions from code review Co-authored-by: Steven Yuen <steven.yuen@datadoghq.com> * Regenerate LICENSE-3rdparty.csv * conflicts * sync license * changelog --------- Co-authored-by: steveny91 <steven.yuen@datadoghq.com> (cherry picked from commit e1e61e5) Co-authored-by: Lénaïc Huard <L3n41c@users.noreply.github.com>
Without this, all requests to
http+unix://
URLs fail with:requests.exceptions.InvalidURL: Not supported URL scheme http+unix
.Fixes #73