Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy configuration not working properly if URL protocol is http #8

Open
em5686 opened this issue Sep 4, 2024 · 0 comments
Open

Proxy configuration not working properly if URL protocol is http #8

em5686 opened this issue Sep 4, 2024 · 0 comments

Comments

@em5686
Copy link

em5686 commented Sep 4, 2024

For proxy URL such as http://<proxy_ip>:<proxy_port>, it is not possible to reach the https URL of ipinfo with current plugin.
Problem comes from a reuse of "proxy_type" variable in python code:

  • proxy_type is used to build the proxy URL: proxy_url = "{}://{}:{}".format(proxy_type, proxy_host, proxy_port)
  • proxy_type is used also to set the proxy to use: proxy_handler = urllib.request.ProxyHandler({proxy_type.lower(): proxy_url})

Problem: if the proxy_type is http, no proxy is set for https.

The following fix hardcode the fact the proxy should be used for https:
proxy_handler = urllib.request.ProxyHandler({"https": proxy_url})

As ipinfo.io URL is accessed via HTTPs, we would advise to use this "hardcoded" fix (for both http and https), as people configuring a proxy in ipinfo app are expecting this proxy to be used whether target URLs are http or https.
A more complicated solution could be to define proxy settings per protocol (one for http, one for https)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant