Skip to content

Client`s proxy auth not work in specially condition #2596

@strongbugman

Description

@strongbugman

Long story short

Only first proxy auth is fun when sending many http`s requests(with same proxy and same url location) through one client session

Expected behaviour

Request same url with same authed proxy many times in one client session, proxy auth will work for all requests

Actual behaviour

Request same url with same authed proxy many times in one client session, only first request is fun, others will return 407 HTTP status code which mean the proxy auth not work(No proxy auth in the requests HTTP headers).

Steps to reproduce

There is a example code:

async def main():
    s = aiohttp.ClientSession()
    proxy = 'http://name:passwd@one_proxy_with_auth' 
    async with s.request('GET', 'http://httpbin.org', proxy=proxy) as res:
        await res.read()
        print(res.status)  # print 200
    async with s.request('GET', 'http://httpbin.org', proxy=proxy) as res:
        await res.read()
        print(res.status)  # print 407, means proxy auth not work
    await s.close()

if __name__ == '__main__':
    asyncio.get_event_loop().run_until_complete(main())

Your environment

aiohttp: 3.3.1 as client
OS: MacOS 10.13.1
proxy: squid

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions