summaryrefslogtreecommitdiff
path: root/mod_php3.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-05-12 22:49:23 +0000
committerZeev Suraski <zeev@php.net>1999-05-12 22:49:23 +0000
commit52ac2e67c14e12c82797bb8ee7be87c12b11c7b9 (patch)
tree97e30f16b88668cc218b79f061a90966bb9f55ef /mod_php3.c
parent49b01a4b3dc6d660e33801bdae840c9448da11cc (diff)
downloadphp-git-52ac2e67c14e12c82797bb8ee7be87c12b11c7b9.tar.gz
Enable Apache HTTP Auth
Diffstat (limited to 'mod_php3.c')
-rw-r--r--mod_php3.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/mod_php3.c b/mod_php3.c
index 924124b1ce..8c64c96f94 100644
--- a/mod_php3.c
+++ b/mod_php3.c
@@ -201,6 +201,8 @@ static void init_request_info(SLS_D)
{
request_rec *r = ((request_rec *) SG(server_context));
char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
+ const char *authorization=NULL;
+ char *tmp;
SG(request_info).query_string = r->args;
SG(request_info).path_translated = r->filename;
@@ -208,6 +210,26 @@ static void init_request_info(SLS_D)
SG(request_info).request_method = r->method;
SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+
+ if (r->headers_in) {
+ authorization = table_get(r->headers_in, "Authorization");
+ }
+ if (authorization
+ && !auth_type(r)
+ && !strcmp(getword(r->pool, &authorization, ' '), "Basic")) {
+ tmp = uudecode(r->pool, authorization);
+ SG(request_info).auth_user = getword_nulls_nc(r->pool, &tmp, ':');
+ if (SG(request_info).auth_user) {
+ SG(request_info).auth_user = estrdup(SG(request_info).auth_user);
+ }
+ SG(request_info).auth_password = tmp;
+ if (SG(request_info).auth_password) {
+ SG(request_info).auth_password = estrdup(SG(request_info).auth_password);
+ }
+ } else {
+ SG(request_info).auth_user = NULL;
+ SG(request_info).auth_password = NULL;
+ }
}
@@ -275,7 +297,6 @@ int send_php3(request_rec *r, int display_source_mode, char *filename)
chdir_file(filename);
add_common_vars(r);
add_cgi_vars(r);
- init_request_info();
apache_php3_module_main(r, fd, display_source_mode SLS_CC);
/* Done, restore umask, turn off timeout, close file and return */