-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
incorrect operation with uvloop #7686
Copy link
Copy link
Closed
Labels
HacktoberfestWe think it's good for https://hacktoberfest.digitalocean.com/We think it's good for https://hacktoberfest.digitalocean.com/bugclientgood first issueGood for newcomersGood for newcomers
Description
Describe the bug
When using the proxy parameter with uvloop I get the RuntimeWarning: An HTTPS request is being sent through an HTTPS proxy. This support for TLS in TLS although the request is made without errors and the IP is changed, does this warning affect anything?
To Reproduce
async def main():
async with ClientSession(
json_serialize=ujson.dumps,
timeout=aiohttp.ClientTimeout(total=6),
) as session:
async with session.get(
"https://api.ipify.org?format=json",
proxy="http://proxy",
) as response:
print((await response.json()))
if __name__ == "__main__":
uvloop.install()
asyncio.run(main(), debug=True)RuntimeWarning: An HTTPS request is being sent through an HTTPS proxy. This support for TLS in TLS is known to be disabled in the stdlib asyncio. This is why you'll probably see an error in the log below.
It is possible to enable it via monkeypatching under Python 3.7 or higher. For more details, see:
* https://bugs.python.org/issue37179
* https://github.com/python/cpython/pull/28073
You can temporarily patch this as follows:
* https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support
* https://github.com/aio-libs/aiohttp/discussions/6044
_, proto = await self._create_proxy_connection(req, traces, timeout)
RuntimeWarning: Enable tracemalloc to get the object allocation tracebackIf you make a request without uvloop, the warning does not appear
async def main():
async with ClientSession(
json_serialize=ujson.dumps,
timeout=aiohttp.ClientTimeout(total=6),
) as session:
async with session.get(
"https://api.ipify.org?format=json",
proxy="http://proxy",
) as response:
print((await response.json()))
if __name__ == "__main__":
# uvloop.install()
asyncio.run(main(), debug=True)Expected behavior
I expected that there would be no warning when using uvloop
Logs/tracebacks
-Python Version
$ python --version
3.11.5aiohttp Version
$ python -m pip show aiohttp
3.8.6multidict Version
$ python -m pip show multidict
6.0.4yarl Version
$ python -m pip show yarl
1.9.2OS
macOS/ubuntu
Related component
Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
HacktoberfestWe think it's good for https://hacktoberfest.digitalocean.com/We think it's good for https://hacktoberfest.digitalocean.com/bugclientgood first issueGood for newcomersGood for newcomers