summaryrefslogtreecommitdiff
path: root/sapi/apache_hooks/mod_php5.c
diff options
context:
space:
mode:
authorRui Hirokawa <hirokawa@php.net>2005-04-04 15:06:36 (GMT)
committerRui Hirokawa <hirokawa@php.net>2005-04-04 15:06:36 (GMT)
commit8235a70ef964c5c8d1fe7632a750b9e5c580c716 (patch)
treeda2b59d8efeafa417f0a23c5be6a0c3570729f9c /sapi/apache_hooks/mod_php5.c
parent4558cdade685dc38681bd09db821d9c5fad8d716 (diff)
downloadphp-8235a70ef964c5c8d1fe7632a750b9e5c580c716.tar.gz
added a server variable PHP_AUTH_DIGEST to support HTTP Digest Authentication.
Diffstat (limited to 'sapi/apache_hooks/mod_php5.c')
-rw-r--r--sapi/apache_hooks/mod_php5.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sapi/apache_hooks/mod_php5.c b/sapi/apache_hooks/mod_php5.c
index aafed49..93334f6 100644
--- a/sapi/apache_hooks/mod_php5.c
+++ b/sapi/apache_hooks/mod_php5.c
@@ -579,24 +579,26 @@ static void init_request_info(TSRMLS_D)
if (r->headers_in) {
authorization = table_get(r->headers_in, "Authorization");
}
- if (authorization
- && !auth_type(r)
- && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = NULL;
- tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (tmp_user) {
- r->connection->user = pstrdup(r->connection->pool, tmp_user);
- r->connection->ap_auth_type = "Basic";
- SG(request_info).auth_user = estrdup(tmp_user);
- }
- SG(request_info).auth_password = NULL;
- if (tmp) {
- SG(request_info).auth_password = estrdup(tmp);
+
+ SG(request_info).auth_user = NULL;
+ SG(request_info).auth_password = NULL;
+
+ if (authorization && !auth_type(r)) {
+ if (!strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
+ tmp = uudecode(r->pool, authorization);
+ tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
+ if (tmp_user) {
+ r->connection->user = pstrdup(r->connection->pool, tmp_user);
+ r->connection->ap_auth_type = "Basic";
+ SG(request_info).auth_user = estrdup(tmp_user);
+ }
+ if (tmp) {
+ SG(request_info).auth_password = estrdup(tmp);
+ }
+ } else if (!strcasecmp(getword(r->pool, &authorization, ' '), "Digest")) {
+ r->connection->ap_auth_type = "Digest";
+ SG(request_info).auth_digest = estrdup(authorization);
}
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
}
}
/* }}} */