title: 400 Bad Request on HTTPS connection in Python
body: <p>Python : 3.6.5 ( Anaconda)
  Operating system: RHEL 6.9</p>
  
  <p>I am always hit by 400 Bad request error while connection attempt by https over proxy. But the same is working fine without http and curl. I have exported https_proxy and http_proxy in linux cli. Anyone advise me what to do?</p>
  
  <pre><code>        import requests
          session = requests.Session()
          session.get("https://pypi.python.org/simple/").content
  </code></pre>
  
  <p>Traceback (most recent call last):</p>
  
  <pre><code>File "/apps/bitech/python/lib/python3.6/site-packages/urllib3/connectionpool.py", line 595, in urlopen
  self._prepare_proxy(conn)
  File "/apps/bitech/python/lib/python3.6/site-packages/urllib3/connectionpool.py", line 816, in _prepare_proxy
  conn.connect()
  File "/apps/bitech/python/lib/python3.6/site-packages/urllib3/connection.py", line 294, in connect
  self._tunnel()
  File "/apps/bitech/python/lib/python3.6/http/client.py", line 919, in _tunnel
  message.strip()))
  OSError: Tunnel connection failed: 400 Bad Request
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
  timeout=timeout
  File "/apps/bitech/python/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
  _stacktrace=sys.exc_info()[2])
  File "/apps/bitech/python/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
  raise MaxRetryError(_pool, url, error or ResponseError(cause))
  urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request',)))
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
  File "", line 1, in
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
  return self.request('GET', url, **kwargs)
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
  resp = self.send(prep, **send_kwargs)
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/sessions.py", line 640, in send
  history = [resp for resp in gen] if allow_redirects else []
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/sessions.py", line 640, in
  history = [resp for resp in gen] if allow_redirects else []
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/sessions.py", line 218, in resolve_redirects
  **adapter_kwargs
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
  r = adapter.send(request, **kwargs)
  File "/apps/bitech/python/lib/python3.6/site-packages/requests/adapters.py", line 502, in send
  raise ProxyError(e, request=request)
  requests.exceptions.ProxyError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request',)))
  </code></pre>