Uh oh!
There was an error while loading. Please reload this page.
fix DigestAuth default value for qop field - #2600
Conversation
Make the default qop value the same as Chrome, curl and others. Without this some servers will obviously give status 401.
skewty
commented
Feb 22, 2023
if you will accept this change, I will adjust the tests as well. |
lovelydinosaur
commented
Feb 23, 2023
Are you able to show us how to confirm this? Using this command: $ curl -v 'https://jigsaw.w3.org/HTTP/Digest/' --digest -u guest:guestI see the following header... > Authorization: Digest username="guest", realm="test", nonce="e4f988c95c2f85eb3e8501b313f76576", uri="/HTTP/Digest/", response="f8d36a13eaf246e1eb5268c7806a294a"
Are you able to provide an example against a public URL? |
skewty
commented
Feb 23, 2023
I am not aware of any public URLs as Digest auth isn't so popular anymore. Here is an example: $ curl --digest -u Admin:456 http://192.168.1.141/polling/deviceHandler
<PolycomIPPhone><DeviceInformation><MACAddress>00907a147020</MACAddress><PhoneDN>Line1:2009</PhoneDN><AppLoadID>5.0.0.2079 06-Sep-16 08:24</AppLoadID><UpdaterID>5.0.0.2079</UpdaterID><ModelNumber>Spectralink 8440</ModelNumber><TimeStamp>2023-02-23T09:15:51-08:00</TimeStamp></DeviceInformation>$ python
>>> import httpx
>>> httpx.get("http://192.168.1.141/polling/deviceHandler", auth=httpx.DigestAuth("Admin", "456"))
<Response [401 Unauthorized]>I also used my JetBrains PyCharm Pro IDE built in HTTP client and it doesn't give 401 either. I also tried Brave (Chrome) and it brought up a dialog to enter username + password and didn't give 401 either. I can do a Zoom / Teams / Code with Me call with you to show this isn't cheating with the copy and paste. |
skewty
commented
Mar 2, 2023
@tomchristie any decision on this yet? |
lovelydinosaur
commented
Mar 7, 2023
From my reading of https://httpwg.org/specs/rfc7616.html#authorization.request.header.field I think you've got this correct. The RFC states that...
Are you able to show use In any case, yes it looks to me like a more robust behaviour would be treating an omitted It looks like the typing of this... ...would need to be updated, and that we've got a couple of code branches checking |
skewty
commented
Apr 9, 2023
Here is the command I used:
Here is the output from the command:CommentsThe above command / operation worked as expected / designed; "Testing" was displayed on the screen of the phone / device. The |
lovelydinosaur
commented
Apr 20, 2023
I think this is worth progressing. It looks to me like there's a couple of other changes this will impact... class_DigestAuthChallenge(typing.NamedTuple):
realm: bytesnonce: bytesalgorithm: stropaque: typing.Optional[bytes]
qop: typing.Optional[bytes] # <--- no longer optionalAnd... ifqopisNone:
digest_data= [HA1, challenge.nonce, HA2] # <--- Assume this branch can no longer be followed?else:
digest_data= [challenge.nonce, nc_value, cnonce, qop, HA2] |
the-ress
commented
Jan 7, 2024
TLDR: This is not the right fix; I believe it's the same issue #3045 solves. Unspecified In short, there are two variants of digest auth - old one from RFC 2069, and a newer one from RFC 2617 (later updated in RFC 7616). The hash in constructed differently depending on which one is being used. Clients can differentiate by the presence of the Curl's doing the same thing: https://github.com/curl/curl/blob/8edcfedc1a144f438bd1cdf814a0016cbe678aaf/lib/vauth/digest.c#L793-L799 It looks like your SIP phone's using the older variant (2069). RFC 2069 implementation in httpx is currently broken, and #3045 fixes it. |
lovelydinosaur
commented
Jan 8, 2024
✨ thanks for getting a handle on this @the-ress. ✨ |
Make the default qop value the same as Chrome, curl and others.
Without this some servers will obviously give status 401.