fix #39154: improve http digest auth regex

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@222638 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2006-11-01 15:37:09 +00:00
parent 00e12e606d
commit 8ab4410bc8

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.47 $ -->
<!-- $Revision: 1.48 $ -->
<chapter id="features.http-auth">
<title>HTTP authentication with PHP</title>
@ -107,10 +107,10 @@ function http_digest_parse($txt)
$needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
$data = array();
preg_match_all('@(\w+)=([\'"]?)([a-zA-Z0-9=./\_-]+)\2@', $txt, $matches, PREG_SET_ORDER);
preg_match_all('@(\w+)=(?:([\'"])([^\2]+)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
foreach ($matches as $m) {
$data[$m[1]] = $m[3];
$data[$m[1]] = $m[3] ? $m[3] : $m[4];
unset($needed_parts[$m[1]]);
}