Skip to content

Incorrect behaviour of proxy_is_verified #3130

@tushar5526

Description

@tushar5526

Subject

proxy_is_verified is never set for HTTPs to HTTP proxies. proxy_is_verified is set only at https://github.com/urllib3/urllib3/blob/main/src/urllib3/connection.py#L694 and the function _connect_tls_proxy containing this line is called only when we are creating a HTTP tunnel https://github.com/urllib3/urllib3/blob/main/src/urllib3/connection.py#L672. We would have to set the value for proxy_is_verified for scenarios when we are not using a TLS-in-TLS tunnel and instead setting up a TLS connection for HTTPs to HTTP case.

More context - #3070 (review)

Environment

Describe your environment.
At least, paste here the output of:

import platform
import ssl
import urllib3

print("OS", platform.platform()) # OS macOS-13.4.1-arm64-arm-64bit
print("Python", platform.python_version()) # Python 3.10.12
print(ssl.OPENSSL_VERSION) # OpenSSL 3.1.1 30 May 2023
print("urllib3", urllib3.__version__) # urllib3 1.26.14

Steps to Reproduce

You can add a print statement to print proxy_is_verified for HTTPS to HTTP connection. The value of proxy_is_verified is set to None and never updated to False for the following example.

proxy = urllib3.ProxyManager('https://127.0.0.1:8443', cert_reqs='NONE')
res = proxy.request('GET', 'https://bff.familyid.samagra.io')

Expected Behavior

proxy_is_verified set to False or True appropriately.

Actual Behavior

According to this comment in code if we are connected to proxy, it should not be Nonfe

# If no proxy is currently connected to the value will be ``None``.

But proxy_is_verified is set to None instead of False

What happens instead.

For HTTPS proxy connection to HTTP host, proxy_is_verified is never set properly. proxy_is_verified is set appropriately for HTTPS to HTTPS connections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💰 Bounty $300If you complete this issue we'll pay you $300 on OpenCollective!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy