Proxies are used by prepared requests without merging in environment settings

According to the documentation, sending prepared requests does not merge in environment settings unless that is done manually via `s.merge_environment_settings`. However, I'm observing the `*_PROXY` variables being used while `REQUESTS_CA_BUNDLE` is not.

mitmproxy on the default 127.0.0.1:8080; CPython 3.10.1, requests 2.27.1 on Debian Sid

### HTTP, no env merging

    > http_proxy=http://127.0.0.1:8080 HTTPS_PROXY=http://127.0.0.1:8080 REQUESTS_CA_BUNDLE=~/.mitmproxy/mitmproxy-ca.pem python3 -c 'import requests; s = requests.Session(); r = s.prepare_request(requests.Request("GET", "http://example.org/")); s.send(r)'

This request goes through the proxy when it shouldn't. (The CA bundle is obviously not relevant.)

### HTTPS, no env merging

```
> http_proxy=http://127.0.0.1:8080 HTTPS_PROXY=http://127.0.0.1:8080 REQUESTS_CA_BUNDLE=~/.mitmproxy/mitmproxy-ca.pem python3 -c 'import requests; s = requests.Session(); r = s.prepare_request(requests.Request("GET", "https://example.org/")); s.send(r)'
[...]
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)
```

Again, uses the proxy when it shouldn't. However, the CA bundle is not loaded, causing the verification to fail.

### HTTPS with env merging

    > http_proxy=http://127.0.0.1:8080 HTTPS_PROXY=http://127.0.0.1:8080 REQUESTS_CA_BUNDLE=~/.mitmproxy/mitmproxy-ca.pem python3 -c 'import requests; s = requests.Session(); r = s.prepare_request(requests.Request("GET", "https://example.org/")); s.send(r, **s.merge_environment_settings(r.url, {}, None, None, None))'

Goes through the proxy and passes certificate verification, as expected.

Prepared Requests do not contain proxy settings as you seem to think they do. That is a separate step and is passed as a parameter to `Session.send` so the code you're using is making assumptions that are invalid. To control proxies, you must tell `Session.send` what to do.

To be clear, the certificate bundle is also handled as a setting to `Session.send` because you're side-stepping https://github.com/psf/requests/blob/2d5517682b3b38547634d153cea43d48fbc8cdb5/requests/sessions.py#L453-L527 and so you need to be telling us what certificate bundle you intend for us to use etc. to get the behaviour you want.

@sigmavirus24 But that's exactly my point. Prepared requests should not be using the environment variables, but as shown above, they *do* use the `*_PROXY` variable (but not the `REQUESTS_CA_BUNDLE` one).

The [documentation](https://docs.python-requests.org/en/latest/user/advanced/#prepared-requests) (at the end of that section) says:

> When you are using the prepared request flow, keep in mind that it does not take into account the environment.

Therefore, I would expect that it would ignore `*_PROXY` entirely without a `merge_environment_settings` call. But it doesn't do that...

So either this needs a doc update (undefined behaviour?), although the wording there shows a pretty clear intent of ignoring *all* environment variables, not just some. Or it's a bug.

The documentation is _slightly_ incorrect. As I said, you need to pass something to `send` even if it's just `proxies={}`, otherwise, in order to provide a default we may conditionally pull it from the environment: https://github.com/psf/requests/blob/2d5517682b3b38547634d153cea43d48fbc8cdb5/requests/sessions.py#L619-L622

If you never want to trust the environment, you should always set `Session.trust_env = False` which is documented as being the canonical and correct way to ignore env vars.


I see. That's not documented anywhere either as far as I can see. `Session.send`'s documentation doesn't even mention what kwargs it accepts. So yeah, definitely needs some documentation changes then I think, at least in the section I referenced but ideally also on `Session.send`.