Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Intermediate Response headers not printed for Digest Auth

未关闭
#1,603 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python
领域
cli

调研方向

针对 digest-auth 端点运行提供的 HTTPie 命令,并将其与 curl 输出进行比较。跟踪 DigestAuthPlugin、requests.request 调用以及 --all/--print 处理如何表示中间响应;完成的标准是初始的 401 标头和最终的 200 响应都按文档所述显示。

由索引模型根据 Issue 内容生成。

描述

bug new

Checklist

  • I've searched for similar issues.
  • I'm using the latest version of HTTPie.

Minimal reproduction code and steps

  1. show with curl
curl https://httpbin.io/digest-auth/auth/user/pass -i --digest --user 'user:pass'
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Www-Authenticate: Digest qop=auth, realm="httpbin.io", algorithm=MD5, nonce=0466467c2af05e1dc3647666a0881e5f, opaque=dace930722adc22226b9b442aa01127f
Date: Fri, 04 Oct 2024 14:18:46 GMT
Content-Length: 52

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Date: Fri, 04 Oct 2024 14:18:46 GMT
Content-Length: 43

{
  "authorized": true,
  "user": "user"
}
  1. show with http
http --verbose --print=HhBbm -A digest -a 'user:pass' --all https://httpbin.io/digest-auth/auth/user/pass
GET /digest-auth/auth/user/pass HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Host: httpbin.io
User-Agent: HTTPie/3.2.3



HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Length: 43
Content-Type: application/json; charset=utf-8
Date: Fri, 04 Oct 2024 14:17:26 GMT

{
    "authorized": true,
    "user": "user"
}

The 401 Response is missing although I have specified --all and the documentation explicitely states that "The intermediary HTTP communication include followed redirects (with --follow), the first unauthorized request when HTTP digest authentication is used (--auth=digest), etc."

See https://httpie.io/docs/cli/viewing-intermediary-requestsresponses

Current result

The 401 Response is missing

Expected result

The 401 Response should be displayed


Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

http --debug --print=HhBbm -A digest -a 'user:pass' --all https://httpbin.io/digest-auth/auth/user/pass
HTTPie 3.2.3
Requests 2.31.0
Pygments 2.18.0
Python 3.12.6 (main, Sep  6 2024, 19:03:47) [Clang 15.0.0 (clang-1500.3.9.4)]
/opt/homebrew/Cellar/httpie/3.2.3/libexec/bin/python
Darwin 23.6.0

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x106774d60>,
 'args': Namespace(),
 'as_silent': <function Environment.as_silent at 0x106774c20>,
 'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/Users/Sven/.config/httpie'),
 'devnull': <property object at 0x106756f70>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x106774cc0>,
 'program_name': 'http',
 'quiet': 0,
 'rich_console': <functools.cached_property object at 0x10674f6e0>,
 'rich_error_console': <functools.cached_property object at 0x10674f740>,
 '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 0x106b59520>,
 'data': RequestJSONDataDict(),
 'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.3')>,
 'method': 'get',
 'params': <generator object MultiValueOrderedDict.items at 0x106916b60>,
 'url': 'https://httpbin.io/digest-auth/auth/user/pass'})

GET /digest-auth/auth/user/pass HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Host: httpbin.io
User-Agent: HTTPie/3.2.3



HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Length: 43
Content-Type: application/json; charset=utf-8
Date: Fri, 04 Oct 2024 14:27:01 GMT

{
    "authorized": true,
    "user": "user"
}


Elapsed time: 0.002145583s
主要语言
Python
星标
38.6k
派生
4k
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

httpie/cli 的其他 Issue

查看 httpie/cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。