summaryrefslogtreecommitdiff
path: root/main
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 /main
parent4558cdade685dc38681bd09db821d9c5fad8d716 (diff)
downloadphp-8235a70ef964c5c8d1fe7632a750b9e5c580c716.tar.gz
added a server variable PHP_AUTH_DIGEST to support HTTP Digest Authentication.
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c3
-rw-r--r--main/SAPI.h1
-rw-r--r--main/main.c5
-rw-r--r--main/php_variables.c3
4 files changed, 12 insertions, 0 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 5ff76c3..e6ce825 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -424,6 +424,9 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
if (SG(request_info).auth_password) {
efree(SG(request_info).auth_password);
}
+ if (SG(request_info).auth_digest) {
+ efree(SG(request_info).auth_digest);
+ }
if (SG(request_info).content_type_dup) {
efree(SG(request_info).content_type_dup);
}
diff --git a/main/SAPI.h b/main/SAPI.h
index 9ef7eec..3b132b8 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -98,6 +98,7 @@ typedef struct {
/* for HTTP authentication */
char *auth_user;
char *auth_password;
+ char *auth_digest;
/* this is necessary for the CGI SAPI module */
char *argv0;
diff --git a/main/main.c b/main/main.c
index e310abd..e0ed5c3 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1736,6 +1736,11 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC)
SG(request_info).auth_user = SG(request_info).auth_password = NULL;
}
+ if (auth && auth[0] != '\0' && strncmp(auth, "Digest ", 7) == 0) {
+ SG(request_info).auth_digest = estrdup(auth);
+ ret = 0;
+ }
+
return ret;
}
/* }}} */
diff --git a/main/php_variables.c b/main/php_variables.c
index 17a0d82..95995c2 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -515,6 +515,9 @@ static inline void php_register_server_variables(TSRMLS_D)
if (SG(request_info).auth_password) {
php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr TSRMLS_CC);
}
+ if (SG(request_info).auth_digest) {
+ php_register_variable("PHP_AUTH_DIGEST", SG(request_info).auth_digest, array_ptr TSRMLS_CC);
+ }
/* store request init time */
{
zval new_entry;