{"action":"created","issue":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/3633","repository_url":"https://api.github.com/repos/kennethreitz/requests","labels_url":"https://api.github.com/repos/kennethreitz/requests/issues/3633/labels{/name}","comments_url":"https://api.github.com/repos/kennethreitz/requests/issues/3633/comments","events_url":"https://api.github.com/repos/kennethreitz/requests/issues/3633/events","html_url":"https://github.com/kennethreitz/requests/issues/3633","id":184638014,"number":3633,"title":"HTTPS requests through proxies in proposed/3.0.0 aren't configured correctly","user":{"login":"jeremycline","id":1977525,"avatar_url":"https://avatars.githubusercontent.com/u/1977525?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremycline","html_url":"https://github.com/jeremycline","followers_url":"https://api.github.com/users/jeremycline/followers","following_url":"https://api.github.com/users/jeremycline/following{/other_user}","gists_url":"https://api.github.com/users/jeremycline/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremycline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremycline/subscriptions","organizations_url":"https://api.github.com/users/jeremycline/orgs","repos_url":"https://api.github.com/users/jeremycline/repos","events_url":"https://api.github.com/users/jeremycline/events{/privacy}","received_events_url":"https://api.github.com/users/jeremycline/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-22T15:59:26Z","updated_at":"2016-10-22T18:01:48Z","closed_at":null,"body":"In current master:\r\n```\r\n>>> import requests\r\n>>> requests.__version__\r\n'2.11.1'\r\n>>> session = requests.Session()\r\n>>> r = session.get('https://www.jcline.org/', verify=True, proxies={'http': 'http://vagrant:vagrant@localhost:3128', 'https': 'http://vagrant:vagrant@localhost:3128'})\r\n>>> \r\n```\r\n\r\nIn current proposed/3.0.0:\r\n```\r\n>>> import requests\r\n>>> requests.__version__\r\n'3.0.0'\r\n>>> session = requests.Session()\r\n>>> r = session.get('https://www.jcline.org/', verify=True, proxies={'http': 'http://vagrant:vagrant@localhost:3128', 'https': 'http://vagrant:vagrant@localhost:3128'})\r\nrequests/packages/urllib3/connectionpool.py:838: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html\r\n  InsecureRequestWarning)\r\n>>> \r\n```\r\n\r\nThis is a problem I introduced in https://github.com/kennethreitz/requests/pull/3109 :disappointed:. What happens right now is if a request is _not_ through a proxy and it's HTTPS, the urllib3 pool manager's ``connection_pool_kw`` are updated before requesting a new connection using [requests.adapters.HTTPAdapter._update_poolmanager_ssl_kw](https://github.com/kennethreitz/requests/blob/proposed/3.0.0/requests/adapters.py#L204). If it _is_ through a proxy, the keywords aren't updated and the request is made with the default settings for urllib3.\r\n\r\nTo me, the most appealing way to fix this is to add a keyword argument, ``connection_kwargs`` or something, to all the ``urllib3.poolmanager.PoolManager.connection_from_*`` methods that is either merged into ``connection_pool_kw`` or overrides them. That way ``urllib3`` can handle getting the connection pool with the new kwargs in a thread-safe manner. Currently, ``requests`` has to manage updating the keys and getting the new connection pool with a lock. It seems like that would be better in ``urllib3``.\r\n\r\nThe other option is to patch up what's currently in ``HTTPAdapter`` so it handles updating the proxy manager or plain pool manager based on whether proxies are in use.\r\n\r\nWhat do people think?"},"comment":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/comments/255543865","html_url":"https://github.com/kennethreitz/requests/issues/3633#issuecomment-255543865","issue_url":"https://api.github.com/repos/kennethreitz/requests/issues/3633","id":255543865,"user":{"login":"Lukasa","id":1382556,"avatar_url":"https://avatars.githubusercontent.com/u/1382556?v=3","gravatar_id":"","url":"https://api.github.com/users/Lukasa","html_url":"https://github.com/Lukasa","followers_url":"https://api.github.com/users/Lukasa/followers","following_url":"https://api.github.com/users/Lukasa/following{/other_user}","gists_url":"https://api.github.com/users/Lukasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Lukasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lukasa/subscriptions","organizations_url":"https://api.github.com/users/Lukasa/orgs","repos_url":"https://api.github.com/users/Lukasa/repos","events_url":"https://api.github.com/users/Lukasa/events{/privacy}","received_events_url":"https://api.github.com/users/Lukasa/received_events","type":"User","site_admin":false},"created_at":"2016-10-22T18:01:48Z","updated_at":"2016-10-22T18:01:48Z","body":"I am open to having a urllib3 patch for this, at least in principle. What would it look like?"}}
{"actor":{"display_login":"Lukasa"}}