Skip to content

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

@em5686

Description

@em5686

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions