mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-23 15:33:43 +00:00
2003-04-04 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWAdaptors/Apache/GNUmakefile-Apache2x: o fix to find apxs2 * GSWAdaptors/comon/GSWHTTPHeaders.h/.m: o added g_szHeader_GSWeb_Protocol, g_szHeader_GSWeb_ProtocolNum, g_szServerInfo_Protocol, g_szServerInfo_ProtocolNum, g_szServerInfo_RequestScheme, g_szHeader_GSWeb_RequestScheme * GSWAdaptors/Apache/mod_gsweb: o added module version with apache2 o 1.x/2.x compatibility macro o fix header port o added protocol, protocol num and request scheme information git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@16361 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
70bda8d674
commit
e86f58aae2
4 changed files with 87 additions and 31 deletions
|
@ -29,7 +29,11 @@
|
|||
#Solaris, Linux, FreeBSD
|
||||
|
||||
OSNAME := "$(shell uname)"
|
||||
APXS := "$(shell which apxs2)"
|
||||
|
||||
ifeq ("no apxs",$(findstring no apxs,$(APXS)))
|
||||
APXS := "$(shell which apxs)"
|
||||
endif
|
||||
|
||||
ifeq ("",$(strip $(APXS)))
|
||||
ifeq ("FreeBSD",$(strip $(OSNAME)))
|
||||
|
@ -43,10 +47,10 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
APACHE_LIBEXECDIR := $(shell apxs -q LIBEXECDIR)
|
||||
APACHEHEADERS := -I$(shell apxs -q INCLUDEDIR)
|
||||
APACHE_CFLAGS := $(shell apxs -q CFLAGS)
|
||||
APACHE_CC := $(shell apxs -q CC)
|
||||
APACHE_LIBEXECDIR := $(shell $(APXS) -q LIBEXECDIR)
|
||||
APACHEHEADERS := -I$(shell $(APXS) -q INCLUDEDIR)
|
||||
APACHE_CFLAGS := $(shell $(APXS) -q CFLAGS)
|
||||
APACHE_CC := $(shell $(APXS) -q CC)
|
||||
|
||||
SRCROOT = ..
|
||||
DSTROOT = .
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define moduleRevision "$Revision$"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
@ -62,6 +64,7 @@ typedef struct _GSWeb_Config
|
|||
// const char *pszRoot; // normally htdocs/GSWeb
|
||||
} GSWeb_Config;
|
||||
|
||||
|
||||
#ifdef Apache2
|
||||
/*
|
||||
* Declare ourselves so the configuration routines can find and know us.
|
||||
|
@ -98,6 +101,14 @@ struct table
|
|||
};
|
||||
#endif
|
||||
|
||||
// 1.x/2.x Compatibility
|
||||
#ifdef Apache2
|
||||
#define APR_PSPRINTF apr_psprintf
|
||||
#else
|
||||
#define APR_PSPRINTF ap_psprintf
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
static CONST char *GSWeb_SetDocRoot(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
|
@ -122,6 +133,18 @@ GSWeb_GetServerConfig(server_rec *p_pServerRec)
|
|||
}
|
||||
|
||||
|
||||
#ifdef Apache2
|
||||
static int GSWeb_PostConfig(apr_pool_t *p, apr_pool_t *plog,
|
||||
apr_pool_t *ptemp, server_rec *s)
|
||||
{
|
||||
ap_add_version_component(p,
|
||||
"mod_gsweb/"
|
||||
GSWEB_SERVER_ADAPTOR_VERSION_MAJOR_STRING
|
||||
"." GSWEB_SERVER_ADAPTOR_VERSION_MINOR_STRING
|
||||
"-" moduleRevision);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
//--------------------------------------------------------------------
|
||||
// Init
|
||||
#ifdef Apache2
|
||||
|
@ -296,8 +319,8 @@ copyHeaders(request_rec *p_pRequestRec,
|
|||
conn_rec *pConnection = p_pRequestRec->connection;
|
||||
const array_header *headers_arr=ap_table_elts(p_pRequestRec->headers_in);
|
||||
table_entry *headers=NULL;
|
||||
int i;
|
||||
char szPort[40]="";
|
||||
int i=0;
|
||||
char *pszPort=NULL;
|
||||
CONST char *pszRemoteLogName=NULL;
|
||||
GSWLog(GSW_DEBUG,pServerRec,"Start copyHeaders");
|
||||
|
||||
|
@ -308,8 +331,9 @@ copyHeaders(request_rec *p_pRequestRec,
|
|||
if (headers[i].key)
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
headers[i].key,headers[i].val);
|
||||
//GSWLog(GSW_DEBUG,pServerRec,"HEADERS %s=%s",headers[i].key,headers[i].val);
|
||||
};
|
||||
|
||||
|
||||
// Add server headers
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_ServerSoftware,
|
||||
|
@ -318,18 +342,31 @@ copyHeaders(request_rec *p_pRequestRec,
|
|||
#else
|
||||
SERVER_VERSION
|
||||
#endif
|
||||
);
|
||||
);
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_RequestScheme,
|
||||
ap_http_method(p_pRequestRec));
|
||||
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_Protocol,
|
||||
p_pRequestRec->protocol);
|
||||
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_ProtocolNum,
|
||||
APR_PSPRINTF(p_pRequestRec->pool,
|
||||
"%u",
|
||||
p_pRequestRec->proto_num));
|
||||
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_ServerName,
|
||||
pServerRec->server_hostname);
|
||||
ap_snprintf(szPort,
|
||||
sizeof(szPort),
|
||||
"%u",
|
||||
pServerRec->port);
|
||||
|
||||
pszPort = APR_PSPRINTF(p_pRequestRec->pool,
|
||||
"%u",
|
||||
pServerRec->port);
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_ServerPort,
|
||||
szPort);
|
||||
pszPort);
|
||||
#ifdef Apache2
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_RemoteHost,
|
||||
|
@ -355,18 +392,17 @@ copyHeaders(request_rec *p_pRequestRec,
|
|||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_ScriptFileName,
|
||||
p_pRequestRec->filename);
|
||||
ap_snprintf(szPort,
|
||||
sizeof(szPort),
|
||||
"%d",
|
||||
pszPort = APR_PSPRINTF(p_pRequestRec->pool,
|
||||
"%u",
|
||||
#ifdef Apache2
|
||||
pConnection->remote_addr->port
|
||||
pConnection->remote_addr->port
|
||||
#else
|
||||
ntohs(pConnection->remote_addr.sin_port)
|
||||
ntohs(pConnection->remote_addr.sin_port)
|
||||
#endif
|
||||
);
|
||||
);
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_RemotePort,
|
||||
szPort);
|
||||
pszPort);
|
||||
|
||||
#ifdef Apache2
|
||||
//TODO
|
||||
|
@ -431,16 +467,10 @@ sendResponse(request_rec *p_pRequestRec,
|
|||
GSWDict_PerformForAllElem(p_pHTTPResponse->pHeaders,getHeader,p_pRequestRec);
|
||||
|
||||
GSWLog(GSW_DEBUG,pServerRec,"status message=[%s]",p_pHTTPResponse->pszStatusMessage);
|
||||
#ifdef APACHE2
|
||||
p_pRequestRec->status_line = APR_PSPRINTF(p_pRequestRec->pool,"%u %s",
|
||||
p_pHTTPResponse->uStatus,
|
||||
p_pHTTPResponse->pszStatusMessage);
|
||||
|
||||
p_pRequestRec->status_line = apr_psprintf(p_pRequestRec->pool,"%u %s",
|
||||
p_pHTTPResponse->uStatus,
|
||||
p_pHTTPResponse->pszStatusMessage);
|
||||
#else
|
||||
p_pRequestRec->status_line = ap_psprintf(p_pRequestRec->pool,"%u %s",
|
||||
p_pHTTPResponse->uStatus,
|
||||
p_pHTTPResponse->pszStatusMessage);
|
||||
#endif
|
||||
p_pRequestRec->status = p_pHTTPResponse->uStatus;
|
||||
GSWLog(GSW_DEBUG,pServerRec,"p_pRequestRec->status_line=[%s]",p_pRequestRec->status_line);
|
||||
|
||||
|
@ -700,7 +730,9 @@ static void
|
|||
GSWeb_register_hooks(apr_pool_t *p)
|
||||
{
|
||||
/* ap_hook_pre_config(GSWeb_PreConfig, NULL, NULL, APR_HOOK_MIDDLE);
|
||||
*/
|
||||
ap_hook_post_config(GSWeb_PostConfig, NULL, NULL, APR_HOOK_MIDDLE);
|
||||
/*
|
||||
ap_hook_open_logs(GSWeb_OpenLogs, NULL, NULL, APR_HOOK_MIDDLE);
|
||||
*/
|
||||
ap_hook_child_init(GSWeb_ChildInit, NULL, NULL, APR_HOOK_MIDDLE);
|
||||
|
|
|
@ -57,6 +57,9 @@ const char *g_szHeader_GSWeb_AuthPass="x-gsweb-auth-pass";
|
|||
const char *g_szHeader_GSWeb_AuthType="x-gsweb-auth-type";
|
||||
const char *g_szHeader_GSWeb_DocumentRoot="x-gsweb-documentroot";
|
||||
const char *g_szHeader_GSWeb_GatewayInterface="x-gsweb-gateway-interface";
|
||||
const char *g_szHeader_GSWeb_Protocol="x-gsweb-server-protocol";
|
||||
const char *g_szHeader_GSWeb_ProtocolNum="x-gsweb-server-protocol-num";
|
||||
const char *g_szHeader_GSWeb_RequestScheme="x-gsweb-request-scheme";
|
||||
|
||||
const char *g_szHeader_Accept="accept";
|
||||
const char *g_szHeader_AcceptEncoding="accept-encoding";
|
||||
|
@ -132,6 +135,9 @@ const char *g_szServerInfo_HTTPGSWebRecording="HTTP_X_GSWEB_RECORDING";
|
|||
const char *g_szServerInfo_ServerAdmin="SERVER_ADMIN";
|
||||
const char *g_szServerInfo_ScriptFileName="SCRIPT_FILENAME";
|
||||
const char *g_szServerInfo_RemotePort="REMOTE_PORT";
|
||||
const char *g_szServerInfo_Protocol="PROTOCOL";
|
||||
const char *g_szServerInfo_ProtocolNum="PROTOCOL_NUM";
|
||||
const char *g_szServerInfo_RequestScheme="REQUEST_SCHEME";
|
||||
|
||||
const char *g_szMethod_Get="GET";
|
||||
const char *g_szMethod_Post="POST";
|
||||
|
@ -248,6 +254,15 @@ GSWHeaderTranslationTable_Init()
|
|||
GSWHeaderTranslationTable[i].pszHTTP=g_szServerInfo_ServerSoftware;
|
||||
GSWHeaderTranslationTable[i++].pszGSWeb=g_szHeader_GSWeb_ServerSoftware;
|
||||
|
||||
GSWHeaderTranslationTable[i].pszHTTP=g_szServerInfo_Protocol;
|
||||
GSWHeaderTranslationTable[i++].pszGSWeb=g_szHeader_GSWeb_Protocol;
|
||||
|
||||
GSWHeaderTranslationTable[i].pszHTTP=g_szServerInfo_ProtocolNum;
|
||||
GSWHeaderTranslationTable[i++].pszGSWeb=g_szHeader_GSWeb_ProtocolNum;
|
||||
|
||||
GSWHeaderTranslationTable[i].pszHTTP=g_szServerInfo_RequestScheme;
|
||||
GSWHeaderTranslationTable[i++].pszGSWeb=g_szHeader_GSWeb_RequestScheme;
|
||||
|
||||
GSWHeaderTranslationTable[i].pszHTTP=NULL;
|
||||
GSWHeaderTranslationTable[i++].pszGSWeb=NULL;
|
||||
|
||||
|
|
|
@ -40,7 +40,9 @@ extern const char *g_szHeader_GSWeb_AuthPass;
|
|||
extern const char *g_szHeader_GSWeb_AuthType;
|
||||
extern const char *g_szHeader_GSWeb_DocumentRoot;
|
||||
extern const char *g_szHeader_GSWeb_GatewayInterface;
|
||||
|
||||
extern const char *g_szHeader_GSWeb_Protocol;
|
||||
extern const char *g_szHeader_GSWeb_ProtocolNum;
|
||||
extern const char *g_szHeader_GSWeb_HTTPMethod;
|
||||
|
||||
extern const char *g_szHeader_Accept;
|
||||
extern const char *g_szHeader_AcceptEncoding;
|
||||
|
@ -78,7 +80,7 @@ extern const char *g_szServerInfo_HTTPMimeVersion;
|
|||
extern const char *g_szServerInfo_HTTPPragma;
|
||||
extern const char *g_szServerInfo_HTTPReferer;
|
||||
extern const char *g_szServerInfo_RemoteIdent;
|
||||
extern const char *g_szServerInfo_RequestMethod;
|
||||
extern const char *g_szServerInfo_RequestScheme;
|
||||
|
||||
extern const char *g_szServerInfo_AnnotationServer;
|
||||
extern const char *g_szServerInfo_AuthPass;
|
||||
|
@ -114,6 +116,9 @@ extern const char *g_szServerInfo_HTTPGSWebRecording;
|
|||
extern const char *g_szServerInfo_ServerAdmin;
|
||||
extern const char *g_szServerInfo_ScriptFileName;
|
||||
extern const char *g_szServerInfo_RemotePort;
|
||||
extern const char *g_szServerInfo_Protocol;
|
||||
extern const char *g_szServerInfo_ProtocolNum;
|
||||
extern const char *g_szServerInfo_RequestScheme;
|
||||
|
||||
extern const char *g_szMethod_Get;
|
||||
extern const char *g_szMethod_Post;
|
||||
|
|
Loading…
Reference in a new issue