Intermediate Response headers not printed for Digest Auth
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Chạy lệnh HTTPie được cung cấp với endpoint digest-auth và so sánh với đầu ra của curl. Theo dõi cách DigestAuthPlugin, lệnh gọi requests.request và việc xử lý --all/--print biểu diễn các phản hồi trung gian; được xem là hoàn tất khi cả các header 401 ban đầu và phản hồi 200 cuối cùng đều được hiển thị như đã tài liệu hóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Checklist
- I've searched for similar issues.
- I'm using the latest version of HTTPie.
Minimal reproduction code and steps
- 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"
}
- 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
- Ngôn ngữ chính
- Python
- Star
- 38.6k
- Fork
- 4k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của httpie/cli
-
new
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug new
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
argparser.py: HTTPieArgumentParser has high cyclomatic complexity and mixed responsibilities Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
stephrobert/dsoxlab#238 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
sublimehq/package_control#1780 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
nwg-piotr/nwg-displays#145 ·