Skip to content
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

IPv6 in URL is missing brackets in proxy CONNECT request #3841

Open
shnavid opened this issue Jun 13, 2019 · 0 comments

Comments

@shnavid
Copy link
Contributor

commented Jun 13, 2019

Long story short

Requests to a URL containing an IPv6 address while using a proxy results in a malformed CONNECT request.

Expected behaviour

The request should make it through the proxy and reach the IPv6 server.

Actual behaviour

The proxy is returning an error (400, Bad request).

Steps to reproduce

async with aiohttp.request(
  'get',
  'https://[2320:10a:c081:56::363]:443/testing.txt',
   proxy="http://whatever:8080",
 ) as response:
     print(response)

tcpdump shows (notice the missing brackets):

CONNECT 2320:10a:c081:56::363:443 HTTP/1.1
Host: [2320:10a:c081:56::363]
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: Python/3.6 aiohttp/3.5.4

I patched https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_reqrep.py#L543 to add the brackets and confirmed that the request is going through.

Your environment

aiohttp/3.5.4 (client)
CentOS 7.5

shnavid added a commit to shnavid/aiohttp that referenced this issue Jun 13, 2019
shnavid pushed a commit to shnavid/aiohttp that referenced this issue Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.