Skip to content

Authorization header not printed when using digest auth #1447

@hickford

Description

@hickford

http -v -A digest -a username:password pie.dev/digest-auth/auth/username/password doesn't print the Authorization request header

I guess this is challenging because the header is populated in the requests library


> http -v -A digest -a username:password pie.dev/digest-auth/auth/username/password --debug
HTTPie 3.2.1
Requests 2.26.0
Pygments 2.7.1
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110]
/usr/bin/python3
Linux 5.10.142-19739-g5899aa8f604c

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x7aa7d104e700>,
 'args': Namespace(),
 'as_silent': <function Environment.as_silent at 0x7aa7d104e5e0>,
 'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/home/matt/.config/httpie'),
 'devnull': <property object at 0x7aa7d10f90e0>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x7aa7d104e670>,
 'program_name': 'http',
 'quiet': 0,
 'rich_console': <functools.cached_property object at 0x7aa7d1118d00>,
 'rich_error_console': <functools.cached_property object at 0x7aa7d10b1ee0>,
 'show_displays': True,
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'stderr_isatty': True,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
 'stdin_encoding': 'utf-8',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
 'stdout_encoding': 'utf-8',
 'stdout_isatty': True}>

<PluginManager {'adapters': [],
 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
          <class 'httpie.plugins.builtin.DigestAuthPlugin'>,
          <class 'httpie.plugins.builtin.BearerAuthPlugin'>],
 'converters': [],
 'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
                <class 'httpie.output.formatters.json.JSONFormatter'>,
                <class 'httpie.output.formatters.xml.XMLFormatter'>,
                <class 'httpie.output.formatters.colors.ColorFormatter'>]}>

>>> requests.request(**{'auth': <requests.auth.HTTPDigestAuth object at 0x7aa7d0ddce80>,
 'data': RequestJSONDataDict(),
 'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.1')>,
 'method': 'get',
 'params': <generator object MultiValueOrderedDict.items at 0x7aa7d0c63ac0>,
 'url': 'http://pie.dev/digest-auth/auth/username/password'})

GET /digest-auth/auth/username/password HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: pie.dev
User-Agent: HTTPie/3.2.1



HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
CF-Cache-Status: DYNAMIC
CF-RAY: 764f8c0d5d7e72c7-LHR
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json
Date: Fri, 04 Nov 2022 18:52:29 GMT
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ZopT9m6iwhzwDZHMAedQf0kZ4yELEqrElPOpkJwwm7w4BqJi9qVHrFlwBmKpWJT8%2FZxbLcdm%2B2HN2h2Cz%2FO0eS6JPqGeqN9wOum0%2F7wvvFv6f465Gu%2BEUNVE"}],"group":"cf-nel","max_age":604800}
Server: cloudflare
Set-Cookie: fake=fake_value; Path=/
Set-Cookie: stale_after=never; Path=/
Transfer-Encoding: chunked
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

{
    "authenticated": true,
    "user": "username"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnewNeeds triage. Comments are welcome!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions