-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
SSLError: [Errno bad handshake] (32, 'EPIPE') #242
Comments
Hi. I had something like this problem. Trying to write unittests. If you pin to ndg-httpsclient 0.3.0 and PyOpenSSL < 0.14, that might work. Hopefully this helps.. |
I too had this same problem. Downgrading to |
ndg-httpsclient is magical monkey patcher. I didn't look deeply into it but the a handshake error usually means something like httpretty is expecting sslv3 and received sslv2. Conversely if you pin PyOpenSSL to >=0.15.1 and ndg-httpsclient to 0.4.0 it will work as well. |
We had this problem too. Downgrading
Rather than trying to figure out what combination of ndg-httpsclient and PyOpenSSL would work for everything, we decided to go back to The problem is that PyOpenSSL monkey-patches the Just use
Not sure if there's a case for a pull request to merge the fix into httpretty core itself but there it is. It fixed all our failing tests! |
+1 experiencing this here too |
This issue helped me too. Would be useful create a kind of FAQ to highlight issues like this one, woudn't ? |
Any update on this? Is there a plan to implement a fix? |
I second Clinton's question. ndg-httpsclient is part of a requests[security] update that we need in order for some code to function properly, but we have several tests that use httpretty, so our tests break upon installing this package. Do we know about how long it would take such an update to be merged? |
Hey guys, just a heads up, I just submitted an MR for this issue. The changes that I implemented seem to work on my end without issue (note that they are the same as the changes mentioned above by jmcbailey, thanks for that by the way! but implemented directly into the httpretty.core file). |
So what's the final fix for this issue? When I downgrade
|
I replaced httpretty with the responses library. |
See: gabrielfalcao/HTTPretty#242 with the mypretty solution from jmcbailey
There is still an ongoing ticket on HTTPretty, that is yet to be addressed and closed: gabrielfalcao/HTTPretty#242 gabrielfalcao/HTTPretty#289 For now, used the suggested fix from @jmcbailey in the same thread.
this issue is still reproducible in 0.8.14. In the shell I see: In [9]: import requests
...: import httpretty
...:
...: @httpretty.activate
...: def run(url):
...: httpretty.register_uri(httpretty.POST, url, body='somebody')
...: rs = requests.post(url)
...: return rs
...:
In [10]: run('http://google.com')
Out[10]: <Response [200]>
In [11]: run('https://google.com')
...
/Users/traut/.p3/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
607
608 # Send the request
--> 609 r = adapter.send(request, **kwargs)
610
611 # Total elapsed time of the request (approximately)
/Users/traut/.p3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
495 except (_SSLError, _HTTPError) as e:
496 if isinstance(e, _SSLError):
--> 497 raise SSLError(e, request=request)
498 elif isinstance(e, ReadTimeoutError):
499 raise ReadTimeout(e, request=request)
SSLError: ('bad handshake: WantWriteError()',) also, Trevis build for my project fails with similar error:
|
See gabrielfalcao/HTTPretty#242 Patch based on mredar/harvester@228e9c3 Signed-off-by: Michal Čihař <michal@cihar.com>
Any chance to get this issue addressed? There is pull request https://docs.weblate.org/en/latest/faq.html#why-do-i-get-a-warning-about-not-reflected-changes-on-database-migration which seems to fix this and several projects have already copied that fix to their codebase to address this. Apparently the problem is not really bound to ndg-httpsclient, it just happens with requests + pyopenssl (though not on all setups). |
i usually do not like promoting other projects in a projects bug tracker, but since this issue has been around for quite a while, here's a tip: using ‘responses’ instead of ‘httpretty’ seems to solve this issue with a modern requests/pyopenssl/crypography stack. https://github.com/getsentry/responses the api is very similar for simple use cases. |
* Mocked HTTPretty, which has a bug causing SSL requests fail for certain versions of openssl library. Related: gabrielfalcao/HTTPretty#242 Signed-off-by: Krzysztof Nowak <k.nowak@cern.ch>
* Fix for #65, thanks to the @jmcbailey patch at gabrielfalcao/HTTPretty#242. * Improving the check, removing dependency of `requests` which is only acting as wrapper.
* Adding yaml for Shippable CI. * Fix for pip 10 which misses .main() * Adding `recv_into` support (#72) * Adding socket.recv_into() plus its test (#71). * Forcing `pip` upgrade. * Fix for #65, thanks to the @jmcbailey patch at gabrielfalcao/HTTPretty#242. * Improving the check, removing dependency of `requests` which is only acting as wrapper. * Increasing stability of `true_sendall` function. * Improving the `flake8` usage. * Minor changes. * Status badge from Shippable
I m trying to implement httpretty to mock a https endpoint. I m getting this error.
The text was updated successfully, but these errors were encountered: