15.03.2023, 10:55
Thanks, here's a couple of things you can try:
1. Remove space between items in the Authorization header.
Replace:
With:
2. Modify the items and their order in the header.
Replace:
With:
3. Make the cnonce longer.
Replace:
With:
When setting cnonce manually I get the same header as curl does by applying change 1 and 2.
1. Remove space between items in the Authorization header.
Replace:
Code:
return 'Digest ' .. table.concat(digest, ', ')
Code:
return 'Digest ' .. table.concat(digest, ',')
2. Modify the items and their order in the header.
Replace:
Code:
local auth = {
{ 'username', user },
{ 'realm', ht.realm },
{ 'nonce', ht.nonce },
{ 'uri', uri },
{ 'cnonce', cnonce },
{ 'nc', nc, unquote = true },
{ 'qop', 'auth' },
{ 'algorithm', 'MD5' },
{ 'response', response },
}
Code:
local auth = {
{ 'username', user },
{ 'realm', ht.realm },
{ 'nonce', ht.nonce },
{ 'uri', uri },
{ 'cnonce', cnonce },
{ 'nc', nc, unquote = true },
-- { 'algorithm', 'MD5' },
{ 'response', response },
{ 'qop', 'auth' },
}
3. Make the cnonce longer.
Replace:
Code:
local cnonce = string.format('%08x', os.time())
Code:
local cnonce = md5sum(string.format('%08x', os.time()))
When setting cnonce manually I get the same header as curl does by applying change 1 and 2.