Basic authentication with a proxy not using Proxy-Authorization header

Hello,

I am trying to perform an HTTPS request with a proxy with proxy authentication. I tried to do it using two different ways but I had the same issue for both which result on the following error:
```
[...]
  File "/usr/lib64/python3.9/http/client.py", line 285, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected:` Remote end closed connection without response

[...]
  File "/home/janemba/.local/lib/python3.9/site-packages/urllib3/util/retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='wtfismyip.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))
```

Monitoring the request using `Wireshark` I've noticed the `Proxy-Authorization` header hasn't been set.

I performed the request that way:
```
class HTTPProxyAuth(requests.auth.HTTPBasicAuth):

	def __call__(self, r):

		auth_s = base64.b64encode('{}:{}'.format(self.username, self.password).encode('utf-8'))
		r.headers['Proxy-Authorization'] = ('Basic %s' % auth_s)
		return r

s = requests.Session()
s.proxies = {"https": "https://{}:{}".format(ip, port)}
s.auth = HTTPProxyAuth(login, password)

r = s.get("https://wtfismyip.com")

print(r.headers)
print(r.text)
```
And:

```
r = requests.get('https://wtfismyip.com', proxies={'https':'https://1.2.3.4:443'}, auth=requests.auth.HTTPProxyAuth('login','password'))

print(r.headers)
print(r.text)
```

For both requests I got the exact same issue, the `Proxy-Authorization` header is not set.


```python
s.proxies = {
    'https': f'https://{username}:{password}@{ip}:{port}'
} 
r = s.get("https://wtfismyip.com")
```

Hmm...the password itself is 790 characters.

Is there a way to add the `Proxy-Authorization` header for the HTTP `CONNECT` request  ?

https://datatracker.ietf.org/doc/html/rfc2617#section-2

```
   To receive authorization, the client sends the userid and password,
   separated by a single colon (":") character, within a base64 [7]
   encoded string in the credentials.

      basic-credentials = base64-user-pass
      base64-user-pass  = <base64 [4] encoding of user-pass, except not limited to 76 char/line>
      user-pass   = userid ":" password
      userid      = *<TEXT excluding ":">
      password    = *TEXT
```


That's not what I did in my custom class `HTTPProxyAuth` ? (first post)

I'm trying to use a proxy as a remote but it keep on saying 407 authentication how can I get the proxy credentials? 

This is an authenticated proxy so if you don't have the credentials it won't work.

Now, you can forget about `requests` for this and especially if your proxy is waiting for a `Proxy-Authorization` header as usually `HTTP/1.1` is expected but `HTTP/1.0` will always been used if you try with `requests`. Also, `requests` library does not implement `HTTPS` connection with a proxy. The only way I found to perform all of this was using `pycurl`.

Please see the attached file. My proxy is 13.244.165.24 it respond with
407. I need to know the part that is highlighted with pink which I believe
its the credentials of the proxy.

On Tue, Aug 17, 2021, 6:45 PM janemba ***@***.***> wrote:

> This is an authenticated proxy so if you don't have the credentials it
> won't work.
>
> Now, you can forget about requests for this and especially if your proxy
> is waiting for a Proxy-Authorization header as usually HTTP/1.1 is
> expected but HTTP/1.0 will always been used if you try with requests.
> Also, requests library is not implemented HTTPS connection with a proxy.
> The only way I found to perform all of this was using pycurl.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/psf/requests/issues/5900#issuecomment-900458681>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AHDVRRLJIEHWSBJ6V66DO7LT5KG3PANCNFSM5BXKDRYQ>
> .
>


Hmm..I can't see your attached file.

Please check my proxy 13.244.165.24:80

On Wed, Aug 18, 2021, 10:49 AM janemba ***@***.***> wrote:

> Hmm..I can't see your attached file.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/psf/requests/issues/5900#issuecomment-900937454>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AHDVRRJOLS7LENHZYYIWMEDT5NXY7ANCNFSM5BXKDRYQ>
> .
>