Skip to content

Support (or don't support) including a port number in --trusted-host #6886

@frostming

Description

@frostming

What's the problem this feature will solve?
Refer to #6705
for HTTP indexes, --trusted-host option should be sans-port, if you give a port part then it aborts:

$ pip install -i http://localtest.me:5000 urllib3 --trusted-host localtest.me:5000
Looking in indexes: http://localtest.me:5000
Collecting urllib3
  The repository located at localtest.me is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host localtest.me'.
  Could not find a version that satisfies the requirement urllib3 (from versions: )
No matching distribution found for urllib3

While for HTTPS indexes, --trusted-host should carry the port. (Now a fix is landed on master to support both, with port and without port).

Describe the solution you'd like
Pip should handle trusted-host correctly, whether the host has a port part or not.
with --trusted-host example.org you trust all the subpaths and wildcard ports on the same host.
with --trusted-host example.org:8080 you only trust requests to 8080 port.

Alternative Solutions

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: finderPackageFinder and index related codeauto-lockedOutdated issues that have been locked by automationtype: enhancementImprovements to functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions