mirror of
https://github.com/curl/curl.git
synced 2026-07-08 15:27:17 +03:00
digest: produce a shorter cnonce in Digest headers
Other programs (Postman, Chrome, Python request) use a 16 byte cnonce and there are instances of server-side implementations that don't support the larger lengths curl used previously. Fixes #15653 Reported-by: Florian Eckert Closes #15670
This commit is contained in:
parent
509f50e58d
commit
c948971e83
1 changed files with 8 additions and 4 deletions
|
|
@ -709,13 +709,17 @@ static CURLcode auth_create_digest_http_message(
|
|||
digest->nc = 1;
|
||||
|
||||
if(!digest->cnonce) {
|
||||
char cnoncebuf[33];
|
||||
result = Curl_rand_hex(data, (unsigned char *)cnoncebuf,
|
||||
sizeof(cnoncebuf));
|
||||
char cnoncebuf[12];
|
||||
result = Curl_rand_bytes(data,
|
||||
#ifdef DEBUGBUILD
|
||||
TRUE,
|
||||
#endif
|
||||
(unsigned char *)cnoncebuf,
|
||||
sizeof(cnoncebuf));
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
result = Curl_base64_encode(cnoncebuf, strlen(cnoncebuf),
|
||||
result = Curl_base64_encode(cnoncebuf, sizeof(cnoncebuf),
|
||||
&cnonce, &cnonce_sz);
|
||||
if(result)
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue