Skip to content

Commit

Permalink
Properly handle the first source having user/pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzime committed Jul 31, 2018
1 parent d4f710b commit f78637f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def prepare_pip_source_args(sources, pip_args=None):
# Trust the host if it's not verified.
if not sources[0].get("verify_ssl", True):
pip_args.extend(
["--trusted-host", urlparse(sources[0]["url"]).netloc.split(":")[0]]
["--trusted-host", urlparse(sources[0]["url"]).hostname]
)
# Add additional sources as extra indexes.
if len(sources) > 1:
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,20 @@ def test_nix_normalize_drive(self, input_path, expected):
"https://user:[email protected]/simple",
],
),
(
[
{
"url": "https://user:[email protected]/simple",
"verify_ssl": False,
},
],
[
"-i",
"https://user:[email protected]/simple",
"--trusted-host",
"custom.example.com",
],
),
],
)
def test_prepare_pip_source_args(self, sources, expected_args):
Expand Down

0 comments on commit f78637f

Please sign in to comment.