diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index ae99c8077c3..60e8044a825 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -748,7 +748,7 @@ try_again: PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); - /* TODO: Support for qop="auth-int" */ + /* TODO: Support for qop=auth-int */ PHP_MD5Update(&md5ctx, (unsigned char*)"auth", sizeof("auth")-1); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); } @@ -784,11 +784,11 @@ try_again: } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - /* TODO: Support for qop="auth-int" */ - smart_str_append_const(&soap_headers, "\", qop=\"auth"); - smart_str_append_const(&soap_headers, "\", nc=\""); + /* TODO: Support for qop=auth-int */ + smart_str_append_const(&soap_headers, "\", qop=auth"); + smart_str_append_const(&soap_headers, ", nc="); smart_str_appendl(&soap_headers, nc, 8); - smart_str_append_const(&soap_headers, "\", cnonce=\""); + smart_str_append_const(&soap_headers, ", cnonce=\""); smart_str_appendl(&soap_headers, cnonce, 8); } smart_str_append_const(&soap_headers, "\", response=\""); diff --git a/ext/soap/tests/bugs/bug55639.phpt b/ext/soap/tests/bugs/bug55639.phpt new file mode 100644 index 00000000000..16d7f7a3771 --- /dev/null +++ b/ext/soap/tests/bugs/bug55639.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #55639 (Digest authentication dont work) +--INI-- +soap.wsdl_cache_enabled=0 +--EXTENSIONS-- +soap +--SKIPIF-- + +--FILE-- + 'http://' . PHP_CLI_SERVER_ADDRESS, + 'uri' => 'misc-uri', + 'authentication' => SOAP_AUTHENTICATION_DIGEST, + 'realm' => 'myrealm', + 'login' => 'user', + 'password' => 'pass', + 'trace' => true, +]); + +try { + $client->__soapCall("foo", []); +} catch (Throwable $e) { + echo $e->getMessage(), "\n"; +} + +$headers = $client->__getLastRequestHeaders(); +var_dump($headers); + +?> +--EXPECTF-- +Unauthorized +string(%d) "POST / HTTP/1.1 +Host: %s +Connection: Keep-Alive +User-Agent: %s +Content-Type: text/xml; charset=utf-8 +SOAPAction: "misc-uri#foo" +Content-Length: %d +Authorization: Digest username="user", realm="realm", nonce="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", uri="/", qop=auth, nc=00000001, cnonce="%s", response="%s", opaque="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + +"