The lines are (with some padding, 51-56):
$md5->add($request->content);
my $content = $md5->hexdigest;
$md5->reset;
$md5->add(join(":", @digest[0..1], $content));
$md5->reset;
$resp{"message-digest"} = $md5->hexdigest;
It seems to me that in line 56 the value stored in that hash is not a MD5 digest of a message, but only the md5 of the empty string.
And this is the resulting HTTP-Authorize:-header:
Authorization: Digest username="someuser", realm="myrealm.de", qop="auth", algorithm="MD5", uri="/look_here", nonce="437ef90b37d69", nc="00000001", cnonce="46c650f4", response="f5b2ba3476fed859942ed823776710da", message-digest="d41d8cd98f00b204e9800998ecf8427e"
The message-digest has indeed the MD5 value of an empty string.
I think one could just comment out line 55. But when I tried that I still got a 401 (Authorization Required) from the server.
When I finally used a localhost proxy and filtered out both message-digest and algorithm from the header I was finally admitted to the realm. Would that be an error on the server side?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.