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
SSLEOFError in Python 3.10 not in Python 3.9 #2733
Comments
|
I'm re-opening this as I have found what I think may be a behaviour change between Python versions that should be handled differently by See this code with from urllib.request import Request, urlopen
# On Python 3.9 we get a "broken pipe", but on 3.10 we get an EOF occurred error.
body = b"a" * int(2 ** 21 + 1)
req = Request('https://cloudreco.vuforia.com/v1/query', data=body)
response = urlopen(req) The broken pipe error is swallowed on purpose: urllib3/src/urllib3/connectionpool.py Lines 446 to 450 in a80c248
but the The PR which introduced the broken pipe error skipping: #1524 This is getting a little deep for me (RFCs) and such. |
I met the same problem as you when I trying to connect yahoo finance. When I was using old version of urllib3 it seems work fine, but now I got this error |
Apologies if this is not the right place for this - I was torn between here and StackOverflow.
Summary: Code raises an exception on Python 3.10.6 and not Python 3.9.13. I would like to fully understand why and hopefully avoid the exception.
Simple reproducible case:
In Python 3.9, I get no exception. I see:
This is the response that I want.
In Python 3.10, I get the following traceback:
python -c "import ssl; print(ssl.OPENSSL_VERSION)"
showsOpenSSL 1.1.1q 5 Jul 2022
for both Python 3.9 and Python 3.10.requests
but I narrowed the example tourllib3
.What I have tried so far:
ssl.OP_IGNORE_UNEXPECTED_EOF
is new in Python 3.10, and that looks relevant. However, it only works with OpenSSL >= 3.0.0. I need to support Python with OpenSSL 1.1.1q.What I tried:
Likely irrelevant code
Context
I am building a mock for the
'https://cloudreco.vuforia.com/v1/query'
service.I want the mock to behave the same when a body is too large as the real service does, so that the users of the mock can handle errors correctly.
In this case, a
requests
user for example may need totry ... except SSLError: ...
with the real service, and I want them to hit this same error when using the mock.If I can fully understand what the difference is in the (handling of the) request from Python 3.9 versus Python 3.10, I hope that this will help me to make the mock more accurate, or at least document the exact scenarios in which it is not accurate.
The text was updated successfully, but these errors were encountered: