ID:               35170
 Updated by:       [EMAIL PROTECTED]
 Reported By:      lacak at users dot sourceforge dot net
-Status:           Open
+Status:           Critical
-Bug Type:         Feature/Change Request
+Bug Type:         Apache2 related
 Operating System: Windows
 PHP Version:      5.1.0RC4
 New Comment:

Advertised new features should actually work. 


Previous Comments:
------------------------------------------------------------------------

[2005-11-09 13:20:59] lacak at users dot sourceforge dot net

Description:
------------
PHP_AUTH_DIGEST differs under Apache 1.x and 2.x

Apache 1.x:
 _SERVER["PHP_AUTH_DIGEST"]='username="user1", realm="www.realm.sk-0",
qop="auth", algorithm="MD5", uri="/devel/php_auth.php", nonce="nonce",
nc=00000001, cnonce="11a85ba98273fe0f5578597b1dbf3082",
opaque="opaque", response="088685b1533e542920e1c47b59696b9c"';
Apache 2.x:
 _SERVER["PHP_AUTH_DIGEST"]='Digest username="cd",
realm="www.realm.sk", nonce="nonce", uri="/~cb/php_auth.php",
response="bedf1a35418a3712adc0aea22e94d9f2", opaque="opaque", qop=auth,
nc=00000001, cnonce="082c875dcb2ca740"';

Under Apache 2.x the word "Digest " is at the begining. Under Apache
1.x is not.

Resolution:
1. strip out leading "Digest " from PHP_AUTH_DIGEST in Apache 2.x
2. or add "Digest " at the begining PHP_AUTH_DIGEST in Apache 1.x (but
is redundant)
3. or the best solution is change PHP_AUTH_DIGEST to associative array
(parse string and build array elements from it; similar way how cookies
are parsed) :
(Otherwise this step must be always done in php script)
PHP_AUTH_DIGEST["username"]="user1";
PHP_AUTH_DIGEST["realm"]="www.realm.sk-0";
...
This is example in PHP how to convert PHP_AUTH_DIGEST string to array
:
 foreach(explode(", ", $_SERVER["PHP_AUTH_DIGEST"] as $auth1) {
    list($authkey,$authvalue)=explode("=",$auth1,2);
    if (substr($authvalue,0,1)=='"' && substr($authvalue,-1,1)=='"')
$authvalue=substr($authvalue,1,-1); /*strip out double quotes*/
    $auth[$authkey]=$authvalue;
 }
 /* at this point $auth array contains what we need */

Please incorporate this feature to php source code.
Thank you very much for your time and effort.
Laco.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35170&edit=1

Reply via email to