Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions httpie/cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
from argparse import RawDescriptionHelpFormatter
from textwrap import dedent
from urllib.parse import urlsplit
from urllib.parse import urlsplit, unquote

from requests.utils import get_netrc_auth

Expand Down Expand Up @@ -291,6 +291,9 @@ def _process_auth(self):
# Handle http://username:password@hostname/
username = url.username
password = url.password or ''
# Decode percent-encoded characters in username and password
username = unquote(username)
password = unquote(password)
self.args.auth = AuthCredentials(
key=username,
value=password,
Expand All @@ -306,7 +309,7 @@ def _process_auth(self):
if (not self.args.ignore_netrc
and self.args.auth is None
and plugin.netrc_parse):
# Only host needed, so its OK URL not finalized.
# Only host needed, so it's OK URL not finalized.
netrc_credentials = get_netrc_auth(self.args.url)
if netrc_credentials:
self.args.auth = AuthCredentials(
Expand Down Expand Up @@ -377,7 +380,7 @@ def _apply_no_options(self, no_options):
invalid.append(option)

if invalid:
self.error(f'unrecognized arguments: {" ".join(invalid)}')
self.error(f'unrecognized arguments: {"".join(invalid)}')

def _body_from_file(self, fd):
"""Read the data from a file-like object.
Expand Down Expand Up @@ -610,4 +613,4 @@ def error(self, message):
'''.rstrip()
)
)
self.exit(2)
self.exit(2)
Loading