pass more info to the application

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@26094 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2008-02-18 21:42:13 +00:00
parent 157908c52c
commit a3a6cc33b4
2 changed files with 49 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2008-02-18 David Wetzel <dave@turbocat.de>
* GSWAdaptors/Apache2/mod_gsw.c
pass more to the application
2008-02-13 David Ayers <ayers@fsfe.org>
* GSWeb.framework/GSWUtils.m (boolValueFor,boolValueWithDefaultFor): Rely

View file

@ -107,6 +107,7 @@ typedef struct gsw_app_conf {
#define SERVER_ADMIN "SERVER_ADMIN"
#define SCRIPT_FILENAME "SCRIPT_FILENAME"
#define REMOTE_PORT "REMOTE_PORT"
#define REMOTE_ADDR "REMOTE_ADDR"
#define REMOTE_USER "REMOTE_USER"
#define AUTH_TYPE "AUTH_TYPE"
#define REMOTE_IDENT "REMOTE_IDENT"
@ -114,6 +115,7 @@ typedef struct gsw_app_conf {
#define REDIRECT_URL "REDIRECT_URL"
//#define CRLF "\r\n"
/*
@ -739,6 +741,15 @@ x-webobjects-adaptorstats: applicationThreadCreation=+0.000s applicationThreadRu
*/
static int send_header_string(int soc, const char * key, const char * value, request_rec *r)
{
int retval = 0;
char tmpStr[512];
snprintf(tmpStr, sizeof(tmpStr)-1, "%s: %s\r\n",key, value);
retval = write_sock(soc, tmpStr, strlen(tmpStr), r);
}
static int send_headers(int soc, request_rec *r)
{
apr_array_header_t * hdrs_arr = NULL;
@ -746,6 +757,7 @@ static int send_headers(int soc, request_rec *r)
int retval = 0;
int i = 0;
char tmpStr[512];
const char * ap_str;
server_rec * s = r->server;
conn_rec * c = r->connection;
@ -771,10 +783,42 @@ static int send_headers(int soc, request_rec *r)
snprintf(tmpStr, sizeof(tmpStr), X_WO_VERSION_HEADER);
retval = write_sock(soc, tmpStr, strlen(tmpStr), r);
retval = send_header_string(soc, SERVER_NAME, s->server_hostname, r);
// SERVER_PORT
snprintf(tmpStr, sizeof(tmpStr), "SERVER_PORT: %hu\r\n",ap_get_server_port(r));
retval = write_sock(soc, tmpStr, strlen(tmpStr), r);
retval = send_header_string(soc, REMOTE_ADDR, c->remote_ip, r);
if (r->user != NULL) {
retval = send_header_string(soc, REMOTE_USER, r->user, r);
}
if (r->ap_auth_type != NULL) {
retval = send_header_string(soc, AUTH_TYPE, r->ap_auth_type, r);
}
ap_str = (char *)ap_get_remote_logname(r);
if (ap_str != NULL) {
retval = send_header_string(soc, REMOTE_IDENT, ap_str, r);
}
/*
* Apache custom responses. If we have redirected, add special headers
*/
if (r->prev) {
if (r->prev->args) {
retval = send_header_string(soc, REDIRECT_QUERY_STRING, r->prev->args, r);
}
if (r->prev->uri) {
retval = send_header_string(soc, REDIRECT_URL, r->prev->uri, r);
}
}
return retval;
}