Tested with Apache 2.2.6 and mod_fcgid-2.2:
static void fcgid_add_cgi_vars(request_rec * r)
{
char *authinfo, *decoded_line, *user, *pass;
int l;
apr_array_header_t *passheaders = get_pass_headers(r);
if (passheaders != NULL) {
const char **hdr = (const char **) passheaders->elts;
int hdrcnt = passheaders->nelts;
int i;
for (i = 0; i < hdrcnt; i++, ++hdr) {
const char *val = apr_table_get(r->headers_in, *hdr);
if (val)
apr_table_setn(r->subprocess_env, *hdr, val);
}
}
/* Work around cgi.fix_pathinfo = 1 in php.ini */
if (g_php_fix_pathinfo_enable) {
char *merge_path;
apr_table_t *e = r->subprocess_env;
/* "DOCUMENT_ROOT"/"SCRIPT_NAME" -> "SCRIPT_NAME" */
const char *doc_root = apr_table_get(e, "DOCUMENT_ROOT");
const char *script_name = apr_table_get(e, "SCRIPT_NAME");
if (doc_root && script_name
&& apr_filepath_merge(&merge_path, doc_root,
script_name, 0,
r->pool) ==
APR_SUCCESS) {
apr_table_setn(e, "SCRIPT_NAME", merge_path);
}
}
authinfo = apr_table_get(r->headers_in, "Authorization");
if (authinfo && authinfo[0] != '\0' && strncmp(authinfo, "Basic ", 6) == 0)
{
decoded_line = apr_palloc(r->pool, apr_base64_decode_len(authinfo + 6) +
1);
if(decoded_line != NULL) {
l = apr_base64_decode(decoded_line, authinfo+6);
/* Null-terminate the string. */
decoded_line[l] = '\0';
user = decoded_line;
if (user && (pass = strchr(user, ':')))
{
apr_table_t *e = r->subprocess_env;
*pass++ = '\0';
apr_table_setn(e, "PHP_AUTH_USER", user);
apr_table_setn(e, "PHP_AUTH_PW", pass);
}
}
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mod-fcgid-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users