mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-05-31 09:11:11 +00:00
* GSWAdaptors/Apache/mod_gsweb.c (sendResponse): Add cast.
* GSWAdaptors/Apache/GNUmakefile-Apache1x: Update copyright and correct ADAPTOR variable. * GSWAdaptors/Doc/ConfigurationFile.html: Updated formatting. * GSWAdaptors/common/GSWAppConnectNSSocket.c (GSWApp_Open, GSWAppSendBlock, GSWApp_ReceiveLine, GSWApp_ReceiveBlock): Correct usage of GSWLog by addeding requiered parameter. * GSWAdaptors/common/GSWApp.[hc]: Updated copyright notice and applied some formatting. * GSWAdaptors/common/GSWAppConnect.h: Ditto. * GSWAdaptors/common/GSWAppConnectNSSocket.c: Ditto. * GSWAdaptors/common/GSWAppConnectSocket.c: Ditto. * GSWAdaptors/common/GSWAppRequest.[hc]: Ditto. * GSWAdaptors/common/GSWAppRequestStruct.h: Ditto. * GSWAdaptors/common/GSWConfig.[hc]: Ditto. * GSWAdaptors/common/GSWDict.[hc]: Ditto. * GSWAdaptors/common/GSWHTTPHeaders.[hc]: Ditto. * GSWAdaptors/common/GSWHTTPRequest.[hc]: Ditto. * GSWAdaptors/common/GSWHTTPResponse.[hc]: Ditto. * GSWAdaptors/common/GSWList.[hc]: Ditto. * GSWAdaptors/common/GSWLoadBalancing.[hc]: Ditto. * GSWAdaptors/common/GSWPropList.[hc]: Ditto. * GSWAdaptors/common/GSWString.[hc]: Ditto. * GSWAdaptors/common/GSWTemplates.[hc]: Ditto. * GSWAdaptors/common/GSWURLUtils.[hc]: Ditto. * GSWAdaptors/common/GSWUtils.[hc]: Ditto. * GSWAdaptors/common/common.make: Ditto. * GSWAdaptors/common/config.[hc]: Ditto. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@16089 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ef9aeb9211
commit
2e0c8afdee
40 changed files with 3998 additions and 3409 deletions
31
ChangeLog
31
ChangeLog
|
@ -1,3 +1,34 @@
|
|||
2003-02-28 David Ayers <d.ayers@inode.at>
|
||||
|
||||
* GSWAdaptors/Apache/mod_gsweb.c (sendResponse): Add cast.
|
||||
* GSWAdaptors/Apache/GNUmakefile-Apache1x: Update copyright and
|
||||
correct ADAPTOR variable.
|
||||
* GSWAdaptors/Doc/ConfigurationFile.html: Updated formatting.
|
||||
* GSWAdaptors/common/GSWAppConnectNSSocket.c (GSWApp_Open,
|
||||
GSWAppSendBlock, GSWApp_ReceiveLine, GSWApp_ReceiveBlock): Correct
|
||||
usage of GSWLog by addeding requiered parameter.
|
||||
* GSWAdaptors/common/GSWApp.[hc]: Updated copyright notice and
|
||||
applied some formatting.
|
||||
* GSWAdaptors/common/GSWAppConnect.h: Ditto.
|
||||
* GSWAdaptors/common/GSWAppConnectNSSocket.c: Ditto.
|
||||
* GSWAdaptors/common/GSWAppConnectSocket.c: Ditto.
|
||||
* GSWAdaptors/common/GSWAppRequest.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWAppRequestStruct.h: Ditto.
|
||||
* GSWAdaptors/common/GSWConfig.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWDict.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWHTTPHeaders.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWHTTPRequest.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWHTTPResponse.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWList.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWLoadBalancing.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWPropList.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWString.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWTemplates.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWURLUtils.[hc]: Ditto.
|
||||
* GSWAdaptors/common/GSWUtils.[hc]: Ditto.
|
||||
* GSWAdaptors/common/common.make: Ditto.
|
||||
* GSWAdaptors/common/config.[hc]: Ditto.
|
||||
|
||||
2003-02-20 Mirko Viviani <mirko.viviani@rccr.cremona.it>
|
||||
|
||||
* GSWAdaptors/common/GSWUtil.c|.h (strcasestr): removed CONST from
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Makefile for Apache 1.x GNUstepWeb module
|
||||
# Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
# Date: Jully 1999
|
||||
# Date: July 1999
|
||||
#
|
||||
# This file is part of the GNUstep Web Library.
|
||||
#
|
||||
|
@ -53,7 +53,7 @@ OBJROOT = .
|
|||
# Directory
|
||||
SERVERAPI = Apache
|
||||
|
||||
ADAPTOR = $(DSTROOT)/mod_gsweb.so
|
||||
ADAPTOR = mod_gsweb.so
|
||||
|
||||
LOADBALANCING = roundrobin
|
||||
ADAPTORLIB = $(OBJROOT)/libAdaptor.a
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -100,30 +100,45 @@ struct table
|
|||
};
|
||||
#endif
|
||||
|
||||
//static CONST char* GSWeb_SetDocRoot(cmd_parms* p_pCmdParams,void* p_pUnused,char *p_pszArg);
|
||||
static CONST char* GSWeb_SetScriptAlias(cmd_parms *p_pCmdParams, void *p_pUnused, char *p_pszArg);
|
||||
static CONST char *GSWeb_SetConfig(cmd_parms *p_pCmdParams, void *p_pUnused, char *p_pszArg);
|
||||
/*
|
||||
static CONST char *GSWeb_SetDocRoot(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
char *p_pszArg);
|
||||
*/
|
||||
static CONST char *GSWeb_SetScriptAlias(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
char *p_pszArg);
|
||||
static CONST char *GSWeb_SetConfig(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
char *p_pszArg);
|
||||
static int GSWeb_Handler(request_rec *p_pRequestRec);
|
||||
|
||||
/*
|
||||
* Locate our server configuration record for the current request.
|
||||
*/
|
||||
static GSWeb_Config *GSWeb_GetServerConfig(server_rec* p_pServerRec)
|
||||
static GSWeb_Config *
|
||||
GSWeb_GetServerConfig(server_rec *p_pServerRec)
|
||||
{
|
||||
return (GSWeb_Config*) ap_get_module_config(p_pServerRec->module_config, &GSWeb_Module);
|
||||
return (GSWeb_Config *)ap_get_module_config(p_pServerRec->module_config,
|
||||
&GSWeb_Module);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Init
|
||||
#ifdef Apache2
|
||||
static void GSWeb_ChildInit(apr_pool_t *p,server_rec* p_pServerRec)
|
||||
static void
|
||||
GSWeb_ChildInit(apr_pool_t *p,
|
||||
server_rec *p_pServerRec)
|
||||
#else
|
||||
static void GSWeb_Init(server_rec* p_pServerRec, pool *p)
|
||||
static void
|
||||
GSWeb_Init(server_rec *p_pServerRec,
|
||||
pool *p)
|
||||
#endif
|
||||
{
|
||||
GSWDict *pDict=GSWDict_New(0);
|
||||
GSWeb_Config *pConfig=NULL;
|
||||
|
||||
pConfig=GSWeb_GetServerConfig(p_pServerRec);
|
||||
GSWLog_Init(NULL,GSW_INFO);
|
||||
GSWLog(GSW_INFO,p_pServerRec,
|
||||
|
@ -136,10 +151,12 @@ static void GSWeb_Init(server_rec* p_pServerRec, pool *p)
|
|||
GSWDict_AddStringDup(pDict,
|
||||
g_szGSWeb_Conf_ConfigFilePath,
|
||||
pConfig->pszConfigPath);
|
||||
/* if (pConfig && pConfig->pszRoot)
|
||||
/*
|
||||
if (pConfig && pConfig->pszRoot)
|
||||
GSWDict_AddStringDup(pDict,
|
||||
g_szGSWeb_Conf_DocRoot,
|
||||
pConfig->pszRoot);*/
|
||||
pConfig->pszRoot);
|
||||
*/
|
||||
GSWLog(GSW_INFO,p_pServerRec,
|
||||
"GSWeb Init LB Init. Handler: " GSWEB_HANDLER);
|
||||
GSWConfig_Init(pDict,p_pServerRec);
|
||||
|
@ -151,12 +168,16 @@ static void GSWeb_Init(server_rec* p_pServerRec, pool *p)
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// Create Config
|
||||
static void* GSWeb_CreateServerConfig(pool* p_pPool,
|
||||
static void *
|
||||
GSWeb_CreateServerConfig(pool *p_pPool,
|
||||
server_rec *p_pServerRec)
|
||||
{
|
||||
GSWeb_Config *pConfig = (GSWeb_Config*)ap_palloc(p_pPool,sizeof(GSWeb_Config));
|
||||
GSWeb_Config *pConfig = (GSWeb_Config *)ap_palloc(p_pPool,
|
||||
sizeof(GSWeb_Config));
|
||||
|
||||
pConfig->pszGSWeb = g_szGSWeb_Prefix;
|
||||
GSWLog(GSW_DEBUG,p_pServerRec,"GSWeb_CreateServerConfig: pConfig->pszGSWeb=%s",
|
||||
GSWLog(GSW_DEBUG,p_pServerRec,
|
||||
"GSWeb_CreateServerConfig: pConfig->pszGSWeb=%s",
|
||||
pConfig->pszGSWeb);
|
||||
pConfig->pszConfigPath = NULL;
|
||||
// pConfig->pszRoot = NULL;
|
||||
|
@ -165,10 +186,14 @@ static void* GSWeb_CreateServerConfig(pool* p_pPool,
|
|||
/*
|
||||
//--------------------------------------------------------------------
|
||||
// Set Param: DocRoot
|
||||
static CONST char* GSWeb_SetDocRoot(cmd_parms* p_pCmdParams,void* p_pUnused,char *p_pszArg)
|
||||
static CONST char *
|
||||
GSWeb_SetDocRoot(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
char *p_pszArg)
|
||||
{
|
||||
server_rec *pServerRec = p_pCmdParams->server;
|
||||
GSWeb_Config *pConfig = NULL;
|
||||
|
||||
GSWLog(GSW_DEBUG,pServerRec,"Start GSWeb_SetDocRoot");
|
||||
pConfig=(GSWeb_Config *)ap_get_module_config(pServerRec->module_config,
|
||||
&GSWeb_Module);
|
||||
|
@ -179,7 +204,10 @@ return NULL;
|
|||
*/
|
||||
//--------------------------------------------------------------------
|
||||
// Set Param: ScriptAlias
|
||||
static CONST char* GSWeb_SetScriptAlias(cmd_parms *p_pCmdParams, void *p_pUnused, char *p_pszArg)
|
||||
static CONST char *
|
||||
GSWeb_SetScriptAlias(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
char *p_pszArg)
|
||||
{
|
||||
server_rec *pServerRec = p_pCmdParams->server;
|
||||
GSWeb_Config *pConfig = NULL;
|
||||
|
@ -192,10 +220,14 @@ static CONST char* GSWeb_SetScriptAlias(cmd_parms *p_pCmdParams, void *p_pUnused
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// Set Param: ConfigFile
|
||||
static CONST char *GSWeb_SetConfig(cmd_parms *p_pCmdParams, void *p_pUnused, char *p_pszArg)
|
||||
static CONST char *
|
||||
GSWeb_SetConfig(cmd_parms *p_pCmdParams,
|
||||
void *p_pUnused,
|
||||
char *p_pszArg)
|
||||
{
|
||||
server_rec *pServerRec = p_pCmdParams->server;
|
||||
GSWeb_Config *pConfig = NULL;
|
||||
|
||||
GSWLog(GSW_DEBUG,pServerRec,"Start GSWeb_SetConfig");
|
||||
pConfig=GSWeb_GetServerConfig(pServerRec);
|
||||
GSWLog(GSW_DEBUG,pServerRec,"pConfig=%p",pConfig);
|
||||
|
@ -208,11 +240,13 @@ static CONST char *GSWeb_SetConfig(cmd_parms *p_pCmdParams, void *p_pUnused, cha
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// Translate
|
||||
int GSWeb_Translation(request_rec* p_pRequestRec)
|
||||
int
|
||||
GSWeb_Translation(request_rec *p_pRequestRec)
|
||||
{
|
||||
int iRetValue=OK;
|
||||
GSWeb_Config *pConfig=NULL;
|
||||
GSWURLComponents stURL;
|
||||
|
||||
memset(&stURL,0,sizeof(stURL));
|
||||
GSWLog(GSW_DEBUG,p_pRequestRec->server,"Start GSWeb_Translation");
|
||||
pConfig=GSWeb_GetServerConfig(p_pRequestRec->server);
|
||||
|
@ -226,7 +260,8 @@ int GSWeb_Translation(request_rec* p_pRequestRec)
|
|||
p_pRequestRec->server);
|
||||
if (eError!=GSWURLError_OK)
|
||||
{
|
||||
GSWLog(GSW_ERROR,p_pRequestRec->server,"GSWeb_Translation Declined (Error %d)",(int)eError);
|
||||
GSWLog(GSW_ERROR,p_pRequestRec->server,
|
||||
"GSWeb_Translation Declined (Error %d)",(int)eError);
|
||||
iRetValue=DECLINED;
|
||||
}
|
||||
else
|
||||
|
@ -238,7 +273,8 @@ int GSWeb_Translation(request_rec* p_pRequestRec)
|
|||
p_pRequestRec->pool,
|
||||
g_szGSWeb_Handler,
|
||||
pConfig->pszGSWeb);
|
||||
p_pRequestRec->handler=(char*)ap_pstrdup(p_pRequestRec->pool,g_szGSWeb_Handler);
|
||||
p_pRequestRec->handler=(char *)ap_pstrdup(p_pRequestRec->pool,
|
||||
g_szGSWeb_Handler);
|
||||
iRetValue=OK;
|
||||
};
|
||||
}
|
||||
|
@ -254,7 +290,9 @@ int GSWeb_Translation(request_rec* p_pRequestRec)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static void copyHeaders(request_rec* p_pRequestRec,GSWHTTPRequest* p_pGSWHTTPRequest)
|
||||
static void
|
||||
copyHeaders(request_rec *p_pRequestRec,
|
||||
GSWHTTPRequest *p_pGSWHTTPRequest)
|
||||
{
|
||||
server_rec *pServerRec = p_pRequestRec->server;
|
||||
conn_rec *pConnection = p_pRequestRec->connection;
|
||||
|
@ -270,7 +308,8 @@ static void copyHeaders(request_rec* p_pRequestRec,GSWHTTPRequest* p_pGSWHTTPReq
|
|||
for (i=0;i<headers_arr->nelts;i++)
|
||||
{
|
||||
if (headers[i].key)
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,headers[i].key,headers[i].val);
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
headers[i].key,headers[i].val);
|
||||
};
|
||||
|
||||
// Add server headers
|
||||
|
@ -296,11 +335,15 @@ static void copyHeaders(request_rec* p_pRequestRec,GSWHTTPRequest* p_pGSWHTTPReq
|
|||
#ifdef Apache2
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_RemoteHost,
|
||||
(CONST char*)ap_get_remote_host(pConnection,p_pRequestRec->per_dir_config,REMOTE_NAME,NULL));
|
||||
(CONST char *)ap_get_remote_host(pConnection,
|
||||
p_pRequestRec->per_dir_config,
|
||||
REMOTE_NAME,NULL));
|
||||
#else /* Apache 1.x */
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_RemoteHost,
|
||||
(CONST char*)ap_get_remote_host(pConnection,p_pRequestRec->per_dir_config,REMOTE_NAME));
|
||||
(CONST char *)ap_get_remote_host(pConnection,
|
||||
p_pRequestRec->per_dir_config,
|
||||
REMOTE_NAME));
|
||||
#endif
|
||||
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
|
||||
g_szServerInfo_RemoteAddress,
|
||||
|
@ -349,20 +392,27 @@ static void copyHeaders(request_rec* p_pRequestRec,GSWHTTPRequest* p_pGSWHTTPReq
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// callback finction to copy an header into p_pRequest
|
||||
static void getHeader(GSWDictElem* p_pElem,void* p_pRequestRec)
|
||||
static void
|
||||
getHeader(GSWDictElem *p_pElem,
|
||||
void *p_pRequestRec)
|
||||
{
|
||||
request_rec *pRequestRec = (request_rec *)p_pRequestRec;
|
||||
|
||||
if (!pRequestRec->content_type && strcasecmp(p_pElem->pszKey,g_szHeader_ContentType)==0)
|
||||
pRequestRec->content_type = (char*)ap_pstrdup(pRequestRec->pool,(char*)p_pElem->pValue);
|
||||
if (!pRequestRec->content_type &&
|
||||
strcasecmp(p_pElem->pszKey,g_szHeader_ContentType)==0)
|
||||
pRequestRec->content_type = (char *)ap_pstrdup(pRequestRec->pool,
|
||||
(char *)p_pElem->pValue);
|
||||
else
|
||||
ap_table_add(pRequestRec->headers_out,p_pElem->pszKey,(char*)p_pElem->pValue);
|
||||
ap_table_add(pRequestRec->headers_out,p_pElem->pszKey,
|
||||
(char *)p_pElem->pValue);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// send response
|
||||
|
||||
static void sendResponse(request_rec* p_pRequestRec,GSWHTTPResponse* p_pHTTPResponse)
|
||||
static void
|
||||
sendResponse(request_rec *p_pRequestRec,
|
||||
GSWHTTPResponse *p_pHTTPResponse)
|
||||
{
|
||||
char szStatusBuffer[512]="";
|
||||
server_rec *pServerRec = p_pRequestRec->server;
|
||||
|
@ -382,7 +432,7 @@ static void sendResponse(request_rec* p_pRequestRec,GSWHTTPResponse* p_pHTTPResp
|
|||
p_pRequestRec->content_type = g_szContentType_TextHtml;
|
||||
|
||||
// Set content length
|
||||
ap_set_content_length(p_pRequestRec, p_pHTTPResponse->uContentLength);
|
||||
ap_set_content_length(p_pRequestRec, (uintmax_t)p_pHTTPResponse->uContentLength);
|
||||
|
||||
// Now Send response...
|
||||
|
||||
|
@ -393,7 +443,8 @@ static void sendResponse(request_rec* p_pRequestRec,GSWHTTPResponse* p_pHTTPResp
|
|||
if (!p_pRequestRec->header_only)
|
||||
{
|
||||
ap_soft_timeout("Send GSWeb response",p_pRequestRec);
|
||||
ap_rwrite(p_pHTTPResponse->pContent,p_pHTTPResponse->uContentLength,p_pRequestRec);
|
||||
ap_rwrite(p_pHTTPResponse->pContent,p_pHTTPResponse->uContentLength,
|
||||
p_pRequestRec);
|
||||
ap_kill_timeout(p_pRequestRec);
|
||||
};
|
||||
GSWLog(GSW_DEBUG,pServerRec,"Stop sendResponse");
|
||||
|
@ -401,10 +452,14 @@ static void sendResponse(request_rec* p_pRequestRec,GSWHTTPResponse* p_pHTTPResp
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// die/send response
|
||||
static int dieSendResponse(request_rec* p_pRequestRec,GSWHTTPResponse** p_ppHTTPResponse,BOOL p_fDecline)
|
||||
static int
|
||||
dieSendResponse(request_rec *p_pRequestRec,
|
||||
GSWHTTPResponse **p_ppHTTPResponse,
|
||||
BOOL p_fDecline)
|
||||
{
|
||||
server_rec *pServerRec = p_pRequestRec->server;
|
||||
void *pLogServerData=pServerRec;
|
||||
|
||||
GSWLog(GSW_DEBUG,pLogServerData,"Start dieSendResponse");
|
||||
sendResponse(p_pRequestRec,*p_ppHTTPResponse);
|
||||
GSWHTTPResponse_Free(*p_ppHTTPResponse,pLogServerData);
|
||||
|
@ -415,14 +470,19 @@ static int dieSendResponse(request_rec* p_pRequestRec,GSWHTTPResponse** p_ppHTTP
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// die with a message
|
||||
static int dieWithMessage(request_rec* p_pRequestRec,CONST char* p_pszMessage,BOOL p_fDecline)
|
||||
static int
|
||||
dieWithMessage(request_rec *p_pRequestRec,
|
||||
CONST char *p_pszMessage,
|
||||
BOOL p_fDecline)
|
||||
{
|
||||
int iReturn=0;
|
||||
GSWHTTPResponse *pResponse=NULL;
|
||||
server_rec *pServerRec = p_pRequestRec->server;
|
||||
|
||||
GSWLog(GSW_DEBUG,pServerRec,"Start dieWithMessage");
|
||||
GSWLog(GSW_ERROR,pServerRec,"Send Error Response: %s",p_pszMessage);
|
||||
pResponse = GSWHTTPResponse_BuildErrorResponse(NULL,p_pszMessage,p_pRequestRec->server);
|
||||
pResponse = GSWHTTPResponse_BuildErrorResponse(NULL,p_pszMessage,
|
||||
p_pRequestRec->server);
|
||||
iReturn=dieSendResponse(p_pRequestRec,&pResponse,p_fDecline);
|
||||
GSWLog(GSW_DEBUG,pServerRec,"Stop dieWithMessage");
|
||||
return iReturn;
|
||||
|
@ -430,7 +490,8 @@ static int dieWithMessage(request_rec* p_pRequestRec,CONST char* p_pszMessage,BO
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// GSWeb Request Handler
|
||||
static int GSWeb_Handler(request_rec* p_pRequestRec)
|
||||
static int
|
||||
GSWeb_Handler(request_rec *p_pRequestRec)
|
||||
{
|
||||
int iRetVal=OK;
|
||||
GSWURLComponents stURLComponents;
|
||||
|
@ -483,10 +544,12 @@ static int GSWeb_Handler(request_rec* p_pRequestRec)
|
|||
GSWHTTPRequest *pRequest=NULL;
|
||||
CONST char *pszRequestError=NULL;
|
||||
|
||||
pRequest=GSWHTTPRequest_New(p_pRequestRec->method,NULL,pLogServerData);
|
||||
pRequest=GSWHTTPRequest_New(p_pRequestRec->method,NULL,
|
||||
pLogServerData);
|
||||
|
||||
// validate the method
|
||||
pszRequestError=GSWHTTPRequest_ValidateMethod(pRequest,pLogServerData);
|
||||
pszRequestError=GSWHTTPRequest_ValidateMethod(pRequest,
|
||||
pLogServerData);
|
||||
if (pszRequestError)
|
||||
{
|
||||
iRetVal=dieWithMessage(p_pRequestRec,pszRequestError,NO);
|
||||
|
@ -511,8 +574,11 @@ static int GSWeb_Handler(request_rec* p_pRequestRec)
|
|||
|
||||
while (iRemainingLength>0)
|
||||
{
|
||||
ap_soft_timeout("reading GSWeb request",p_pRequestRec);
|
||||
iReadLength=ap_get_client_block(p_pRequestRec,pszData,iRemainingLength);
|
||||
ap_soft_timeout("reading GSWeb request",
|
||||
p_pRequestRec);
|
||||
iReadLength=ap_get_client_block(p_pRequestRec,
|
||||
pszData,
|
||||
iRemainingLength);
|
||||
ap_kill_timeout(p_pRequestRec);
|
||||
pszData += iReadLength;
|
||||
iRemainingLength-=iReadLength;
|
||||
|
@ -526,8 +592,10 @@ static int GSWeb_Handler(request_rec* p_pRequestRec)
|
|||
else if (pRequest->eMethod==ERequestMethod_Get)
|
||||
{
|
||||
// Get the QueryString
|
||||
stURLComponents.stQueryString.pszStart = p_pRequestRec->args;
|
||||
stURLComponents.stQueryString.iLength = p_pRequestRec->args ? strlen(p_pRequestRec->args) : 0;
|
||||
stURLComponents.stQueryString.pszStart =
|
||||
p_pRequestRec->args;
|
||||
stURLComponents.stQueryString.iLength =
|
||||
p_pRequestRec->args ? strlen(p_pRequestRec->args) : 0;
|
||||
};
|
||||
|
||||
// get the document root
|
||||
|
@ -536,7 +604,8 @@ static int GSWeb_Handler(request_rec* p_pRequestRec)
|
|||
else*/
|
||||
pszDocRoot=(char *)ap_document_root(p_pRequestRec);
|
||||
|
||||
// Build the response (Beware: tr_handleRequest free pRequest)
|
||||
// Build the response
|
||||
// (Beware: tr_handleRequest free pRequest)
|
||||
ap_soft_timeout("Call GSWeb Application",p_pRequestRec);
|
||||
pRequest->pServerHandle = p_pRequestRec;
|
||||
pResponse=GSWAppRequest_HandleRequest(&pRequest,
|
||||
|
@ -602,7 +671,8 @@ static int GSWeb_Handler(request_rec* p_pRequestRec)
|
|||
* The actual delivery of content to the browser [9] is not handled by
|
||||
* a hook; see the handler declarations below.
|
||||
*/
|
||||
static void GSWeb_register_hooks(apr_pool_t *p)
|
||||
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);
|
||||
|
@ -645,14 +715,16 @@ static void GSWeb_register_hooks(apr_pool_t *p)
|
|||
*/
|
||||
static const command_rec GSWeb_Commands[] =
|
||||
{
|
||||
AP_INIT_TAKE1(
|
||||
AP_INIT_TAKE1
|
||||
(
|
||||
GSWEB_CONF__ALIAS, /* directive name */
|
||||
GSWeb_SetScriptAlias, /* config action routine */
|
||||
NULL, /* argument to include in call */
|
||||
RSRC_CONF, /* where available */
|
||||
"ScriptAlias for GSWeb" /* directive description */
|
||||
),
|
||||
AP_INIT_TAKE1(
|
||||
);
|
||||
AP_INIT_TAKE1
|
||||
(
|
||||
GSWEB_CONF__CONFIG_FILE_PATH, /* directive name */
|
||||
GSWeb_SetConfig, /* config action routine */
|
||||
NULL, /* argument to include in call */
|
||||
|
|
|
@ -13,11 +13,13 @@
|
|||
Here is an exemple with all the possible options:<br>
|
||||
|
||||
<PRE>
|
||||
|
||||
{
|
||||
//Global Parameters
|
||||
canDumpStatus = YES; //YES if server can display status (URL: /GSWeb/status)
|
||||
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/WebServerResources"; //URL of GSWExtensions Framework WebServerResources directory
|
||||
GSWExtensionsFrameworkWebServerResources =
|
||||
"/GSW/GSWExtensions/WebServerResources"; // URL of GSWExtensions
|
||||
// Framework
|
||||
// WebServerResources directory
|
||||
|
||||
//List of applications
|
||||
applications = {
|
||||
|
@ -38,15 +40,22 @@
|
|||
|
||||
//The 2nd application: AnotherOne
|
||||
AnotherOne = {
|
||||
//URL of GSWExtensions Framework WebServerResources directory. It overides Global parameter
|
||||
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/WebServerResources";
|
||||
//YES to say that this application can be listed when the adaptor don't find an application
|
||||
|
||||
// URL of GSWExtensions Framework WebServerResources directory.
|
||||
// It overides Global parameter
|
||||
GSWExtensionsFrameworkWebServerResources =
|
||||
"/GSW/GSWExtensions/WebServerResources";
|
||||
|
||||
// YES to say that this application can be listed when the
|
||||
// adaptor don't find an application
|
||||
canDump = YES;
|
||||
|
||||
//Unused for the moment
|
||||
applicationHeaders = {
|
||||
header1 = 1264;
|
||||
header2 = 4567;
|
||||
};
|
||||
|
||||
//Instances
|
||||
instances = {
|
||||
//1st instance
|
||||
|
@ -85,12 +94,9 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
</PRE>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWApp.c - GSWeb: Adaptors: GSWApp & GSWAppInstance
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: March 2000
|
||||
|
@ -44,7 +44,8 @@ void GSWAppInstance_InternClear(GSWDictElem* p_pElem,void* p_pData);
|
|||
|
||||
//====================================================================
|
||||
//--------------------------------------------------------------------
|
||||
GSWApp* GSWApp_New()
|
||||
GSWApp *
|
||||
GSWApp_New()
|
||||
{
|
||||
GSWApp *pApp=(GSWApp *)calloc(1,sizeof(GSWApp));
|
||||
memset(pApp,0,sizeof(GSWApp));
|
||||
|
@ -53,7 +54,8 @@ GSWApp* GSWApp_New()
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWApp_Free(GSWApp* p_pApp)
|
||||
void
|
||||
GSWApp_Free(GSWApp *p_pApp)
|
||||
{
|
||||
if (!p_pApp)
|
||||
GSWLog(GSW_CRITICAL,NULL,"No App to free");
|
||||
|
@ -61,7 +63,8 @@ void GSWApp_Free(GSWApp* p_pApp)
|
|||
{
|
||||
p_pApp->iUsageCounter--;
|
||||
if (p_pApp->iUsageCounter<0)
|
||||
GSWLog(GSW_CRITICAL,NULL,"App seems to have been freed too much times");
|
||||
GSWLog(GSW_CRITICAL,NULL,
|
||||
"App seems to have been freed too much times");
|
||||
if (p_pApp->iUsageCounter<=0)
|
||||
{
|
||||
if (p_pApp->pszName)
|
||||
|
@ -78,7 +81,10 @@ void GSWApp_Free(GSWApp* p_pApp)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWApp_AddInstance(GSWApp* p_pApp,CONST char* p_pszInstanceNum,GSWAppInstance* p_pInstance)
|
||||
void
|
||||
GSWApp_AddInstance(GSWApp *p_pApp,
|
||||
CONST char *p_pszInstanceNum,
|
||||
GSWAppInstance *p_pInstance)
|
||||
{
|
||||
if (!p_pApp)
|
||||
{
|
||||
|
@ -98,15 +104,19 @@ void GSWApp_AddInstance(GSWApp* p_pApp,CONST char* p_pszInstanceNum,GSWAppInstan
|
|||
p_pInstance->pApp=p_pApp;
|
||||
p_pInstance->pApp->iUsageCounter++;
|
||||
};
|
||||
GSWDict_Add(&p_pApp->stInstancesDict,p_pszInstanceNum,p_pInstance,FALSE);//NotOwner
|
||||
GSWDict_Add(&p_pApp->stInstancesDict,p_pszInstanceNum,
|
||||
p_pInstance,FALSE);//NotOwner
|
||||
};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWApp_InternFreeNotValidInstances(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWApp_InternFreeNotValidInstances(GSWDictElem *p_pElem,
|
||||
void *p_pData)
|
||||
{
|
||||
GSWDict *pInstancesDict=(GSWDict *)p_pData;
|
||||
GSWAppInstance *pInstance=(GSWAppInstance *)p_pElem->pValue;
|
||||
|
||||
if (!pInstance->fValid)
|
||||
{
|
||||
GSWDict_RemoveKey(pInstancesDict,p_pElem->pszKey);
|
||||
|
@ -116,7 +126,8 @@ void GSWApp_InternFreeNotValidInstances(GSWDictElem* p_pElem,void* p_pData)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWApp_FreeNotValidInstances(GSWApp* p_pApp)
|
||||
void
|
||||
GSWApp_FreeNotValidInstances(GSWApp *p_pApp)
|
||||
{
|
||||
GSWDict_PerformForAllElem(&p_pApp->stInstancesDict,
|
||||
GSWApp_InternFreeNotValidInstances,
|
||||
|
@ -124,7 +135,9 @@ void GSWApp_FreeNotValidInstances(GSWApp* p_pApp)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWApp_InternClearInstances(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWApp_InternClearInstances(GSWDictElem *p_pElem,
|
||||
void *p_pData)
|
||||
{
|
||||
GSWApp *pApp=(GSWApp *)(p_pElem->pValue);
|
||||
GSWDict_PerformForAllElem(&pApp->stInstancesDict,
|
||||
|
@ -133,7 +146,8 @@ void GSWApp_InternClearInstances(GSWDictElem* p_pElem,void* p_pData)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWApp_AppsClearInstances(GSWDict* p_pAppsDict)
|
||||
void
|
||||
GSWApp_AppsClearInstances(GSWDict *p_pAppsDict)
|
||||
{
|
||||
GSWDict_PerformForAllElem(p_pAppsDict,
|
||||
GSWApp_InternClearInstances,
|
||||
|
@ -142,7 +156,8 @@ void GSWApp_AppsClearInstances(GSWDict* p_pAppsDict)
|
|||
|
||||
//====================================================================
|
||||
//--------------------------------------------------------------------
|
||||
GSWAppInstance* GSWAppInstance_New(GSWApp* p_pApp)
|
||||
GSWAppInstance *
|
||||
GSWAppInstance_New(GSWApp *p_pApp)
|
||||
{
|
||||
GSWAppInstance *pInstance=(GSWAppInstance*)calloc(1,sizeof(GSWAppInstance));
|
||||
memset(pInstance,0,sizeof(GSWAppInstance));
|
||||
|
@ -156,7 +171,8 @@ GSWAppInstance* GSWAppInstance_New(GSWApp* p_pApp)
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInstance_Free(GSWAppInstance* p_pInstance)
|
||||
void
|
||||
GSWAppInstance_Free(GSWAppInstance *p_pInstance)
|
||||
{
|
||||
if (p_pInstance)
|
||||
{
|
||||
|
@ -166,7 +182,8 @@ void GSWAppInstance_Free(GSWAppInstance* p_pInstance)
|
|||
{
|
||||
char szBuffer[128]="";
|
||||
sprintf(szBuffer,"%d",p_pInstance->iInstance);
|
||||
if (GSWDict_ValueForKey(&p_pInstance->pApp->stInstancesDict,szBuffer)==p_pInstance)
|
||||
if (GSWDict_ValueForKey(&p_pInstance->pApp->stInstancesDict,
|
||||
szBuffer)==p_pInstance)
|
||||
GSWDict_RemoveKey(&p_pInstance->pApp->stInstancesDict,szBuffer);
|
||||
p_pInstance->pApp->iUsageCounter--;
|
||||
};
|
||||
|
@ -175,7 +192,8 @@ void GSWAppInstance_Free(GSWAppInstance* p_pInstance)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWAppInstance_FreeIFND(GSWAppInstance* p_pInstance)
|
||||
BOOL
|
||||
GSWAppInstance_FreeIFND(GSWAppInstance *p_pInstance)
|
||||
{
|
||||
if (p_pInstance->uOpenedRequestsNb==0)
|
||||
{
|
||||
|
@ -187,7 +205,8 @@ BOOL GSWAppInstance_FreeIFND(GSWAppInstance* p_pInstance)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInstance_InternClear(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWAppInstance_InternClear(GSWDictElem *p_pElem,void *p_pData)
|
||||
{
|
||||
GSWAppInstance *pInstance=(GSWAppInstance*)(p_pElem->pValue);
|
||||
pInstance->fValid=FALSE;
|
||||
|
@ -196,88 +215,109 @@ void GSWAppInstance_InternClear(GSWDictElem* p_pElem,void* p_pData)
|
|||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
void GSWAppInfo_Init()
|
||||
void
|
||||
GSWAppInfo_Init()
|
||||
{
|
||||
if (_gswAppInfoDict == NULL) {
|
||||
_gswAppInfoDict = GSWDict_New(50); // allows 50 different instances of apps
|
||||
if (_gswAppInfoDict == NULL)
|
||||
{
|
||||
_gswAppInfoDict = GSWDict_New(50);
|
||||
// allows 50 different instances of apps
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWAppInfo_MakeDictKeyName(char* pszName, int iInstance)
|
||||
char *
|
||||
GSWAppInfo_MakeDictKeyName(char *pszName, int iInstance)
|
||||
{
|
||||
char *name = NULL;
|
||||
|
||||
if (name = calloc(1,50)) {
|
||||
if (pszName) {
|
||||
if (name = calloc(1,50))
|
||||
{
|
||||
if (pszName)
|
||||
{
|
||||
strncpy(name, pszName,45);
|
||||
name[45]=0;
|
||||
}
|
||||
sprintf(name + strlen(name), "%d", iInstance);
|
||||
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWAppInfo* GSWAppInfo_Find(char* pszName, int iInstance)
|
||||
GSWAppInfo *
|
||||
GSWAppInfo_Find(char *pszName, int iInstance)
|
||||
{
|
||||
char *name;
|
||||
GSWAppInfo *newInfo = NULL;
|
||||
|
||||
if (_gswAppInfoDict == NULL) {
|
||||
if (_gswAppInfoDict == NULL)
|
||||
{
|
||||
GSWAppInfo_Init();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name = GSWAppInfo_MakeDictKeyName(pszName, iInstance);
|
||||
if (name) {
|
||||
if (name)
|
||||
{
|
||||
newInfo = GSWDict_ValueForKey(_gswAppInfoDict, name);
|
||||
free(name); name = NULL;
|
||||
free(name);
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
return newInfo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInfo_Add(GSWAppInfo* appInfoDict, CONST char* keyName)
|
||||
void
|
||||
GSWAppInfo_Add(GSWAppInfo *appInfoDict, CONST char *keyName)
|
||||
{
|
||||
if (appInfoDict)
|
||||
{
|
||||
if (appInfoDict) {
|
||||
GSWDict_Add(_gswAppInfoDict, keyName, appInfoDict, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInfo_Set(char* pszName, int iInstance, BOOL isRefused)
|
||||
void
|
||||
GSWAppInfo_Set(char *pszName, int iInstance, BOOL isRefused)
|
||||
{
|
||||
char *name;
|
||||
GSWAppInfo *newInfo = GSWAppInfo_Find(pszName, iInstance);
|
||||
time_t curTime = (time_t)0;
|
||||
BOOL addDict = FALSE;
|
||||
|
||||
if (newInfo == NULL) {
|
||||
if (newInfo == NULL)
|
||||
{
|
||||
newInfo=(GSWAppInfo*)calloc(1,sizeof(GSWAppInfo));
|
||||
addDict = TRUE;
|
||||
}
|
||||
|
||||
if (newInfo && (name = GSWAppInfo_MakeDictKeyName(pszName, iInstance) )) {
|
||||
if (newInfo && (name = GSWAppInfo_MakeDictKeyName(pszName, iInstance) ))
|
||||
{
|
||||
newInfo->isRefused = isRefused;
|
||||
time(&curTime);
|
||||
newInfo->timeNextRetryTime = curTime + 10; // + 10 sec
|
||||
|
||||
if (addDict == TRUE) {
|
||||
if (addDict == TRUE)
|
||||
{
|
||||
GSWAppInfo_Add(newInfo, name);
|
||||
}
|
||||
free(name); name = NULL;
|
||||
} else {
|
||||
if (newInfo) {
|
||||
free(newInfo); newInfo = NULL;
|
||||
free(name);
|
||||
name = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newInfo)
|
||||
{
|
||||
free(newInfo);
|
||||
newInfo = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInfo_Remove(GSWAppInfo* _appInfo)
|
||||
void
|
||||
GSWAppInfo_Remove(GSWAppInfo *_appInfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWApp.h - GSWeb: Adaptors: GSWApp & GSWAppInstance
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: March 2000
|
||||
|
@ -52,7 +52,9 @@ GSWApp* GSWApp_New();
|
|||
void GSWApp_Free(GSWApp *p_pApp);
|
||||
void GSWApp_FreeNotValidInstances(GSWApp *p_pApp);
|
||||
void GSWApp_AppsClearInstances(GSWDict *p_pAppsDict);
|
||||
void GSWApp_AddInstance(GSWApp* p_pApp,CONST char* p_pszInstanceNum,GSWAppInstance* p_pInstance);
|
||||
void GSWApp_AddInstance(GSWApp *p_pApp,
|
||||
CONST char *p_pszInstanceNum,
|
||||
GSWAppInstance *p_pInstance);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWAppInstance *GSWAppInstance_New(GSWApp *p_pApp);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWAppConnect.h - GSWeb: GSWeb App Connect
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWAppConnectNSSocket.c - GSWeb: Adaptors: App Connection by Netscape Sockets
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -41,7 +41,8 @@
|
|||
|
||||
typedef SYS_NETFD AppConnectNSSocketHandle;
|
||||
|
||||
AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,
|
||||
AppConnectHandle
|
||||
GSWApp_Open(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
AppConnectHandle handle=NULL;
|
||||
|
@ -53,11 +54,14 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,
|
|||
struct hostent *pHost=hl_find(p_pAppRequest->pszHost);
|
||||
if (!pHost)
|
||||
{
|
||||
GSWLog(GSW_ERROR, "gethostbyname(%s) returns no host",p_pAppRequest->pszHost);
|
||||
GSWLog(GSW_ERROR, p_pLogServerData,
|
||||
"gethostbyname(%s) returns no host",
|
||||
p_pAppRequest->pszHost);
|
||||
}
|
||||
else if (pHost->h_addrtype!=AF_INET)
|
||||
{
|
||||
GSWLog(GSW_ERROR,"Host %s has bad address type",p_pAppRequest->pszHost);
|
||||
GSWLog(GSW_ERROR, p_pLogServerData, "Host %s has bad address type",
|
||||
p_pAppRequest->pszHost);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -68,13 +72,14 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,
|
|||
sin.sin_port = htons(p_pAppRequest->iPort);
|
||||
memcpy(&sin.sin_addr, pHost->h_addr_list[0] , pHost->h_length);
|
||||
|
||||
GSWLog(GSW_INFO, "Try contacting %s on port %d...",
|
||||
GSWLog(GSW_INFO, p_pLogServerData, "Try contacting %s on port %d...",
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
nshandle = net_socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
|
||||
if (nshandle<0)
|
||||
{
|
||||
GSWLog(GSW_ERROR,"Can't Create socket to %s:%d. Error=%d (%s)",
|
||||
GSWLog(GSW_ERROR, p_pLogServerData,
|
||||
"Can't Create socket to %s:%d. Error=%d (%s)",
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort,
|
||||
errno,
|
||||
|
@ -84,7 +89,8 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,
|
|||
{
|
||||
if (net_connect(nshandle,(struct sockaddr *)&sin,sizeof(sin))<0)
|
||||
{
|
||||
GSWLog(GSW_ERROR,"Can't connect to %s:%d. Error=%d (%s)",
|
||||
GSWLog(GSW_ERROR, p_pLogServerData,
|
||||
"Can't connect to %s:%d. Error=%d (%s)",
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort,
|
||||
errno,
|
||||
|
@ -98,7 +104,8 @@ AppConnectHandle GSWApp_Open(GSWAppRequest* p_pAppRequest,
|
|||
return handle;
|
||||
};
|
||||
|
||||
void GSWApp_Close(AppConnectHandle p_handle,
|
||||
void
|
||||
GSWApp_Close(AppConnectHandle p_handle,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
if (p_handle)
|
||||
|
@ -109,7 +116,8 @@ void GSWApp_Close(AppConnectHandle p_handle,
|
|||
};
|
||||
};
|
||||
|
||||
int GSWApp_SendLine(AppConnectHandle p_handle,
|
||||
int
|
||||
GSWApp_SendLine(AppConnectHandle p_handle,
|
||||
CONST char *p_pszBuffer,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
|
@ -119,7 +127,8 @@ int GSWApp_SendLine(AppConnectHandle p_handle,
|
|||
return iRetValue;
|
||||
}
|
||||
|
||||
int GSWApp_SendBlock(AppConnectHandle p_handle,
|
||||
int
|
||||
GSWApp_SendBlock(AppConnectHandle p_handle,
|
||||
CONST char *p_pszBuffer,
|
||||
int p_iSize,
|
||||
void *p_pLogServerData)
|
||||
|
@ -134,7 +143,8 @@ int GSWApp_SendBlock(AppConnectHandle p_handle,
|
|||
{
|
||||
iSent=net_write(handle,(char *)p_pszBuffer,iRemainingSize);
|
||||
if (iSent<0)
|
||||
GSWLog(GSW_ERROR,"send failed. Error=%d (%s)",
|
||||
GSWLog(GSW_ERROR, p_pLogServerData,
|
||||
"send failed. Error=%d (%s)",
|
||||
errno,
|
||||
strerror(errno));
|
||||
else
|
||||
|
@ -148,7 +158,8 @@ int GSWApp_SendBlock(AppConnectHandle p_handle,
|
|||
return iRetValue;
|
||||
}
|
||||
|
||||
int GSWApp_ReceiveLine(AppConnectHandle p_handle,
|
||||
int
|
||||
GSWApp_ReceiveLine(AppConnectHandle p_handle,
|
||||
char *p_pszBuffer,
|
||||
int p_iBufferSize,
|
||||
void *p_pLogServerData)
|
||||
|
@ -166,7 +177,8 @@ int GSWApp_ReceiveLine(AppConnectHandle p_handle,
|
|||
iReaden=net_read(handle,&c,1,APP_CONNECT_TIMEOUT);
|
||||
if (iReaden<1)
|
||||
{
|
||||
GSWLog(GSW_ERROR,"GSWApp_ReceiveLine. Error=%d (%s)",
|
||||
GSWLog(GSW_ERROR, p_pLogServerData,
|
||||
"GSWApp_ReceiveLine. Error=%d (%s)",
|
||||
errno,
|
||||
strerror(errno));
|
||||
iRetValue=0; //??
|
||||
|
@ -186,7 +198,8 @@ int GSWApp_ReceiveLine(AppConnectHandle p_handle,
|
|||
return iRetValue;
|
||||
};
|
||||
|
||||
int GSWApp_ReceiveBlock(AppConnectHandle p_handle,
|
||||
int
|
||||
GSWApp_ReceiveBlock(AppConnectHandle p_handle,
|
||||
char *p_pszBuffer,
|
||||
int p_iBufferSize,
|
||||
void *p_pLogServerData)
|
||||
|
@ -200,10 +213,12 @@ int GSWApp_ReceiveBlock(AppConnectHandle p_handle,
|
|||
BOOL fOk=TRUE;
|
||||
while (iRemainingSize>0 && fOk)
|
||||
{
|
||||
iReceived=net_read(handle,p_pszBuffer,iRemainingSize,APP_CONNECT_TIMEOUT);
|
||||
iReceived=net_read(handle,p_pszBuffer,
|
||||
iRemainingSize,APP_CONNECT_TIMEOUT);
|
||||
if (iReceived<0)
|
||||
{
|
||||
GSWLog(GSW_ERROR,"GSWApp_ReceiveBlock failed. Error=%d %s",
|
||||
GSWLog(GSW_ERROR, p_pLogServerData,
|
||||
"GSWApp_ReceiveBlock failed. Error=%d %s",
|
||||
errno,
|
||||
strerror(errno));
|
||||
fOk=FALSE;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWAppConnectSocket.c - GSWeb: Adaptors: App Connection by Socket
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWAppRequest.c - GSWeb: Adaptors: App Request
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -60,7 +60,8 @@ Connection closed by foreign host.
|
|||
*/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequest,
|
||||
GSWHTTPResponse *
|
||||
GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
|
||||
GSWURLComponents *p_pURLComponents,
|
||||
GSWAppRequest *p_pAppRequest,
|
||||
CONST char *p_pszHTTPVersion,
|
||||
|
@ -77,9 +78,13 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWAppRequest_SendAppRequestToApp");
|
||||
|
||||
if (p_pAppRequest->iInstance>0) //-1 or 0 mean any instance
|
||||
fAppFound = GSWLoadBalancing_FindInstance(p_pAppRequest,p_pLogServerData, p_pURLComponents);
|
||||
fAppFound = GSWLoadBalancing_FindInstance(p_pAppRequest,
|
||||
p_pLogServerData,
|
||||
p_pURLComponents);
|
||||
else
|
||||
fAppFound = GSWLoadBalancing_FindApp(p_pAppRequest,p_pLogServerData, p_pURLComponents);
|
||||
fAppFound = GSWLoadBalancing_FindApp(p_pAppRequest,
|
||||
p_pLogServerData,
|
||||
p_pURLComponents);
|
||||
|
||||
if (!fAppFound)
|
||||
{
|
||||
|
@ -101,7 +106,8 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
if (hConnect)
|
||||
{
|
||||
if (p_pAppRequest->eType==EAppType_LoadBalanced)
|
||||
GSWLoadBalancing_StartAppRequest(p_pAppRequest,p_pLogServerData);
|
||||
GSWLoadBalancing_StartAppRequest(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"%s:%d on %s(%d) connected",
|
||||
p_pAppRequest->pszName,
|
||||
|
@ -133,11 +139,13 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
appInstance = p_pAppRequest->iInstance;
|
||||
|
||||
p_pAppRequest->pRequest = NULL;
|
||||
pHTTPResponse = GSWHTTPResponse_GetResponse(hConnect,p_pLogServerData);
|
||||
pHTTPResponse = GSWHTTPResponse_GetResponse(hConnect,
|
||||
p_pLogServerData);
|
||||
p_pAppRequest->pResponse = pHTTPResponse;
|
||||
|
||||
if (p_pAppRequest->eType == EAppType_LoadBalanced)
|
||||
GSWLoadBalancing_StopAppRequest(p_pAppRequest,p_pLogServerData);
|
||||
GSWLoadBalancing_StopAppRequest(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWApp_Close(hConnect,p_pLogServerData);
|
||||
hConnect=NULL;
|
||||
|
@ -145,10 +153,15 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
glbResponsesNb++;
|
||||
if (pHTTPResponse)
|
||||
{
|
||||
char *value = GSWDict_ValueForKey(pHTTPResponse->pHeaders,"x-gsweb-refusing-redirection");
|
||||
if (value && (strncmp(value,"YES",3)==0)) {
|
||||
char *value =
|
||||
GSWDict_ValueForKey(pHTTPResponse->pHeaders,
|
||||
"x-gsweb-refusing-redirection");
|
||||
if (value && (strncmp(value,"YES",3)==0))
|
||||
{
|
||||
// refuseNewSessions == YES in app
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"### This app (%s / %d) is refusing all new sessions ###", appName, appInstance);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"### This app (%s / %d) is refusing all new sessions ###",
|
||||
appName, appInstance);
|
||||
GSWAppInfo_Set(appName, appInstance, TRUE);
|
||||
}
|
||||
|
||||
|
@ -157,15 +170,18 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
pHTTPResponse->uStatus,
|
||||
pHTTPResponse->pszStatusMessage);
|
||||
};
|
||||
if (appName) {
|
||||
free(appName); appName = NULL;
|
||||
if (appName)
|
||||
{
|
||||
free(appName);
|
||||
appName = NULL;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
fAppNotResponding=TRUE;
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,"%s:%d NOT LISTENING on %s:%d",
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,
|
||||
"%s:%d NOT LISTENING on %s:%d",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
|
@ -173,19 +189,25 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
//TODO
|
||||
/*
|
||||
if (p_pAppRequest->eType == EAppType_Auto)
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,p_pLogServerData);
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
else*/ if (p_pAppRequest->eType==EAppType_LoadBalanced)
|
||||
{
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,p_pLogServerData);
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
if (iAttemptsRemaining-->0)
|
||||
fAppFound=GSWLoadBalancing_FindApp(p_pAppRequest,p_pLogServerData, p_pURLComponents);
|
||||
fAppFound=GSWLoadBalancing_FindApp(p_pAppRequest,
|
||||
p_pLogServerData,
|
||||
p_pURLComponents);
|
||||
};
|
||||
};
|
||||
};
|
||||
if (fAppNotResponding)
|
||||
{
|
||||
GSWApp* pApp=(p_pAppRequest ? (p_pAppRequest->pAppInstance ? p_pAppRequest->pAppInstance->pApp : NULL) : NULL);
|
||||
GSWApp *pApp=(p_pAppRequest ?
|
||||
(p_pAppRequest->pAppInstance ?
|
||||
p_pAppRequest->pAppInstance->pApp : NULL) : NULL);
|
||||
char *pszString=GSWTemplate_ErrorNoResponseMessage(TRUE,pApp);
|
||||
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(p_pAppRequest,
|
||||
pszString,
|
||||
|
@ -200,7 +222,9 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
pHTTPResponse = GSWDumpConfigFile(p_pURLComponents,p_pLogServerData);
|
||||
if (!pHTTPResponse)
|
||||
{
|
||||
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(p_pAppRequest,"No App Found",p_pLogServerData);
|
||||
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(p_pAppRequest,
|
||||
"No App Found",
|
||||
p_pLogServerData);
|
||||
pHTTPResponse->uStatus = 404;
|
||||
if (pHTTPResponse->pszStatusMessage)
|
||||
{
|
||||
|
@ -217,7 +241,8 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWAppRequest_HandleRequest(GSWHTTPRequest** p_ppHTTPRequest,
|
||||
GSWHTTPResponse *
|
||||
GSWAppRequest_HandleRequest(GSWHTTPRequest **p_ppHTTPRequest,
|
||||
GSWURLComponents *p_pURLComponents,
|
||||
CONST char *p_pszHTTPVersion,
|
||||
CONST char *p_pszDocRoot,
|
||||
|
@ -229,14 +254,17 @@ GSWHTTPResponse* GSWAppRequest_HandleRequest(GSWHTTPRequest** p_ppHTTPRequest,
|
|||
glbRequestsNb++;
|
||||
if (!p_pURLComponents)
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,"p_pURLComponents is NULL in GSWAppRequest_HandleRequest");
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,
|
||||
"p_pURLComponents is NULL in GSWAppRequest_HandleRequest");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p_pURLComponents->stAppName.iLength<=0
|
||||
|| !p_pURLComponents->stAppName.pszStart)
|
||||
{
|
||||
pHTTPResponse=GSWHTTPResponse_BuildErrorResponse(NULL,"No Application Name",p_pLogServerData);
|
||||
pHTTPResponse=GSWHTTPResponse_BuildErrorResponse(NULL,
|
||||
"No Application Name",
|
||||
p_pLogServerData);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -254,12 +282,14 @@ GSWHTTPResponse* GSWAppRequest_HandleRequest(GSWHTTPRequest** p_ppHTTPRequest,
|
|||
|
||||
DeleteTrailingSlash(szAppName);
|
||||
if (strcmp(szAppName,p_pszTestAppName)==0)
|
||||
pHTTPResponse=GSWHTTPResponse_BuildStatusResponse(*p_ppHTTPRequest,p_pLogServerData);
|
||||
pHTTPResponse=GSWHTTPResponse_BuildStatusResponse(*p_ppHTTPRequest,
|
||||
p_pLogServerData);
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Get HostByName");
|
||||
// Get Host Name
|
||||
if (p_pURLComponents->stAppHost.iLength>0 && p_pURLComponents->stAppHost.pszStart)
|
||||
if (p_pURLComponents->stAppHost.iLength>0 &&
|
||||
p_pURLComponents->stAppHost.pszStart)
|
||||
{
|
||||
strncpy(szHost,
|
||||
p_pURLComponents->stAppHost.pszStart,
|
||||
|
@ -271,30 +301,41 @@ GSWHTTPResponse* GSWAppRequest_HandleRequest(GSWHTTPRequest** p_ppHTTPRequest,
|
|||
GSWLog(GSW_DEBUG,p_pLogServerData,"Get Request Instance Number");
|
||||
|
||||
// in URL ?
|
||||
if (p_pURLComponents->stAppNumber.iLength>0 && p_pURLComponents->stAppNumber.pszStart)
|
||||
stAppRequest.iInstance = atoi(p_pURLComponents->stAppNumber.pszStart);
|
||||
if (p_pURLComponents->stAppNumber.iLength>0 &&
|
||||
p_pURLComponents->stAppNumber.pszStart)
|
||||
stAppRequest.iInstance =
|
||||
atoi(p_pURLComponents->stAppNumber.pszStart);
|
||||
|
||||
// In Cookie ?
|
||||
else
|
||||
{
|
||||
CONST char* pszCookie=GSWHTTPRequest_HeaderForKey(*p_ppHTTPRequest,g_szHeader_Cookie);
|
||||
CONST char *pszCookie=
|
||||
GSWHTTPRequest_HeaderForKey(*p_ppHTTPRequest,
|
||||
g_szHeader_Cookie);
|
||||
if (pszCookie)
|
||||
{
|
||||
CONST char* pszInstanceCookie=strstr(pszCookie, g_szGSWeb_InstanceCookie[GSWNAMES_INDEX]);
|
||||
CONST char *pszInstanceCookie =
|
||||
strstr(pszCookie,
|
||||
g_szGSWeb_InstanceCookie[GSWNAMES_INDEX]);
|
||||
if (pszInstanceCookie)
|
||||
{
|
||||
stAppRequest.iInstance = atoi(pszInstanceCookie + strlen(g_szGSWeb_InstanceCookie[GSWNAMES_INDEX]));
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Cookie instance %d from %s",
|
||||
stAppRequest.iInstance = atoi(pszInstanceCookie +
|
||||
strlen(g_szGSWeb_InstanceCookie[GSWNAMES_INDEX]));
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"Cookie instance %d from %s",
|
||||
stAppRequest.iInstance,
|
||||
pszCookie);
|
||||
}
|
||||
else
|
||||
{
|
||||
pszInstanceCookie=strstr(pszCookie, g_szGSWeb_InstanceCookie[WONAMES_INDEX]);
|
||||
pszInstanceCookie=strstr(pszCookie,
|
||||
g_szGSWeb_InstanceCookie[WONAMES_INDEX]);
|
||||
if (pszInstanceCookie)
|
||||
{
|
||||
stAppRequest.iInstance = atoi(pszInstanceCookie + strlen(g_szGSWeb_InstanceCookie[WONAMES_INDEX]));
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Cookie instance %d from %s",
|
||||
stAppRequest.iInstance = atoi(pszInstanceCookie +
|
||||
strlen(g_szGSWeb_InstanceCookie[WONAMES_INDEX]));
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"Cookie instance %d from %s",
|
||||
stAppRequest.iInstance,
|
||||
pszCookie);
|
||||
};
|
||||
|
@ -306,15 +347,18 @@ GSWHTTPResponse* GSWAppRequest_HandleRequest(GSWHTTPRequest** p_ppHTTPRequest,
|
|||
stAppRequest.pszHost = szHost;
|
||||
stAppRequest.pszDocRoot = p_pszDocRoot;
|
||||
stAppRequest.pRequest = *p_ppHTTPRequest;
|
||||
stAppRequest.uURLVersion = (p_pURLComponents->stVersion.pszStart) ?
|
||||
atoi(p_pURLComponents->stVersion.pszStart) : GSWEB_VERSION_MAJOR;
|
||||
stAppRequest.uURLVersion =
|
||||
(p_pURLComponents->stVersion.pszStart) ?
|
||||
atoi(p_pURLComponents->stVersion.pszStart) :
|
||||
GSWEB_VERSION_MAJOR;
|
||||
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Add Header");
|
||||
GSWHTTPRequest_AddHeader(*p_ppHTTPRequest,
|
||||
g_szHeader_GSWeb_ServerAdaptor,
|
||||
g_szGSWeb_ServerAndAdaptorVersion);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"SendAppRequestToApp");
|
||||
pHTTPResponse=GSWAppRequest_SendAppRequestToApp(p_ppHTTPRequest,
|
||||
pHTTPResponse =
|
||||
GSWAppRequest_SendAppRequestToApp(p_ppHTTPRequest,
|
||||
p_pURLComponents,
|
||||
&stAppRequest,
|
||||
p_pszHTTPVersion,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWAppRequest.h - GSWeb: GSWeb App Request
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWAppRequestStruct.h - GSWeb: GSWeb App Request Struct
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWConfig.c - GSWeb: Adaptors: Config
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -103,7 +103,8 @@ static GSWConfig g_gswConfig;
|
|||
static char g_szServerStringInfo[1024]="";
|
||||
static char g_szAdaptorStringInfo[1024]="";
|
||||
//--------------------------------------------------------------------
|
||||
void GSWConfig_Init(GSWDict* p_pDict,
|
||||
void
|
||||
GSWConfig_Init(GSWDict *p_pDict,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
CONST char *pszPath=NULL;
|
||||
|
@ -127,27 +128,33 @@ void GSWConfig_Init(GSWDict* p_pDict,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWConfig* GSWConfig_GetConfig()
|
||||
GSWConfig *
|
||||
GSWConfig_GetConfig()
|
||||
{
|
||||
return &g_gswConfig;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWConfig_CanDumpStatus()
|
||||
BOOL
|
||||
GSWConfig_CanDumpStatus()
|
||||
{
|
||||
return g_gswConfig.fCanDumpStatus;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWConfig_SetConfigFilePath(CONST char* p_pszConfigFilePath)
|
||||
void
|
||||
GSWConfig_SetConfigFilePath(CONST char *p_pszConfigFilePath)
|
||||
{
|
||||
if (g_gswConfig.pszConfigFilePath)
|
||||
{
|
||||
free(g_gswConfig.pszConfigFilePath);
|
||||
g_gswConfig.pszConfigFilePath=NULL;
|
||||
};
|
||||
|
||||
if (p_pszConfigFilePath)
|
||||
{
|
||||
g_gswConfig.pszConfigFilePath=strdup(p_pszConfigFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,NULL,
|
||||
|
@ -157,33 +164,32 @@ void GSWConfig_SetConfigFilePath(CONST char* p_pszConfigFilePath)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* GSWConfig_GetConfigFilePath()
|
||||
CONST char *
|
||||
GSWConfig_GetConfigFilePath()
|
||||
{
|
||||
return g_gswConfig.pszConfigFilePath;
|
||||
};
|
||||
|
||||
|
||||
/*{
|
||||
/*
|
||||
{
|
||||
canDumpStatus=NO;
|
||||
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/Resources/WebServer"
|
||||
GSWExtensionsFrameworkWebServerResources =
|
||||
"/GSW/GSWExtensions/Resources/WebServer"
|
||||
applications = {
|
||||
MyApp1 = {
|
||||
GSWExtensionsFrameworkWebServerResources="/GSW/GSWExtensions/Resources/WebServer"
|
||||
GSWExtensionsFrameworkWebServerResources=
|
||||
"/GSW/GSWExtensions/Resources/WebServer"
|
||||
instances = {
|
||||
1 = {
|
||||
host = 12.13.14.15;
|
||||
port = 9001;
|
||||
parameters= {
|
||||
transport=socket;
|
||||
};
|
||||
parameters = { transport = socket; };
|
||||
};
|
||||
2 = {
|
||||
host = 12.13.14.21;
|
||||
port = 9001;
|
||||
parameters= {
|
||||
transport=socket;
|
||||
parameters = { transport = socket; };
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
MyApp2 = {
|
||||
|
@ -191,9 +197,7 @@ CONST char* GSWConfig_GetConfigFilePath()
|
|||
1 = {
|
||||
host = 12.13.14.15;
|
||||
port = 9001;
|
||||
parameters= {
|
||||
transport=socket;
|
||||
};
|
||||
parameters = { transport=socket; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -203,9 +207,7 @@ CONST char* GSWConfig_GetConfigFilePath()
|
|||
1 = {
|
||||
host = 12.13.14.15;
|
||||
port = 9002;
|
||||
parameters= {
|
||||
transport=socket;
|
||||
};
|
||||
parameters = { transport=socket; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -214,9 +216,10 @@ CONST char* GSWConfig_GetConfigFilePath()
|
|||
*/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//Read configuration from p_pszConfigPath if the file changed since p_pLastReadTime
|
||||
// and return the config into p_ppPropList
|
||||
EGSWConfigResult GSWConfig_ReadIFND(CONST char* p_pszConfigPath,
|
||||
//Read configuration from p_pszConfigPath if the file changed since
|
||||
// p_pLastReadTime and return the config into p_ppPropList
|
||||
EGSWConfigResult
|
||||
GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
|
||||
time_t *p_pLastReadTime,
|
||||
proplist_t *p_ppPropList, //Please, PLRelease it after used!
|
||||
void *p_pLogServerData)
|
||||
|
@ -287,12 +290,14 @@ EGSWConfigResult GSWConfig_ReadIFND(CONST char* p_pszConfigPath,
|
|||
};
|
||||
};
|
||||
};
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"GSWeb: GSWConfig_ReadIFND: result= %d",(int)eResult);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"GSWeb: GSWConfig_ReadIFND: result= %d",
|
||||
(int)eResult);
|
||||
return eResult;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWConfig_PropListHeadersToHeaders(GSWDict* p_pHeaders,
|
||||
BOOL
|
||||
GSWConfig_PropListHeadersToHeaders(GSWDict *p_pHeaders,
|
||||
proplist_t p_propListHeaders,
|
||||
CONST char *p_pszParents,
|
||||
void *p_pLogServerData)
|
||||
|
@ -313,7 +318,8 @@ BOOL GSWConfig_PropListHeadersToHeaders(GSWDict* p_pHeaders,
|
|||
//Next get Array Of Headers Names
|
||||
//header1,header2
|
||||
//We'll have to destroy propListHeadersNames
|
||||
propListHeadersNames=GSWPropList_GetAllDictionaryKeys(p_propListHeaders,
|
||||
propListHeadersNames =
|
||||
GSWPropList_GetAllDictionaryKeys(p_propListHeaders,
|
||||
pszParents,
|
||||
TRUE,
|
||||
GSWPropList_TestArray,
|
||||
|
@ -324,7 +330,8 @@ BOOL GSWConfig_PropListHeadersToHeaders(GSWDict* p_pHeaders,
|
|||
for(iHeaderIndex=0;iHeaderIndex<uHeaderNb;iHeaderIndex++)
|
||||
{
|
||||
//Get Header Name Key
|
||||
proplist_t propListHeaderKey=GSWPropList_GetArrayElement(propListHeadersNames,
|
||||
proplist_t propListHeaderKey =
|
||||
GSWPropList_GetArrayElement(propListHeadersNames,
|
||||
iHeaderIndex,
|
||||
pszParents,
|
||||
TRUE,
|
||||
|
@ -337,8 +344,10 @@ BOOL GSWConfig_PropListHeadersToHeaders(GSWDict* p_pHeaders,
|
|||
else
|
||||
{
|
||||
//Get Headerlication Name (MyHeader1)
|
||||
CONST char* pszHeaderName=PLGetString(propListHeaderKey);//Do Not Free It
|
||||
proplist_t propListHeader=GSWPropList_GetDictionaryEntry(p_propListHeaders,
|
||||
CONST char *pszHeaderName=PLGetString(propListHeaderKey);
|
||||
//Do Not Free It
|
||||
proplist_t propListHeader =
|
||||
GSWPropList_GetDictionaryEntry(p_propListHeaders,
|
||||
pszHeaderName,
|
||||
pszParents,
|
||||
TRUE,//Error If Not Exists
|
||||
|
@ -347,8 +356,10 @@ BOOL GSWConfig_PropListHeadersToHeaders(GSWDict* p_pHeaders,
|
|||
if (propListHeader)
|
||||
{
|
||||
//Get Header Value (1234)
|
||||
CONST char* pszHeaderValue=PLGetString(propListHeader);//Do Not Free It
|
||||
GSWDict_AddStringDup(p_pHeaders,pszHeaderName,pszHeaderValue);
|
||||
CONST char *pszHeaderValue=PLGetString(propListHeader);
|
||||
//Do Not Free It
|
||||
GSWDict_AddStringDup(p_pHeaders,pszHeaderName,
|
||||
pszHeaderValue);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -358,7 +369,8 @@ BOOL GSWConfig_PropListHeadersToHeaders(GSWDict* p_pHeaders,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWConfig_PropListInstanceToInstance(GSWAppInstance* p_pInstance,
|
||||
BOOL
|
||||
GSWConfig_PropListInstanceToInstance(GSWAppInstance *p_pInstance,
|
||||
proplist_t p_propListInstance,
|
||||
GSWApp *p_pApp,
|
||||
int p_iInstanceNum,
|
||||
|
@ -386,8 +398,11 @@ BOOL GSWConfig_PropListInstanceToInstance(GSWAppInstance* p_pInstance,
|
|||
if (pValue)
|
||||
{
|
||||
if (p_pInstance->pszHostName)
|
||||
{
|
||||
free(p_pInstance->pszHostName);
|
||||
p_pInstance->pszHostName=SafeStrdup(PLGetString(pValue));//Do Not Free It PLGetStringValue, so strdup it
|
||||
}
|
||||
p_pInstance->pszHostName=SafeStrdup(PLGetString(pValue));
|
||||
//Do Not Free It PLGetStringValue, so strdup it
|
||||
};
|
||||
|
||||
// Port
|
||||
|
@ -420,7 +435,8 @@ BOOL GSWConfig_PropListInstanceToInstance(GSWAppInstance* p_pInstance,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
||||
BOOL
|
||||
GSWConfig_PropListApplicationToApplication(GSWApp *p_pApp,
|
||||
proplist_t p_propListApp,
|
||||
CONST char *p_pszAppName,
|
||||
CONST char *p_pszParents,
|
||||
|
@ -431,7 +447,9 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
proplist_t pValueCanDump=NULL;
|
||||
proplist_t pValueAdaptorTemplatesPath=NULL;
|
||||
if (p_pApp->pszName)
|
||||
{
|
||||
free(p_pApp->pszName);
|
||||
}
|
||||
p_pApp->pszName=SafeStrdup(p_pszAppName);//We'll own the AppName
|
||||
// CanDump
|
||||
sprintf(pszParents,"%s/%s",p_pszParents,p_pszAppName);
|
||||
|
@ -448,7 +466,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
p_pApp->fCanDump=(strcasecmp(pszCanDump,"YES")==0);
|
||||
};
|
||||
//adaptorTemplates
|
||||
pValueAdaptorTemplatesPath=GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
pValueAdaptorTemplatesPath =
|
||||
GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
"adaptorTemplatesPath",
|
||||
pszParents,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -461,7 +480,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
};
|
||||
if (pValueAdaptorTemplatesPath)
|
||||
{
|
||||
CONST char* pszPath=PLGetString(pValueAdaptorTemplatesPath);//Do Not Free It
|
||||
CONST char *pszPath=PLGetString(pValueAdaptorTemplatesPath);
|
||||
//Do Not Free It
|
||||
p_pApp->pszAdaptorTemplatesPath=SafeStrdup(pszPath);
|
||||
};
|
||||
|
||||
|
@ -473,7 +493,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
free(p_pApp->pszGSWExtensionsFrameworkWebServerResources);
|
||||
p_pApp->pszGSWExtensionsFrameworkWebServerResources=NULL;
|
||||
};
|
||||
pValuePath=GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
pValuePath =
|
||||
GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
"GSWExtensionsFrameworkWebServerResources",
|
||||
NULL,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -482,12 +503,14 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
if (pValuePath)
|
||||
{
|
||||
CONST char *pszPath=PLGetString(pValuePath);//Do Not Free It
|
||||
p_pApp->pszGSWExtensionsFrameworkWebServerResources=SafeStrdup(pszPath);
|
||||
p_pApp->pszGSWExtensionsFrameworkWebServerResources =
|
||||
SafeStrdup(pszPath);
|
||||
};
|
||||
};
|
||||
/* // LogFilePath
|
||||
sprintf(pszParents,"%s/%s",p_pszParents,p_pszAppName);
|
||||
pValueLogFilePath=GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
pValueLogFilePath =
|
||||
GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
"logFilePath",
|
||||
pszParents,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -507,7 +530,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
{
|
||||
proplist_t propListHeaders=NULL;
|
||||
sprintf(pszParents,"%s/%s",p_pszParents,p_pszAppName);
|
||||
propListHeaders=GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
propListHeaders =
|
||||
GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
"headers",
|
||||
pszParents,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -541,7 +565,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
{
|
||||
proplist_t propListInstances=NULL;
|
||||
sprintf(pszParents,"%s/%s",p_pszParents,p_pszAppName);
|
||||
propListInstances=GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
propListInstances =
|
||||
GSWPropList_GetDictionaryEntry(p_propListApp,
|
||||
"instances",
|
||||
pszParents,
|
||||
TRUE,//Error If Not Exists
|
||||
|
@ -553,7 +578,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
//Next get Array Of Instances Names
|
||||
//1,3,5
|
||||
//We'll have to destroy propListInstancesNums
|
||||
proplist_t propListInstancesNums=GSWPropList_GetAllDictionaryKeys(propListInstances,
|
||||
proplist_t propListInstancesNums =
|
||||
GSWPropList_GetAllDictionaryKeys(propListInstances,
|
||||
pszParents,//Parents
|
||||
TRUE,//Error If Not Exists
|
||||
GSWPropList_TestArray,//TestFn
|
||||
|
@ -561,12 +587,14 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
if (propListInstancesNums)
|
||||
{
|
||||
//Nb Of Instances
|
||||
unsigned int uInstancesNb=PLGetNumberOfElements(propListInstancesNums);
|
||||
unsigned int uInstancesNb =
|
||||
PLGetNumberOfElements(propListInstancesNums);
|
||||
//For Each Instance
|
||||
for(iInstanceIndex=0;iInstanceIndex<uInstancesNb;iInstanceIndex++)
|
||||
{
|
||||
//Get Instance Num Key
|
||||
proplist_t propListInstanceNumKey=GSWPropList_GetArrayElement(propListInstancesNums,
|
||||
proplist_t propListInstanceNumKey =
|
||||
GSWPropList_GetArrayElement(propListInstancesNums,
|
||||
iInstanceIndex,
|
||||
pszParents,
|
||||
TRUE,
|
||||
|
@ -575,18 +603,18 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
if (propListInstanceNumKey)
|
||||
{
|
||||
//Get Instance Num (1)
|
||||
CONST char* pszInstanceNum=PLGetString(propListInstanceNumKey);//Do Not Free It
|
||||
CONST char *pszInstanceNum =
|
||||
PLGetString(propListInstanceNumKey);//Do Not Free It
|
||||
proplist_t propListInstance=NULL;
|
||||
|
||||
//Get Instance PropList
|
||||
// {
|
||||
// host = 12.13.14.15;
|
||||
// port = 9001;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// parameters = { transport=socket; };
|
||||
// };
|
||||
// };
|
||||
propListInstance=GSWPropList_GetDictionaryEntry(propListInstances,
|
||||
propListInstance =
|
||||
GSWPropList_GetDictionaryEntry(propListInstances,
|
||||
pszInstanceNum,
|
||||
pszParents,
|
||||
TRUE,
|
||||
|
@ -596,7 +624,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
if (propListInstance)
|
||||
{
|
||||
BOOL fNew=NO;
|
||||
GSWAppInstance* pInstance=(GSWAppInstance*)GSWDict_ValueForKey(&p_pApp->stInstancesDict,
|
||||
GSWAppInstance *pInstance = (GSWAppInstance*)
|
||||
GSWDict_ValueForKey(&p_pApp->stInstancesDict,
|
||||
pszInstanceNum);
|
||||
if (!pInstance)
|
||||
{
|
||||
|
@ -610,11 +639,16 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
pszParents,
|
||||
p_pLogServerData);
|
||||
if (fNew)
|
||||
GSWApp_AddInstance(p_pApp,pszInstanceNum,pInstance);
|
||||
{
|
||||
GSWApp_AddInstance(p_pApp,
|
||||
pszInstanceNum,
|
||||
pInstance);
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
PLRelease(propListInstancesNums);//Because it's a newly created proplist
|
||||
PLRelease(propListInstancesNums);
|
||||
//Because it's a newly created proplist
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -624,7 +658,8 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
||||
BOOL
|
||||
GSWConfig_LoadConfiguration(void *p_pLogServerData)
|
||||
{
|
||||
BOOL fOk=TRUE;
|
||||
proplist_t propListConfig=NULL;
|
||||
|
@ -633,7 +668,9 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
"GSWeb: GSWConfig_LoadConfiguration");
|
||||
GSWLock_Lock(g_lockAppList);
|
||||
if (!g_pAppDict)
|
||||
{
|
||||
g_pAppDict = GSWDict_New(16);
|
||||
}
|
||||
|
||||
if (GSWConfig_ReadIFND(GSWConfig_GetConfigFilePath(),
|
||||
&config_mtime,
|
||||
|
@ -647,7 +684,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
{
|
||||
proplist_t pValueCanDumpStatus=NULL;
|
||||
g_gswConfig.fCanDumpStatus=NO;
|
||||
pValueCanDumpStatus=GSWPropList_GetDictionaryEntry(propListConfig,
|
||||
pValueCanDumpStatus =
|
||||
GSWPropList_GetDictionaryEntry(propListConfig,
|
||||
"canDumpStatus",
|
||||
NULL,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -655,7 +693,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
p_pLogServerData);
|
||||
if (pValueCanDumpStatus)
|
||||
{
|
||||
CONST char* pszCanDumpStatus=PLGetString(pValueCanDumpStatus);//Do Not Free It
|
||||
CONST char *pszCanDumpStatus=PLGetString(pValueCanDumpStatus);
|
||||
//Do Not Free It
|
||||
g_gswConfig.fCanDumpStatus=(strcasecmp(pszCanDumpStatus,"YES")==0);
|
||||
};
|
||||
};
|
||||
|
@ -668,7 +707,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
free(g_gswConfig.pszAdaptorTemplatesPath);
|
||||
g_gswConfig.pszAdaptorTemplatesPath=NULL;
|
||||
};
|
||||
pValueAdaptorTemplatesPath=GSWPropList_GetDictionaryEntry(propListConfig,
|
||||
pValueAdaptorTemplatesPath =
|
||||
GSWPropList_GetDictionaryEntry(propListConfig,
|
||||
"adaptorTemplatesPath",
|
||||
NULL,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -676,7 +716,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
p_pLogServerData);
|
||||
if (pValueAdaptorTemplatesPath)
|
||||
{
|
||||
CONST char* pszPath=PLGetString(pValueAdaptorTemplatesPath);//Do Not Free It
|
||||
CONST char *pszPath=PLGetString(pValueAdaptorTemplatesPath);
|
||||
//Do Not Free It
|
||||
g_gswConfig.pszAdaptorTemplatesPath=SafeStrdup(pszPath);
|
||||
};
|
||||
};
|
||||
|
@ -689,7 +730,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
free(g_gswConfig.pszGSWExtensionsFrameworkWebServerResources);
|
||||
g_gswConfig.pszGSWExtensionsFrameworkWebServerResources=NULL;
|
||||
};
|
||||
pValuePath=GSWPropList_GetDictionaryEntry(propListConfig,
|
||||
pValuePath =
|
||||
GSWPropList_GetDictionaryEntry(propListConfig,
|
||||
"GSWExtensionsFrameworkWebServerResources",
|
||||
NULL,
|
||||
FALSE,//No Error If Not Exists
|
||||
|
@ -698,42 +740,37 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
if (pValuePath)
|
||||
{
|
||||
CONST char *pszPath=PLGetString(pValuePath);//Do Not Free It
|
||||
g_gswConfig.pszGSWExtensionsFrameworkWebServerResources=SafeStrdup(pszPath);
|
||||
g_gswConfig.pszGSWExtensionsFrameworkWebServerResources =
|
||||
SafeStrdup(pszPath);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//Get Dictionary Of Applications
|
||||
// {
|
||||
// MyApp1 = {
|
||||
// MyApp1 = (
|
||||
// instances = (
|
||||
// {
|
||||
// instanceNum = 1;
|
||||
// host = 12.13.14.15;
|
||||
// port = 9001;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// };
|
||||
// parameters = { transport=socket; };
|
||||
// },
|
||||
// {
|
||||
// instanceNum = 2;
|
||||
// host = 12.13.14.21;
|
||||
// port = 9001;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// parameters = { transport=socket; };
|
||||
// };
|
||||
// }
|
||||
// );
|
||||
// };
|
||||
// MyApp2 = {
|
||||
// );
|
||||
// MyApp2 = (
|
||||
// instances = (
|
||||
// {
|
||||
// instanceNum = 1;
|
||||
// host = 12.13.14.15;
|
||||
// port = 9001;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// };
|
||||
// parameters = { transport=socket; };
|
||||
// }
|
||||
// );
|
||||
// };
|
||||
|
@ -744,13 +781,12 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
// instanceNum = 1;
|
||||
// host = 12.13.14.15;
|
||||
// port = 9002;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// };
|
||||
// parameters = { transport=socket; };
|
||||
// }
|
||||
// );
|
||||
// };
|
||||
propListApps=GSWPropList_GetDictionaryEntry(propListConfig,//Dictionary
|
||||
propListApps =
|
||||
GSWPropList_GetDictionaryEntry(propListConfig,//Dictionary
|
||||
"applications",//Key
|
||||
NULL,//No Parents
|
||||
TRUE,//Error If Not Exists
|
||||
|
@ -762,7 +798,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
//Next get Array Of App Names
|
||||
//MyApp1,MyApp2,MyApp3
|
||||
//We'll have to destroy propListAppsNames
|
||||
proplist_t propListAppsNames=GSWPropList_GetAllDictionaryKeys(propListApps,
|
||||
proplist_t propListAppsNames =
|
||||
GSWPropList_GetAllDictionaryKeys(propListApps,
|
||||
"applications",//Parents
|
||||
TRUE,//Error If Not Exists
|
||||
GSWPropList_TestArray,//TestFn
|
||||
|
@ -775,7 +812,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
for(iAppIndex=0;iAppIndex<uAppNb;iAppIndex++)
|
||||
{
|
||||
//Get Application Name Key
|
||||
proplist_t propListAppKey=GSWPropList_GetArrayElement(propListAppsNames,
|
||||
proplist_t propListAppKey =
|
||||
GSWPropList_GetArrayElement(propListAppsNames,
|
||||
iAppIndex,
|
||||
"applications",
|
||||
TRUE,
|
||||
|
@ -784,7 +822,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
if (propListAppKey)
|
||||
{
|
||||
//Get Application Name (MyApp1)
|
||||
CONST char* pszAppName=PLGetString(propListAppKey);//Do Not Free It
|
||||
CONST char *pszAppName=PLGetString(propListAppKey);
|
||||
//Do Not Free It
|
||||
proplist_t propListApp=NULL;
|
||||
|
||||
//Get Application PropList
|
||||
|
@ -794,21 +833,18 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
// instanceNum = 1;
|
||||
// host = 12.13.14.15;
|
||||
// port = 9001;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// };
|
||||
// parameters = { transport=socket; };
|
||||
// },
|
||||
// {
|
||||
// instanceNum = 2;
|
||||
// host = 12.13.14.21;
|
||||
// port = 9001;
|
||||
// parameters= {
|
||||
// transport=socket;
|
||||
// };
|
||||
// parameters = { transport=socket; };
|
||||
// }
|
||||
// );
|
||||
// };
|
||||
propListApp=GSWPropList_GetDictionaryEntry(propListApps,
|
||||
propListApp =
|
||||
GSWPropList_GetDictionaryEntry(propListApps,
|
||||
pszAppName,
|
||||
"applications",
|
||||
TRUE,
|
||||
|
@ -817,7 +853,9 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
if (propListApp)
|
||||
{
|
||||
BOOL fNew = NO;
|
||||
GSWApp* pApp=(GSWApp*)GSWDict_ValueForKey(g_pAppDict,pszAppName);
|
||||
GSWApp *pApp =
|
||||
(GSWApp *)GSWDict_ValueForKey(g_pAppDict,
|
||||
pszAppName);
|
||||
if (!pApp)
|
||||
{
|
||||
fNew=YES;
|
||||
|
@ -838,20 +876,24 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
|
|||
else
|
||||
{
|
||||
if (fNew)
|
||||
GSWDict_Add(g_pAppDict,pApp->pszName,pApp,FALSE);//NotOwner
|
||||
GSWDict_Add(g_pAppDict,pApp->pszName,pApp,
|
||||
FALSE);//NotOwner
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
PLRelease(propListAppsNames);//Because it's a newly created proplist
|
||||
PLRelease(propListAppsNames);
|
||||
//Because it's a newly created proplist
|
||||
};
|
||||
};
|
||||
};
|
||||
if (propListConfig)
|
||||
PLRelease(propListConfig);
|
||||
{
|
||||
GSWString* pString=GSWConfig_DumpGSWApps(NULL,g_szGSWeb_Prefix,TRUE,FALSE,p_pLogServerData);
|
||||
GSWLogSized(GSW_INFO,p_pLogServerData,SafeStrlen(pString->pszData),"Config: %s",pString->pszData);
|
||||
GSWString *pString=GSWConfig_DumpGSWApps(NULL,g_szGSWeb_Prefix,
|
||||
TRUE,FALSE,p_pLogServerData);
|
||||
GSWLogSized(GSW_INFO,p_pLogServerData,SafeStrlen(pString->pszData),
|
||||
"Config: %s",pString->pszData);
|
||||
GSWString_Free(pString);
|
||||
};
|
||||
GSWLock_Unlock(g_lockAppList);
|
||||
|
@ -871,7 +913,9 @@ typedef struct _GSWDumpParams
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWConfig_DumpGSWAppInstanceIntern(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWConfig_DumpGSWAppInstanceIntern(GSWDictElem *p_pElem,
|
||||
void *p_pData)
|
||||
{
|
||||
GSWString *pBuffer=GSWString_New();
|
||||
char szBuffer[4096]="";
|
||||
|
@ -914,10 +958,13 @@ void GSWConfig_DumpGSWAppInstanceIntern(GSWDictElem* p_pElem,void* p_pData)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWConfig_DumpGSWAppIntern(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWConfig_DumpGSWAppIntern(GSWDictElem *p_pElem,
|
||||
void *p_pData)
|
||||
{
|
||||
GSWApp *pApp=(GSWApp *)(p_pElem->pValue);
|
||||
GSWDumpParams *pParams=(GSWDumpParams *)p_pData;
|
||||
|
||||
if (pParams->fForceDump || pApp->fCanDump)
|
||||
{
|
||||
GSWString *pBuffer=GSWString_New();
|
||||
|
@ -948,7 +995,8 @@ void GSWConfig_DumpGSWAppIntern(GSWDictElem* p_pElem,void* p_pData)
|
|||
GSWDict_PerformForAllElem(&pApp->stInstancesDict,
|
||||
GSWConfig_DumpGSWAppInstanceIntern,
|
||||
pParams);
|
||||
GSWString_SearchReplace(pBuffer,"##INSTANCES##",pInstancesBuffer->pszData);
|
||||
GSWString_SearchReplace(pBuffer,"##INSTANCES##",
|
||||
pInstancesBuffer->pszData);
|
||||
pParams->pBuffer=pParamsBuffer;
|
||||
GSWString_Free(pInstancesBuffer);
|
||||
pInstancesBuffer=NULL;
|
||||
|
@ -965,7 +1013,8 @@ void GSWConfig_DumpGSWAppIntern(GSWDictElem* p_pElem,void* p_pData)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
|
||||
GSWString *
|
||||
GSWConfig_DumpGSWApps(const char *p_pszReqApp,
|
||||
const char *p_pszPrefix,
|
||||
BOOL p_fForceDump,
|
||||
BOOL p_fHTML,
|
||||
|
@ -974,6 +1023,7 @@ GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
|
|||
GSWString *pBuffer=GSWString_New();
|
||||
GSWDumpParams stParams;
|
||||
char *pszString=NULL;
|
||||
|
||||
GSWLock_Lock(g_lockAppList);
|
||||
|
||||
stParams.pBuffer=GSWString_New();
|
||||
|
@ -1012,37 +1062,43 @@ GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWApp* GSWConfig_GetApp(CONST char* p_pszAppName)
|
||||
GSWApp *
|
||||
GSWConfig_GetApp(CONST char *p_pszAppName)
|
||||
{
|
||||
return (GSWApp *)GSWDict_ValueForKey(g_pAppDict,p_pszAppName);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* GSWConfig_AdaptorBuilt()
|
||||
CONST char *
|
||||
GSWConfig_AdaptorBuilt()
|
||||
{
|
||||
return g_szAdaptorBuilt;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* GSWConfig_ServerStringInfo()
|
||||
CONST char *
|
||||
GSWConfig_ServerStringInfo()
|
||||
{
|
||||
return g_szServerStringInfo;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* g_szGSWeb_AdaptorStringInfo()
|
||||
CONST char *
|
||||
g_szGSWeb_AdaptorStringInfo()
|
||||
{
|
||||
return g_szAdaptorStringInfo;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* GSWConfig_ServerURL()
|
||||
CONST char *
|
||||
GSWConfig_ServerURL()
|
||||
{
|
||||
return GSWServerURL;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* g_szGSWeb_AdaptorURL()
|
||||
CONST char *
|
||||
g_szGSWeb_AdaptorURL()
|
||||
{
|
||||
return "http://www.gnustepweb.org";
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWConfig.h - GSWeb: GSWeb Configuration Management
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -108,15 +108,20 @@ EGSWConfigResult GSWConfig_ReadIFND(CONST char* p_pszConfigPath,
|
|||
proplist_t *p_ppPropList,//Please, PLRelease it after used !
|
||||
void *p_pLogServerData);
|
||||
|
||||
proplist_t GSWConfig_GetApplicationsFromConfig(proplist_t p_propListConfig,void* p_pLogServerData);
|
||||
proplist_t GSWConfig_GetApplicationsFromConfig(proplist_t p_propListConfig,
|
||||
void *p_pLogServerData);
|
||||
proplist_t GSWConfig_ApplicationKeyFromApplicationsKey(proplist_t p_propListApplicationsKeys,
|
||||
int p_iIndex,
|
||||
void *p_pLogServerData);
|
||||
proplist_t GSWConfig_InstancesFromApplication(proplist_t p_propListApplication,void* p_pLogServerData);
|
||||
proplist_t GSWConfig_InstancesFromApplication(proplist_t p_propListApplication,
|
||||
void *p_pLogServerData);
|
||||
proplist_t GSWConfig_ApplicationFromApplications(proplist_t p_propListApplications,
|
||||
proplist_t p_propListApplicationKey,void* p_pLogServerData);
|
||||
proplist_t GSWConfig_ApplicationsKeysFromApplications(proplist_t p_propListApplications,void* p_pLogServerData);
|
||||
proplist_t GSWConfig_ApplicationsKeysFromConfig(proplist_t p_propListConfig,void* p_pLogServerData);
|
||||
proplist_t p_propListApplicationKey,
|
||||
void *p_pLogServerData);
|
||||
proplist_t GSWConfig_ApplicationsKeysFromApplications(proplist_t p_propListApplications,
|
||||
void *p_pLogServerData);
|
||||
proplist_t GSWConfig_ApplicationsKeysFromConfig(proplist_t p_propListConfig,
|
||||
void *p_pLogServerData);
|
||||
|
||||
GSWConfig *GSWConfig_GetConfig();
|
||||
BOOL GSWConfig_CanDumpStatus();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWDict.c - GSWeb: Dictionary
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -29,7 +29,8 @@
|
|||
#include "GSWUtil.h"
|
||||
#include "GSWDict.h"
|
||||
|
||||
void GSWDict_SetCapacity(GSWDict* p_pDict,unsigned int p_uCapacity)
|
||||
void
|
||||
GSWDict_SetCapacity(GSWDict *p_pDict,unsigned int p_uCapacity)
|
||||
{
|
||||
if (!p_pDict)
|
||||
{
|
||||
|
@ -41,7 +42,8 @@ void GSWDict_SetCapacity(GSWDict* p_pDict,unsigned int p_uCapacity)
|
|||
if (p_uCapacity>p_pDict->uCapacity)
|
||||
{
|
||||
if (p_pDict->pElems)
|
||||
p_pDict->pElems = realloc(p_pDict->pElems,p_uCapacity*sizeof(GSWDictElem));
|
||||
p_pDict->pElems = realloc(p_pDict->pElems,
|
||||
p_uCapacity*sizeof(GSWDictElem));
|
||||
else
|
||||
p_pDict->pElems = malloc(p_uCapacity*sizeof(GSWDictElem));
|
||||
p_pDict->uCapacity = p_uCapacity;
|
||||
|
@ -49,7 +51,8 @@ void GSWDict_SetCapacity(GSWDict* p_pDict,unsigned int p_uCapacity)
|
|||
};
|
||||
};
|
||||
|
||||
GSWDict *GSWDict_New(unsigned int p_uCapacity)
|
||||
GSWDict *
|
||||
GSWDict_New(unsigned int p_uCapacity)
|
||||
{
|
||||
GSWDict *pDict = malloc(sizeof(GSWDict));
|
||||
memset(pDict,0,sizeof(GSWDict));
|
||||
|
@ -57,7 +60,8 @@ GSWDict *GSWDict_New(unsigned int p_uCapacity)
|
|||
return pDict;
|
||||
};
|
||||
|
||||
void GSWDict_FreeElem(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWDict_FreeElem(GSWDictElem *p_pElem,void *p_pData)
|
||||
{
|
||||
if (!p_pElem)
|
||||
{
|
||||
|
@ -78,12 +82,14 @@ void GSWDict_FreeElem(GSWDictElem* p_pElem,void* p_pData)
|
|||
};
|
||||
};
|
||||
|
||||
void GSWDict_FreeElements(GSWDict* p_pDict)
|
||||
void
|
||||
GSWDict_FreeElements(GSWDict *p_pDict)
|
||||
{
|
||||
GSWDict_PerformForAllElem(p_pDict,GSWDict_FreeElem,NULL);
|
||||
};
|
||||
|
||||
void GSWDict_Free(GSWDict* p_pDict)
|
||||
void
|
||||
GSWDict_Free(GSWDict *p_pDict)
|
||||
{
|
||||
if (!p_pDict)
|
||||
{
|
||||
|
@ -99,7 +105,8 @@ void GSWDict_Free(GSWDict* p_pDict)
|
|||
};
|
||||
|
||||
|
||||
static GSWDictElem* GSWDict_FindFirstNullKey(GSWDict* p_pDict)
|
||||
static GSWDictElem *
|
||||
GSWDict_FindFirstNullKey(GSWDict *p_pDict)
|
||||
{
|
||||
int i=0;
|
||||
GSWDictElem *pElem=NULL;
|
||||
|
@ -109,7 +116,8 @@ static GSWDictElem* GSWDict_FindFirstNullKey(GSWDict* p_pDict)
|
|||
return NULL;
|
||||
};
|
||||
|
||||
unsigned int GSWDict_Count(GSWDict* p_pDict)
|
||||
unsigned int
|
||||
GSWDict_Count(GSWDict *p_pDict)
|
||||
{
|
||||
unsigned int uCount=0;
|
||||
if (!p_pDict)
|
||||
|
@ -127,7 +135,11 @@ unsigned int GSWDict_Count(GSWDict* p_pDict)
|
|||
return uCount;
|
||||
};
|
||||
|
||||
void GSWDict_Add(GSWDict* p_pDict,CONST char* p_pszKey,CONST void* p_pValue,BOOL p_fValueOwner)
|
||||
void
|
||||
GSWDict_Add(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey,
|
||||
CONST void *p_pValue,
|
||||
BOOL p_fValueOwner)
|
||||
{
|
||||
GSWDictElem *pElem=NULL;
|
||||
if (!p_pDict)
|
||||
|
@ -161,17 +173,26 @@ void GSWDict_Add(GSWDict* p_pDict,CONST char* p_pszKey,CONST void* p_pValue,BOOL
|
|||
};
|
||||
};
|
||||
|
||||
void GSWDict_AddString(GSWDict* p_pDict,CONST char* p_pszKey,CONST char* p_pszValue,BOOL p_fValueOwner)
|
||||
void
|
||||
GSWDict_AddString(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszValue,
|
||||
BOOL p_fValueOwner)
|
||||
{
|
||||
GSWDict_Add(p_pDict,p_pszKey,(void *)p_pszValue,p_fValueOwner);
|
||||
};
|
||||
|
||||
void GSWDict_AddStringDup(GSWDict* p_pDict,CONST char* p_pszKey,CONST char* p_pValue)
|
||||
void
|
||||
GSWDict_AddStringDup(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pValue)
|
||||
{
|
||||
GSWDict_Add(p_pDict,p_pszKey,strdup(p_pValue),TRUE);
|
||||
};
|
||||
|
||||
static GSWDictElem* GSWDict_FindKey(GSWDict* p_pDict,CONST char* p_pszKey)
|
||||
static GSWDictElem *
|
||||
GSWDict_FindKey(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey)
|
||||
{
|
||||
int iIndex=0;
|
||||
GSWDictElem *pElem=NULL;
|
||||
|
@ -188,20 +209,25 @@ static GSWDictElem* GSWDict_FindKey(GSWDict* p_pDict,CONST char* p_pszKey)
|
|||
return NULL;
|
||||
};
|
||||
|
||||
void GSWDict_RemoveKey(GSWDict* p_pDict,CONST char* p_pszKey)
|
||||
void
|
||||
GSWDict_RemoveKey(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey)
|
||||
{
|
||||
GSWDictElem *pElem=GSWDict_FindKey(p_pDict,p_pszKey);
|
||||
if (pElem)
|
||||
GSWDict_FreeElem(pElem,NULL);
|
||||
}
|
||||
|
||||
CONST void* GSWDict_ValueForKey(GSWDict* p_pDict,CONST char* p_pszKey)
|
||||
CONST void *
|
||||
GSWDict_ValueForKey(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey)
|
||||
{
|
||||
GSWDictElem *pElem=GSWDict_FindKey(p_pDict,p_pszKey);
|
||||
return (pElem) ? pElem->pValue : NULL;
|
||||
};
|
||||
|
||||
void GSWDict_PerformForAllElem(GSWDict* p_pDict,
|
||||
void
|
||||
GSWDict_PerformForAllElem(GSWDict *p_pDict,
|
||||
void (*pFN)(GSWDictElem *p_pElem,void *p_pData),
|
||||
void *p_pData)
|
||||
{
|
||||
|
@ -221,7 +247,8 @@ void GSWDict_PerformForAllElem(GSWDict* p_pDict,
|
|||
};
|
||||
};
|
||||
|
||||
GSWList* GSWDict_AllKeys(GSWDict* p_pDict)
|
||||
GSWList *
|
||||
GSWDict_AllKeys(GSWDict *p_pDict)
|
||||
{
|
||||
GSWList *pList=NULL;
|
||||
if (!p_pDict)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWDict.h - GSWeb: Dictionary
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -50,11 +50,21 @@ GSWDict *GSWDict_New(unsigned int p_uCapacity);
|
|||
|
||||
void GSWDict_Free(GSWDict *p_pDict);
|
||||
void GSWDict_FreeElements(GSWDict *p_pDict);
|
||||
void GSWDict_Add(GSWDict* p_pDict,CONST char* p_pszKey,CONST void* p_pValue,BOOL p_fValueOwner);
|
||||
void GSWDict_AddString(GSWDict* p_pDict,CONST char* p_pszKey,CONST char* p_pValue,BOOL p_fValueOwner);
|
||||
void GSWDict_AddStringDup(GSWDict* p_pDict,CONST char* p_pszKey,CONST char* p_pValue);
|
||||
void GSWDict_RemoveKey(GSWDict* p_pDict, CONST char* p_pszKey);
|
||||
CONST void* GSWDict_ValueForKey(GSWDict* p_pDict, CONST char* p_pszKey);
|
||||
void GSWDict_Add(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey,
|
||||
CONST void *p_pValue,
|
||||
BOOL p_fValueOwner);
|
||||
void GSWDict_AddString(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pValue,
|
||||
BOOL p_fValueOwner);
|
||||
void GSWDict_AddStringDup(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pValue);
|
||||
void GSWDict_RemoveKey(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey);
|
||||
CONST void* GSWDict_ValueForKey(GSWDict *p_pDict,
|
||||
CONST char *p_pszKey);
|
||||
unsigned int GSWDict_Count(GSWDict *p_pDict);
|
||||
|
||||
void GSWDict_PerformForAllElem(GSWDict *p_pDict,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWHTTPHeaders.c - GSWeb: GSWeb HTTP Headers
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -145,7 +145,8 @@ const char* g_szContentType_TextHtml="text/html";
|
|||
int GSWHeaderTranslationTableItemsNb=0;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHeaderTranslationTable_Init()
|
||||
void
|
||||
GSWHeaderTranslationTable_Init()
|
||||
{
|
||||
int i=0;
|
||||
GSWHeaderTranslationTable[i].pszHTTP=g_szServerInfo_AnnotationServer;
|
||||
|
@ -251,12 +252,17 @@ void GSWHeaderTranslationTable_Init()
|
|||
GSWHeaderTranslationTable[i++].pszGSWeb=NULL;
|
||||
|
||||
GSWHeaderTranslationTableItemsNb=i;
|
||||
/*GSWLog(GSW_ERROR,NULL,"GSWHeaderTranslationTableItemsNb=%d",GSWHeaderTranslationTableItemsNb);
|
||||
/*
|
||||
GSWLog(GSW_ERROR,NULL,"GSWHeaderTranslationTableItemsNb=%d",
|
||||
GSWHeaderTranslationTableItemsNb);
|
||||
for(i=0;i<GSWHeaderTranslationTableItemsNb-1;i++)
|
||||
{
|
||||
GSWLog(GSW_ERROR,NULL,"GSWHeaderTranslationTable[i].pszHTTP=%s",GSWHeaderTranslationTable[i].pszHTTP);
|
||||
GSWLog(GSW_ERROR,NULL,"GSWHeaderTranslationTable[i].pszGSWeb=%s",GSWHeaderTranslationTable[i].pszGSWeb);
|
||||
};*/
|
||||
GSWLog(GSW_ERROR,NULL,"GSWHeaderTranslationTable[i].pszHTTP=%s",
|
||||
GSWHeaderTranslationTable[i].pszHTTP);
|
||||
GSWLog(GSW_ERROR,NULL,"GSWHeaderTranslationTable[i].pszGSWeb=%s",
|
||||
GSWHeaderTranslationTable[i].pszGSWeb);
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWHTTPHeaders.h - GSWeb: GSWeb HTTP Headers
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -123,8 +123,8 @@ extern const char* g_szMethod_Put;
|
|||
extern const char *g_szContentType_TextHtml;
|
||||
|
||||
typedef struct _GSWHeaderTranslationItem {
|
||||
const char* /*const*/ pszHTTP;
|
||||
const char* /*const*/ pszGSWeb;
|
||||
const char /*const*/ *pszHTTP;
|
||||
const char /*const*/ *pszGSWeb;
|
||||
} GSWHeaderTranslationItem;
|
||||
|
||||
extern /*const*/ GSWHeaderTranslationItem GSWHeaderTranslationTable[];
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWHTTPRequest.c - GSWeb: Adaptors: HTTP Request
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -45,7 +45,10 @@ static char* GSWHTTPRequest_PackageHeaders(GSWHTTPRequest* p_pHTTPRequest,
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPRequest* GSWHTTPRequest_New(CONST char* p_pszMethod,char* p_pszURI,void* p_pLogServerData)
|
||||
GSWHTTPRequest *
|
||||
GSWHTTPRequest_New(CONST char *p_pszMethod,
|
||||
char *p_pszURI,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWHTTPRequest *pHTTPRequest=calloc(1,sizeof(GSWHTTPRequest));
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPRequest_New");
|
||||
|
@ -56,7 +59,9 @@ GSWHTTPRequest* GSWHTTPRequest_New(CONST char* p_pszMethod,char* p_pszURI,void*
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHTTPRequest_Free(GSWHTTPRequest* p_pHTTPRequest,void* p_pLogServerData)
|
||||
void
|
||||
GSWHTTPRequest_Free(GSWHTTPRequest *p_pHTTPRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPRequest_Free");
|
||||
if (p_pHTTPRequest)
|
||||
|
@ -83,13 +88,16 @@ void GSWHTTPRequest_Free(GSWHTTPRequest* p_pHTTPRequest,void* p_pLogServerData)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* GSWHTTPRequest_ValidateMethod(GSWHTTPRequest* p_pHTTPRequest,void* p_pLogServerData)
|
||||
CONST char *
|
||||
GSWHTTPRequest_ValidateMethod(GSWHTTPRequest *p_pHTTPRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
CONST char *pszMsg=NULL;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPRequest_ValidateMethod");
|
||||
if (!p_pHTTPRequest)
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,"No Request in GSWHTTPRequest_ValidateMethod");
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,
|
||||
"No Request in GSWHTTPRequest_ValidateMethod");
|
||||
pszMsg="No Request in GSWHTTPRequest_ValidateMethod";
|
||||
}
|
||||
else
|
||||
|
@ -115,7 +123,8 @@ CONST char* GSWHTTPRequest_ValidateMethod(GSWHTTPRequest* p_pHTTPRequest,void* p
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHTTPRequest_HTTPToAppRequest(GSWHTTPRequest* p_pHTTPRequest,
|
||||
void
|
||||
GSWHTTPRequest_HTTPToAppRequest(GSWHTTPRequest *p_pHTTPRequest,
|
||||
GSWAppRequest *p_pAppRequest,
|
||||
GSWURLComponents *p_pURLComponents,
|
||||
CONST char *p_pszHTTPVersion,
|
||||
|
@ -123,7 +132,8 @@ void GSWHTTPRequest_HTTPToAppRequest(GSWHTTPRequest* p_pHTTPRequest,
|
|||
{
|
||||
char szInstanceBuffer[65]="";
|
||||
char *pszDefaultHTTPVersion = "HTTP/1.0";
|
||||
int iHTTPVersionLength = p_pszHTTPVersion ? strlen(p_pszHTTPVersion) : strlen(pszDefaultHTTPVersion);
|
||||
int iHTTPVersionLength = p_pszHTTPVersion ?
|
||||
strlen(p_pszHTTPVersion) : strlen(pszDefaultHTTPVersion);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPRequest_HTTPToAppRequest");
|
||||
if (p_pAppRequest->iInstance > 0) /* should be -1 !!! */
|
||||
sprintf(szInstanceBuffer,"%d",p_pAppRequest->iInstance);
|
||||
|
@ -140,18 +150,21 @@ void GSWHTTPRequest_HTTPToAppRequest(GSWHTTPRequest* p_pHTTPRequest,
|
|||
p_pHTTPRequest->pszRequest=NULL;
|
||||
};
|
||||
|
||||
p_pHTTPRequest->pszRequest=malloc(8
|
||||
+(GSWComposeURLLen(p_pURLComponents,p_pLogServerData)+1)
|
||||
+iHTTPVersionLength);
|
||||
p_pHTTPRequest->pszRequest=malloc(8+
|
||||
(GSWComposeURLLen(p_pURLComponents,
|
||||
p_pLogServerData)+1)+
|
||||
iHTTPVersionLength);
|
||||
if (p_pHTTPRequest->uContentLength>0)
|
||||
{
|
||||
strcpy(p_pHTTPRequest->pszRequest,"POST ");
|
||||
GSWHTTPRequest_AddHeader(p_pHTTPRequest,g_szHeader_GSWeb_RequestMethod,"POST");
|
||||
GSWHTTPRequest_AddHeader(p_pHTTPRequest,g_szHeader_GSWeb_RequestMethod,
|
||||
"POST");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(p_pHTTPRequest->pszRequest,"GET ");
|
||||
GSWHTTPRequest_AddHeader(p_pHTTPRequest,g_szHeader_GSWeb_RequestMethod,"GET");
|
||||
GSWHTTPRequest_AddHeader(p_pHTTPRequest,g_szHeader_GSWeb_RequestMethod,
|
||||
"GET");
|
||||
};
|
||||
GSWComposeURL(p_pHTTPRequest->pszRequest+strlen(p_pHTTPRequest->pszRequest),
|
||||
p_pURLComponents,
|
||||
|
@ -163,12 +176,14 @@ void GSWHTTPRequest_HTTPToAppRequest(GSWHTTPRequest* p_pHTTPRequest,
|
|||
strcat(p_pHTTPRequest->pszRequest,pszDefaultHTTPVersion);
|
||||
strcat(p_pHTTPRequest->pszRequest,"\n");
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"App Request: %s",p_pHTTPRequest->pszRequest);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"App Request: %s",
|
||||
p_pHTTPRequest->pszRequest);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWHTTPRequest_HTTPToAppRequest");
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHTTPRequest_AddHeader(GSWHTTPRequest* p_pHTTPRequest,
|
||||
void
|
||||
GSWHTTPRequest_AddHeader(GSWHTTPRequest *p_pHTTPRequest,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszValue)
|
||||
{
|
||||
|
@ -188,7 +203,9 @@ void GSWHTTPRequest_AddHeader(GSWHTTPRequest* p_pHTTPRequest,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* GSWHTTPRequest_HeaderForKey(GSWHTTPRequest* p_pHTTPRequest,CONST char* p_pszKey)
|
||||
CONST char *
|
||||
GSWHTTPRequest_HeaderForKey(GSWHTTPRequest *p_pHTTPRequest,
|
||||
CONST char *p_pszKey)
|
||||
{
|
||||
if (p_pHTTPRequest->pHeaders)
|
||||
return GSWDict_ValueForKey(p_pHTTPRequest->pHeaders,p_pszKey);
|
||||
|
@ -197,7 +214,8 @@ CONST char* GSWHTTPRequest_HeaderForKey(GSWHTTPRequest* p_pHTTPRequest,CONST cha
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static void GetHeaderLength(GSWDictElem* p_pElem,
|
||||
static void
|
||||
GetHeaderLength(GSWDictElem *p_pElem,
|
||||
void *p_piAddTo)
|
||||
{
|
||||
int *piAddTo=(int *)p_piAddTo;
|
||||
|
@ -207,7 +225,8 @@ static void GetHeaderLength(GSWDictElem* p_pElem,
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static void FormatHeader(GSWDictElem* p_pElem,
|
||||
static void
|
||||
FormatHeader(GSWDictElem *p_pElem,
|
||||
void *p_ppszBuffer)
|
||||
{
|
||||
char **ppszBuffer=(char **)p_ppszBuffer;
|
||||
|
@ -221,7 +240,10 @@ static void FormatHeader(GSWDictElem* p_pElem,
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// Handle Request (send it to Application)
|
||||
BOOL GSWHTTPRequest_SendRequest(GSWHTTPRequest* p_pHTTPRequest,AppConnectHandle p_socket,void* p_pLogServerData)
|
||||
BOOL
|
||||
GSWHTTPRequest_SendRequest(GSWHTTPRequest *p_pHTTPRequest,
|
||||
AppConnectHandle p_socket,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
BOOL fOk = TRUE;
|
||||
char *pszBuffer=NULL;
|
||||
|
@ -287,7 +309,8 @@ BOOL GSWHTTPRequest_SendRequest(GSWHTTPRequest* p_pHTTPRequest,AppConnectHandle
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static char* GSWHTTPRequest_PackageHeaders(GSWHTTPRequest* p_pHTTPRequest,
|
||||
static char *
|
||||
GSWHTTPRequest_PackageHeaders(GSWHTTPRequest *p_pHTTPRequest,
|
||||
char *p_pszBuffer,
|
||||
int p_iBufferSize)
|
||||
{
|
||||
|
@ -298,7 +321,8 @@ static char* GSWHTTPRequest_PackageHeaders(GSWHTTPRequest* p_pHTTPRequest,
|
|||
GSWDict_PerformForAllElem(p_pHTTPRequest->pHeaders,
|
||||
GetHeaderLength,
|
||||
(void *)&iHeaderLength);
|
||||
pszBuffer = ((p_iBufferSize > (iHeaderLength+1)) ? p_pszBuffer : malloc(p_iBufferSize+2));
|
||||
pszBuffer = ((p_iBufferSize > (iHeaderLength+1)) ?
|
||||
p_pszBuffer : malloc(p_iBufferSize+2));
|
||||
pszTmp = pszBuffer;
|
||||
|
||||
GSWDict_PerformForAllElem(p_pHTTPRequest->pHeaders,FormatHeader,&pszTmp);
|
||||
|
@ -308,7 +332,8 @@ static char* GSWHTTPRequest_PackageHeaders(GSWHTTPRequest* p_pHTTPRequest,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static ERequestMethod GetHTTPRequestMethod(CONST char* pszMethod)
|
||||
static ERequestMethod
|
||||
GetHTTPRequestMethod(CONST char *pszMethod)
|
||||
{
|
||||
if (pszMethod)
|
||||
{
|
||||
|
@ -328,16 +353,20 @@ static ERequestMethod GetHTTPRequestMethod(CONST char* pszMethod)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static int compareHeader(CONST void* p_pKey0,CONST void* p_pKey1)
|
||||
static int
|
||||
compareHeader(CONST void *p_pKey0,
|
||||
CONST void *p_pKey1)
|
||||
{
|
||||
CONST char *pKey1=((GSWHeaderTranslationItem *)p_pKey1)->pszHTTP;
|
||||
/*
|
||||
if (p_pKey0)
|
||||
GSWLog(GSW_ERROR,NULL,"p_pKey0=%p (CONST char*)p_pKey0=%s",p_pKey0,(CONST char*)p_pKey0);
|
||||
GSWLog(GSW_ERROR,NULL,"p_pKey0=%p (CONST char *)p_pKey0=%s",
|
||||
p_pKey0,(CONST char *)p_pKey0);
|
||||
if (p_pKey1)
|
||||
{
|
||||
if (((GSWHeaderTranslationItem *)p_pKey1)->pszHTTP)
|
||||
GSWLog(GSW_ERROR,NULL,"p_pKey1=%p (CONST char*)p_pKey1=%s",p_pKey1,((GSWHeaderTranslationItem*)p_pKey1)->pszHTTP);
|
||||
GSWLog(GSW_ERROR,NULL,"p_pKey1=%p (CONST char *)p_pKey1=%s",
|
||||
p_pKey1,((GSWHeaderTranslationItem *)p_pKey1)->pszHTTP);
|
||||
|
||||
};
|
||||
*/
|
||||
|
@ -350,7 +379,8 @@ static int compareHeader(CONST void* p_pKey0,CONST void* p_pKey1)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static CONST char* GSWebHeaderForHTTPHeader(CONST char* p_pszHTTPHeader)
|
||||
static CONST char *
|
||||
GSWebHeaderForHTTPHeader(CONST char *p_pszHTTPHeader)
|
||||
{
|
||||
GSWHeaderTranslationItem *pItem=NULL;
|
||||
if (GSWHeaderTranslationTableItemsNb==0)
|
||||
|
@ -362,3 +392,4 @@ static CONST char* GSWebHeaderForHTTPHeader(CONST char* p_pszHTTPHeader)
|
|||
compareHeader);
|
||||
return (pItem ? pItem->pszGSWeb : NULL);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWHTTPRequest.h - GSWeb: GSWeb Request
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWHTTPResponse.c - GSWeb: Adaptors: HTTP Response
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -48,7 +48,9 @@ static char* g_pszLocalHostName = NULL;
|
|||
#define HTTP_SLASH "HTTP/"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWHTTPResponse_New(CONST char* p_pszStatus,void* p_pLogServerData)
|
||||
GSWHTTPResponse *
|
||||
GSWHTTPResponse_New(CONST char *p_pszStatus,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWHTTPResponse *pHTTPResponse=NULL;
|
||||
BOOL fOk=FALSE;
|
||||
|
@ -95,7 +97,8 @@ GSWHTTPResponse* GSWHTTPResponse_New(CONST char* p_pszStatus,void* p_pLogServerD
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest,
|
||||
GSWHTTPResponse *
|
||||
GSWHTTPResponse_BuildErrorResponse(GSWAppRequest *p_pAppRequest,
|
||||
CONST char *p_pszMessage,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
|
@ -105,11 +108,14 @@ GSWHTTPResponse* GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest
|
|||
GSWString *pBufferMessage=GSWString_New();
|
||||
GSWHTTPResponse *pHTTPResponse=calloc(1,sizeof(GSWHTTPResponse));
|
||||
char *pszString=NULL;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_BuildErrorResponse");
|
||||
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Start GSWHTTPResponse_BuildErrorResponse");
|
||||
if (p_pAppRequest && p_pAppRequest->pAppInstance)
|
||||
pApp=p_pAppRequest->pAppInstance->pApp;
|
||||
#ifdef DEBUG
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Build Error Response [%s] pApp=%p",p_pszMessage,pApp);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"Build Error Response [%s] pApp=%p",p_pszMessage,pApp);
|
||||
#endif
|
||||
pHTTPResponse->uStatus = 200;
|
||||
pHTTPResponse->pszStatusMessage = strdup(g_szOKGSWeb[GSWNAMES_INDEX]);
|
||||
|
@ -121,10 +127,12 @@ GSWHTTPResponse* GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest
|
|||
GSWString_Append(pBufferMessage,p_pszMessage);
|
||||
if (p_pAppRequest)
|
||||
{
|
||||
GSWString_SearchReplace(pBufferMessage,"##APP_NAME##",p_pAppRequest->pszName);
|
||||
GSWString_SearchReplace(pBufferMessage,"##APP_NAME##",
|
||||
p_pAppRequest->pszName);
|
||||
sprintf(szBuffer,"%d",p_pAppRequest->iInstance);
|
||||
GSWString_SearchReplace(pBufferMessage,"##APP_INSTANCE##",szBuffer);
|
||||
GSWString_SearchReplace(pBufferMessage,"##APP_HOST##",p_pAppRequest->pszHost);
|
||||
GSWString_SearchReplace(pBufferMessage,"##APP_HOST##",
|
||||
p_pAppRequest->pszHost);
|
||||
sprintf(szBuffer,"%d",p_pAppRequest->iPort);
|
||||
GSWString_SearchReplace(pBufferMessage,"##APP_PORT##",szBuffer);
|
||||
};
|
||||
|
@ -142,31 +150,38 @@ GSWHTTPResponse* GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest
|
|||
GSWString_Free(pBuffer);
|
||||
pBuffer=NULL;
|
||||
|
||||
|
||||
GSWString_Free(pBufferMessage);
|
||||
pBufferMessage=NULL;
|
||||
sprintf(szBuffer,"%d",pHTTPResponse->uContentLength);
|
||||
GSWDict_AddStringDup(pHTTPResponse->pHeaders,g_szHeader_ContentLength,szBuffer);
|
||||
GSWDict_AddStringDup(pHTTPResponse->pHeaders,
|
||||
g_szHeader_ContentLength,szBuffer);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWHTTPResponse_BuildErrorResponse");
|
||||
return pHTTPResponse;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWHTTPResponse_BuildRedirectedResponse(CONST char* p_pszRedirectPath,void* p_pLogServerData)
|
||||
GSWHTTPResponse *
|
||||
GSWHTTPResponse_BuildRedirectedResponse(CONST char *p_pszRedirectPath,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWHTTPResponse *pHTTPResponse=calloc(1,sizeof(GSWHTTPResponse));
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_BuildRedirectedResponse");
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Start GSWHTTPResponse_BuildRedirectedResponse");
|
||||
pHTTPResponse->uStatus = 302;
|
||||
pHTTPResponse->pszStatusMessage = strdup(g_szOKGSWeb[GSWNAMES_INDEX]);
|
||||
pHTTPResponse->pHeaders=GSWDict_New(2);
|
||||
GSWDict_Add(pHTTPResponse->pHeaders, g_szHeader_ContentType, g_szContentType_TextHtml,FALSE);
|
||||
GSWDict_Add(pHTTPResponse->pHeaders, g_szHeader_ContentType,
|
||||
g_szContentType_TextHtml,FALSE);
|
||||
GSWDict_AddStringDup(pHTTPResponse->pHeaders,"location",p_pszRedirectPath);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWHTTPResponse_BuildRedirectedResponse");
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Stop GSWHTTPResponse_BuildRedirectedResponse");
|
||||
return pHTTPResponse;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHTTPResponse_Free(GSWHTTPResponse* p_pHTTPResponse,void* p_pLogServerData)
|
||||
void
|
||||
GSWHTTPResponse_Free(GSWHTTPResponse *p_pHTTPResponse,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_Free");
|
||||
if (p_pHTTPResponse)
|
||||
|
@ -193,7 +208,9 @@ void GSWHTTPResponse_Free(GSWHTTPResponse* p_pHTTPResponse,void* p_pLogServerDat
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHTTPResponse_AddHeader(GSWHTTPResponse* p_pHTTPResponse,char* p_pszHeader)
|
||||
void
|
||||
GSWHTTPResponse_AddHeader(GSWHTTPResponse *p_pHTTPResponse,
|
||||
char *p_pszHeader)
|
||||
{
|
||||
char *pszKey=NULL;
|
||||
char *pszValue=NULL;
|
||||
|
@ -210,7 +227,8 @@ void GSWHTTPResponse_AddHeader(GSWHTTPResponse* p_pHTTPResponse,char* p_pszHeade
|
|||
pszValue++;
|
||||
GSWDict_AddStringDup(p_pHTTPResponse->pHeaders,pszKey,pszValue);
|
||||
|
||||
if (p_pHTTPResponse->uContentLength==0 && strcmp(g_szHeader_ContentLength,pszKey)==0)
|
||||
if (p_pHTTPResponse->uContentLength==0 &&
|
||||
strcmp(g_szHeader_ContentLength,pszKey)==0)
|
||||
p_pHTTPResponse->uContentLength = atoi(pszValue);
|
||||
}
|
||||
else
|
||||
|
@ -220,30 +238,37 @@ void GSWHTTPResponse_AddHeader(GSWHTTPResponse* p_pHTTPResponse,char* p_pszHeade
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,void* p_pLogServerData)
|
||||
GSWHTTPResponse *
|
||||
GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWHTTPResponse *pHTTPResponse=NULL;
|
||||
char szResponseBuffer[RESPONSE__LINE_MAX_SIZE];
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_GetResponse");
|
||||
|
||||
// Get the 1st Line
|
||||
GSWApp_ReceiveLine(p_socket,szResponseBuffer, RESPONSE__LINE_MAX_SIZE,p_pLogServerData);
|
||||
GSWApp_ReceiveLine(p_socket,szResponseBuffer,
|
||||
RESPONSE__LINE_MAX_SIZE,p_pLogServerData);
|
||||
pHTTPResponse = GSWHTTPResponse_New(szResponseBuffer,p_pLogServerData);
|
||||
#ifdef DEBUG
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Response receive first line:\t\t[%s]",szResponseBuffer);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Response receive first line:\t\t[%s]",
|
||||
szResponseBuffer);
|
||||
#endif
|
||||
|
||||
if (!pHTTPResponse) //Error
|
||||
pHTTPResponse=GSWHTTPResponse_BuildErrorResponse(NULL,"Invalid Response",p_pLogServerData);
|
||||
pHTTPResponse=GSWHTTPResponse_BuildErrorResponse(NULL,"Invalid Response",
|
||||
p_pLogServerData);
|
||||
else
|
||||
{
|
||||
int iHeader=0;
|
||||
// Headers
|
||||
while (GSWApp_ReceiveLine(p_socket,szResponseBuffer,RESPONSE__LINE_MAX_SIZE,p_pLogServerData)>0
|
||||
while (GSWApp_ReceiveLine(p_socket,szResponseBuffer,
|
||||
RESPONSE__LINE_MAX_SIZE,p_pLogServerData)>0
|
||||
&& szResponseBuffer[0])
|
||||
{
|
||||
#ifdef DEBUG
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Header %d=\t\t[%s]",iHeader,szResponseBuffer);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Header %d=\t\t[%s]",
|
||||
iHeader,szResponseBuffer);
|
||||
#endif
|
||||
GSWHTTPResponse_AddHeader(pHTTPResponse,szResponseBuffer);
|
||||
};
|
||||
|
@ -252,7 +277,9 @@ GSWHTTPResponse* GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,void* p_p
|
|||
if (pHTTPResponse->uContentLength)
|
||||
{
|
||||
char *pszBuffer= malloc(pHTTPResponse->uContentLength);
|
||||
int iReceivedCount=GSWApp_ReceiveBlock(p_socket,pszBuffer,pHTTPResponse->uContentLength,p_pLogServerData);
|
||||
int iReceivedCount=GSWApp_ReceiveBlock(p_socket,pszBuffer,
|
||||
pHTTPResponse->uContentLength,
|
||||
p_pLogServerData);
|
||||
#ifdef DEBUG
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"iReceivedCount=%d",iReceivedCount);
|
||||
#endif
|
||||
|
@ -267,7 +294,8 @@ pHTTPResponse->pContent = pszBuffer;//TODO: Verify this (Turbocat patch)
|
|||
pszBuffer=NULL;
|
||||
GSWHTTPResponse_Free(pHTTPResponse,p_pLogServerData);
|
||||
pHTTPResponse=NULL;
|
||||
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(NULL,"Invalid Response",p_pLogServerData);
|
||||
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(NULL,
|
||||
"Invalid Response",p_pLogServerData);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -278,8 +306,10 @@ pHTTPResponse->pContent = pszBuffer;//TODO: Verify this (Turbocat patch)
|
|||
if (pHTTPResponse->pContent)
|
||||
{
|
||||
char szTraceBuffer[pHTTPResponse->uContentLength+1];
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"\ncontent (%d Bytes)=\n",pHTTPResponse->uContentLength);
|
||||
memcpy(szTraceBuffer,pHTTPResponse->pContent,pHTTPResponse->uContentLength);
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"\ncontent (%d Bytes)=\n",
|
||||
pHTTPResponse->uContentLength);
|
||||
memcpy(szTraceBuffer,pHTTPResponse->pContent,
|
||||
pHTTPResponse->uContentLength);
|
||||
szTraceBuffer[pHTTPResponse->uContentLength] = 0;
|
||||
GSWLogSized(GSW_INFO,p_pLogServerData,
|
||||
pHTTPResponse->uContentLength+1,
|
||||
|
@ -297,7 +327,8 @@ pHTTPResponse->pContent = pszBuffer;//TODO: Verify this (Turbocat patch)
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static void GetHeaderLength(GSWDictElem* p_pElem,
|
||||
static void
|
||||
GetHeaderLength(GSWDictElem *p_pElem,
|
||||
void *p_piAddTo)
|
||||
{
|
||||
int *piAddTo=(int *)p_piAddTo;
|
||||
|
@ -308,7 +339,8 @@ static void GetHeaderLength(GSWDictElem* p_pElem,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static void FormatHeader(GSWDictElem* p_pElem,
|
||||
static void
|
||||
FormatHeader(GSWDictElem *p_pElem,
|
||||
void *p_ppszBuffer)
|
||||
{
|
||||
char **ppszBuffer=(char **)p_ppszBuffer;
|
||||
|
@ -323,7 +355,8 @@ static void FormatHeader(GSWDictElem* p_pElem,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char *GSWHTTPResponse_PackageHeaders(GSWHTTPResponse* p_pHTTPResponse,
|
||||
char *
|
||||
GSWHTTPResponse_PackageHeaders(GSWHTTPResponse *p_pHTTPResponse,
|
||||
char *p_pszBuffer,
|
||||
int p_iBufferSize)
|
||||
{
|
||||
|
@ -334,7 +367,8 @@ char *GSWHTTPResponse_PackageHeaders(GSWHTTPResponse* p_pHTTPResponse,
|
|||
GSWDict_PerformForAllElem(p_pHTTPResponse->pHeaders,
|
||||
GetHeaderLength,
|
||||
(void *)&iHeaderLength);
|
||||
pszBuffer = ((p_iBufferSize > (iHeaderLength)) ? p_pszBuffer : malloc(p_iBufferSize+1));
|
||||
pszBuffer = ((p_iBufferSize > (iHeaderLength)) ?
|
||||
p_pszBuffer : malloc(p_iBufferSize+1));
|
||||
pszTmp = pszBuffer;
|
||||
|
||||
GSWDict_PerformForAllElem(p_pHTTPResponse->pHeaders,FormatHeader,&pszTmp);
|
||||
|
@ -349,7 +383,9 @@ char *GSWHTTPResponse_PackageHeaders(GSWHTTPResponse* p_pHTTPResponse,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWHTTPResponse_AddHeaderToString(GSWDictElem* p_pElem,void* p_pData)
|
||||
void
|
||||
GSWHTTPResponse_AddHeaderToString(GSWDictElem *p_pElem,
|
||||
void *p_pData)
|
||||
{
|
||||
GSWString *pString=(GSWString *)p_pData;
|
||||
GSWString_Append(pString,p_pElem->pszKey);
|
||||
|
@ -359,16 +395,21 @@ void GSWHTTPResponse_AddHeaderToString(GSWDictElem* p_pElem,void* p_pData)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest* p_pHTTPRequest,void* p_pLogServerData)
|
||||
GSWHTTPResponse *
|
||||
GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest *p_pHTTPRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWHTTPResponse* pHTTPResponse=GSWHTTPResponse_New(g_szOKStatus[GSWNAMES_INDEX],p_pLogServerData);
|
||||
GSWHTTPResponse *pHTTPResponse=
|
||||
GSWHTTPResponse_New(g_szOKStatus[GSWNAMES_INDEX],p_pLogServerData);
|
||||
GSWDict *pRequestHeaders=NULL;
|
||||
GSWString *pContent=GSWString_New();
|
||||
GSWString *pHeadersBuffer=GSWString_New();
|
||||
const char *pszRemoteAddr=NULL;
|
||||
const char *pszRemoteHost=NULL;
|
||||
char *pszString=NULL;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_BuildStatusResponse");
|
||||
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Start GSWHTTPResponse_BuildStatusResponse");
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Build Status Page.");
|
||||
GSWConfig_LoadConfiguration(p_pLogServerData);
|
||||
GSWDict_AddString(pHTTPResponse->pHeaders,
|
||||
|
@ -377,24 +418,29 @@ GSWHTTPResponse* GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest* p_pHTTPRequ
|
|||
FALSE);
|
||||
|
||||
pRequestHeaders = (GSWDict *)(p_pHTTPRequest->pHeaders);
|
||||
GSWDict_PerformForAllElem(pRequestHeaders,GSWHTTPResponse_AddHeaderToString,pHeadersBuffer);
|
||||
GSWDict_PerformForAllElem(pRequestHeaders,
|
||||
GSWHTTPResponse_AddHeaderToString,pHeadersBuffer);
|
||||
if (GSWConfig_CanDumpStatus())
|
||||
pszString=GSWTemplate_StatusAllowedResponse(TRUE,NULL);
|
||||
else
|
||||
pszString=GSWTemplate_StatusDeniedResponse(TRUE,NULL);
|
||||
GSWString_Append(pContent,pszString);
|
||||
free(pszString);
|
||||
pszRemoteAddr=(const char*)GSWDict_ValueForKey(pRequestHeaders,"x-gsweb-remote-addr");
|
||||
pszRemoteAddr=(const char *)GSWDict_ValueForKey(pRequestHeaders,
|
||||
"x-gsweb-remote-addr");
|
||||
if (!pszRemoteAddr)
|
||||
pszRemoteAddr="";
|
||||
pszRemoteHost=(const char*)GSWDict_ValueForKey(pRequestHeaders,"x-gsweb-remote-host");
|
||||
pszRemoteHost=(const char *)GSWDict_ValueForKey(pRequestHeaders,
|
||||
"x-gsweb-remote-host");
|
||||
if (!pszRemoteHost)
|
||||
pszRemoteHost="";
|
||||
GSWString_SearchReplace(pContent,"##REMOTE_ADDR##",pszRemoteAddr);
|
||||
GSWString_SearchReplace(pContent,"##REMOTE_HOST##",pszRemoteHost);
|
||||
GSWString_SearchReplace(pContent,"##SERVER_INFO##",GSWConfig_ServerStringInfo());
|
||||
GSWString_SearchReplace(pContent,"##SERVER_INFO##",
|
||||
GSWConfig_ServerStringInfo());
|
||||
GSWString_SearchReplace(pContent,"##SERVER_URL##",GSWConfig_ServerURL());
|
||||
GSWString_SearchReplace(pContent,"##ADAPTOR_INFO##",g_szGSWeb_AdaptorStringInfo());
|
||||
GSWString_SearchReplace(pContent,"##ADAPTOR_INFO##",
|
||||
g_szGSWeb_AdaptorStringInfo());
|
||||
GSWString_SearchReplace(pContent,"##ADAPTOR_URL##",g_szGSWeb_AdaptorURL());
|
||||
GSWString_SearchReplace(pContent,"##HEADERS##",pHeadersBuffer->pszData);
|
||||
GSWTemplate_ReplaceStd(pContent,NULL);
|
||||
|
@ -405,17 +451,21 @@ GSWHTTPResponse* GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest* p_pHTTPRequ
|
|||
pHTTPResponse->pContent = pContent->pszData;
|
||||
GSWString_Detach(pContent);
|
||||
GSWString_Free(pContent);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWHTTPResponse_BuildStatusResponse");
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Stop GSWHTTPResponse_BuildStatusResponse");
|
||||
return pHTTPResponse;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWDumpConfigFile(GSWURLComponents* p_pURLComponents,void* p_pLogServerData)
|
||||
GSWHTTPResponse *
|
||||
GSWDumpConfigFile(GSWURLComponents *p_pURLComponents,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWHTTPResponse *pHTTPResponse=NULL;
|
||||
GSWString *pContent=NULL;
|
||||
char pszPrefix[MAXPATHLEN]="";
|
||||
char szReqAppName[MAXPATHLEN]="Unknown";
|
||||
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWDumpConfigFile");
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Creating Applications Page.");
|
||||
if (!g_pszLocalHostName)
|
||||
|
@ -425,22 +475,27 @@ GSWHTTPResponse* GSWDumpConfigFile(GSWURLComponents* p_pURLComponents,void* p_pL
|
|||
g_pszLocalHostName= strdup(szHostName);
|
||||
};
|
||||
|
||||
pHTTPResponse = GSWHTTPResponse_New(g_szOKStatus[GSWNAMES_INDEX],p_pLogServerData);
|
||||
pHTTPResponse = GSWHTTPResponse_New(g_szOKStatus[GSWNAMES_INDEX],
|
||||
p_pLogServerData);
|
||||
GSWDict_AddString(pHTTPResponse->pHeaders,
|
||||
g_szHeader_ContentType,
|
||||
g_szContentType_TextHtml,
|
||||
FALSE);
|
||||
if (p_pURLComponents->stAppName.iLength>0 && p_pURLComponents->stAppName.pszStart)
|
||||
if (p_pURLComponents->stAppName.iLength>0 &&
|
||||
p_pURLComponents->stAppName.pszStart)
|
||||
{
|
||||
strncpy(szReqAppName,p_pURLComponents->stAppName.pszStart,p_pURLComponents->stAppName.iLength);
|
||||
strncpy(szReqAppName,p_pURLComponents->stAppName.pszStart,
|
||||
p_pURLComponents->stAppName.iLength);
|
||||
szReqAppName[p_pURLComponents->stAppName.iLength]=0;
|
||||
};
|
||||
|
||||
strncpy(pszPrefix, p_pURLComponents->stPrefix.pszStart,p_pURLComponents->stPrefix.iLength);
|
||||
strncpy(pszPrefix, p_pURLComponents->stPrefix.pszStart,
|
||||
p_pURLComponents->stPrefix.iLength);
|
||||
pszPrefix[p_pURLComponents->stPrefix.iLength] = '\0';
|
||||
|
||||
GSWConfig_LoadConfiguration(p_pLogServerData);
|
||||
pContent=GSWConfig_DumpGSWApps(szReqAppName,pszPrefix,FALSE,TRUE,p_pLogServerData);
|
||||
pContent=GSWConfig_DumpGSWApps(szReqAppName,pszPrefix,FALSE,TRUE,
|
||||
p_pLogServerData);
|
||||
GSWTemplate_ReplaceStd(pContent,NULL);
|
||||
pHTTPResponse->uContentLength = pContent->iLen;
|
||||
pHTTPResponse->pContent = pContent->pszData;
|
||||
|
@ -449,6 +504,3 @@ GSWHTTPResponse* GSWDumpConfigFile(GSWURLComponents* p_pURLComponents,void* p_pL
|
|||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWDumpConfigFile");
|
||||
return pHTTPResponse;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWHTTPResponse.h - GSWeb: GSWeb Request
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -37,17 +37,23 @@ typedef struct _GSWHTTPResponse
|
|||
void *pContent;
|
||||
} GSWHTTPResponse;
|
||||
|
||||
GSWHTTPResponse* GSWHTTPResponse_New(CONST char* p_pszStatus,void* p_pLogServerData);
|
||||
void GSWHTTPResponse_Free(GSWHTTPResponse* p_pHTTPResponse,void* p_pLogServerData);
|
||||
GSWHTTPResponse *GSWHTTPResponse_New(CONST char *p_pszStatus,
|
||||
void *p_pLogServerData);
|
||||
void GSWHTTPResponse_Free(GSWHTTPResponse *p_pHTTPResponse,
|
||||
void *p_pLogServerData);
|
||||
|
||||
// Get The response from Application
|
||||
GSWHTTPResponse* GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,void* p_pLogServerData);
|
||||
GSWHTTPResponse *GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,
|
||||
void *p_pLogServerData);
|
||||
|
||||
// Build an error response
|
||||
GSWHTTPResponse *GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest,CONST char* p_pszMessage,void* p_pLogServerData);
|
||||
GSWHTTPResponse *GSWHTTPResponse_BuildErrorResponse(GSWAppRequest *p_pAppRequest,
|
||||
CONST char *p_pszMessage,
|
||||
void *p_pLogServerData);
|
||||
|
||||
// Redirect Response
|
||||
GSWHTTPResponse* GSWHTTPResponse_BuildRedirectedResponse(CONST char* p_pszRedirectPath,void* p_pLogServerData);
|
||||
GSWHTTPResponse *GSWHTTPResponse_BuildRedirectedResponse(CONST char *p_pszRedirectPath,
|
||||
void *p_pLogServerData);
|
||||
|
||||
// Add Header
|
||||
void GSWHTTPResponse_AddHeader(GSWHTTPResponse *p_pHTTPResponse,
|
||||
|
@ -57,8 +63,10 @@ char* p_pszGSWHTTPResponse_PackageHeaders(GSWHTTPResponse* p_pHTTPResponse,
|
|||
char *p_pszBuffer,
|
||||
int iBufferSize);
|
||||
|
||||
GSWHTTPResponse* GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest* p_pHTTPRequest,void* p_pLogServerData);
|
||||
GSWHTTPResponse* GSWDumpConfigFile(GSWURLComponents* p_pURLComponents,void* p_pLogServerData);
|
||||
GSWHTTPResponse *GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest *p_pHTTPRequest,
|
||||
void *p_pLogServerData);
|
||||
GSWHTTPResponse* GSWDumpConfigFile(GSWURLComponents *p_pURLComponents,
|
||||
void *p_pLogServerData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWDict.c - GSWeb: Dictionary
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -29,12 +29,14 @@
|
|||
#include "GSWUtil.h"
|
||||
#include "GSWList.h"
|
||||
|
||||
unsigned int GSWList_Count(GSWList* p_pList)
|
||||
unsigned int
|
||||
GSWList_Count(GSWList *p_pList)
|
||||
{
|
||||
return p_pList->uCount;
|
||||
};
|
||||
|
||||
GSWList *GSWList_New(unsigned int p_uCapacity)
|
||||
GSWList *
|
||||
GSWList_New(unsigned int p_uCapacity)
|
||||
{
|
||||
GSWList *pList=calloc(1,sizeof(GSWList));
|
||||
if (pList && p_uCapacity>0)
|
||||
|
@ -42,7 +44,8 @@ GSWList *GSWList_New(unsigned int p_uCapacity)
|
|||
return pList;
|
||||
};
|
||||
|
||||
void GSWList_FreeElements(GSWList* p_pList)
|
||||
void
|
||||
GSWList_FreeElements(GSWList *p_pList)
|
||||
{
|
||||
if (p_pList)
|
||||
{
|
||||
|
@ -56,7 +59,9 @@ void GSWList_FreeElements(GSWList* p_pList)
|
|||
};
|
||||
};
|
||||
|
||||
void GSWList_Free(GSWList* p_pList,BOOL p_fFreeElements)
|
||||
void
|
||||
GSWList_Free(GSWList *p_pList,
|
||||
BOOL p_fFreeElements)
|
||||
{
|
||||
if (p_pList)
|
||||
{
|
||||
|
@ -72,15 +77,20 @@ void GSWList_Free(GSWList* p_pList,BOOL p_fFreeElements)
|
|||
};
|
||||
|
||||
|
||||
void GSWList_Add(GSWList* p_pList,void* p_pElement)
|
||||
void
|
||||
GSWList_Add(GSWList *p_pList,
|
||||
void *p_pElement)
|
||||
{
|
||||
if (p_pList->uCount>=p_pList->uCapacity)
|
||||
GSWList_SetCapacity(p_pList,(p_pList->uCapacity) ? p_pList->uCapacity*2 : 16);
|
||||
GSWList_SetCapacity(p_pList,
|
||||
(p_pList->uCapacity) ? p_pList->uCapacity*2 : 16);
|
||||
p_pList->ppElements[p_pList->uCount] = p_pElement;
|
||||
p_pList->uCount++;
|
||||
};
|
||||
|
||||
void GSWList_RemoveAtIndex(GSWList* p_pList,int p_iIndex)
|
||||
void
|
||||
GSWList_RemoveAtIndex(GSWList *p_pList,
|
||||
int p_iIndex)
|
||||
{
|
||||
if (p_iIndex>=0 && p_iIndex<p_pList->uCount)
|
||||
{
|
||||
|
@ -90,7 +100,9 @@ void GSWList_RemoveAtIndex(GSWList* p_pList,int p_iIndex)
|
|||
};
|
||||
};
|
||||
|
||||
void GSWList_Remove(GSWList* p_pList,void* p_pElement)
|
||||
void
|
||||
GSWList_Remove(GSWList *p_pList,
|
||||
void *p_pElement)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<p_pList->uCount;i++)
|
||||
|
@ -104,37 +116,50 @@ void GSWList_Remove(GSWList* p_pList,void* p_pElement)
|
|||
};
|
||||
|
||||
|
||||
void GSWList_SetCapacity(GSWList* p_pList,unsigned int p_uCapacity)
|
||||
void
|
||||
GSWList_SetCapacity(GSWList *p_pList,
|
||||
unsigned int p_uCapacity)
|
||||
{
|
||||
if (p_uCapacity>p_pList->uCapacity)
|
||||
{
|
||||
if (p_pList->ppElements)
|
||||
p_pList->ppElements=realloc(p_pList->ppElements,p_uCapacity*sizeof(void*));
|
||||
p_pList->ppElements=realloc(p_pList->ppElements,
|
||||
p_uCapacity*sizeof(void *));
|
||||
else
|
||||
p_pList->ppElements=calloc(p_uCapacity, sizeof(void *));
|
||||
p_pList->uCapacity=p_uCapacity;
|
||||
};
|
||||
};
|
||||
|
||||
void GSWList_Sort(GSWList* p_pList,int (*compare)(CONST void*, CONST void*))
|
||||
void
|
||||
GSWList_Sort(GSWList *p_pList,
|
||||
int (*compare)(CONST void *, CONST void *))
|
||||
{
|
||||
if (p_pList->uCount>1)
|
||||
qsort(p_pList->ppElements,p_pList->uCount,sizeof(void *), compare);
|
||||
}
|
||||
|
||||
void *GSWList_BSearch(GSWList* p_pList,CONST void* p_pKey,int (*compare)(CONST void*, CONST void*))
|
||||
void *
|
||||
GSWList_BSearch(GSWList *p_pList,
|
||||
CONST void *p_pKey,
|
||||
int (*compare)(CONST void *, CONST void *))
|
||||
{
|
||||
void **ppElement=NULL;
|
||||
if (p_pList->uCount>0)
|
||||
ppElement=bsearch(p_pKey,p_pList->ppElements,p_pList->uCount,sizeof(void*), compare);
|
||||
ppElement=bsearch(p_pKey,
|
||||
p_pList->ppElements,
|
||||
p_pList->uCount,
|
||||
sizeof(void *),
|
||||
compare);
|
||||
return (ppElement) ? *ppElement : NULL;
|
||||
};
|
||||
|
||||
void* GSWList_ElementAtIndex(GSWList* p_pList,int p_iIndex)
|
||||
void *
|
||||
GSWList_ElementAtIndex(GSWList *p_pList,
|
||||
int p_iIndex)
|
||||
{
|
||||
if (p_iIndex>=0 && p_iIndex<p_pList->uCount)
|
||||
return p_pList->ppElements[p_iIndex];
|
||||
else
|
||||
return NULL;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWList.h - GSWeb: List
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -46,7 +46,9 @@ void GSWList_Remove(GSWList* p_pList,void* p_pElement);
|
|||
void GSWList_RemoveAtIndex(GSWList *p_pList, int p_iIndex);
|
||||
void GSWList_SetCapacity(GSWList *p_pList, unsigned int p_uCapacity);
|
||||
void GSWList_Sort(GSWList *p_pList,int (*compare)(CONST void *, CONST void *));
|
||||
void *GSWList_BSearch(GSWList* p_pList,CONST void* p_pKey,int (*compare)(CONST void *, CONST void *));
|
||||
void *GSWList_BSearch(GSWList *p_pList,
|
||||
CONST void *p_pKey,
|
||||
int (*compare)(CONST void *, CONST void *));
|
||||
|
||||
void *GSWList_ElementAtIndex(GSWList *p_pList,int p_iIndex);
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWLoadBalancing.c - GSWeb: Adaptors: Load Balancing
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -45,8 +45,10 @@
|
|||
#include "GSWApp.h"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
||||
void* p_pLogServerData, GSWURLComponents* p_pURLComponents)
|
||||
BOOL
|
||||
GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData,
|
||||
GSWURLComponents *p_pURLComponents)
|
||||
{
|
||||
BOOL fFound=FALSE;
|
||||
GSWApp *pApp=NULL;
|
||||
|
@ -67,7 +69,8 @@ BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
|||
while (!fFound && iTries-->0)
|
||||
{
|
||||
pApp->iIndex = (pApp->iIndex+1) % uInstancesCount;
|
||||
pAppInstance=(GSWAppInstance*)GSWDict_ValueForKey(&pApp->stInstancesDict,
|
||||
pAppInstance =
|
||||
(GSWAppInstance *)GSWDict_ValueForKey(&pApp->stInstancesDict,
|
||||
GSWList_ElementAtIndex(pInstancesList,pApp->iIndex));
|
||||
if (pAppInstance)
|
||||
{
|
||||
|
@ -96,21 +99,30 @@ BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
|||
{
|
||||
BOOL okay = TRUE;
|
||||
// check if refused, time to try again ?
|
||||
if (p_pURLComponents->stRequestHandlerKey.iLength==0 || p_pURLComponents->stRequestHandlerKey.pszStart==NULL) {
|
||||
GSWAppInfo *thisAppInfo = GSWAppInfo_Find(p_pAppRequest->pszName, pAppInstance->iInstance);
|
||||
if (thisAppInfo && thisAppInfo->isRefused) {
|
||||
if (p_pURLComponents->stRequestHandlerKey.iLength==0 ||
|
||||
p_pURLComponents->stRequestHandlerKey.pszStart==NULL)
|
||||
{
|
||||
GSWAppInfo *thisAppInfo =
|
||||
GSWAppInfo_Find(p_pAppRequest->pszName,
|
||||
pAppInstance->iInstance);
|
||||
if (thisAppInfo && thisAppInfo->isRefused)
|
||||
{
|
||||
time_t actTime = (time_t)0;
|
||||
// this instance refuses new sessions
|
||||
time(&actTime);
|
||||
if (actTime > thisAppInfo->timeNextRetryTime) {
|
||||
if (actTime > thisAppInfo->timeNextRetryTime)
|
||||
{
|
||||
thisAppInfo->isRefused = FALSE; // try it again
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
okay = FALSE; // try an other instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (okay == TRUE) {
|
||||
if (okay == TRUE)
|
||||
{
|
||||
fFound = TRUE;
|
||||
strcpy(p_pAppRequest->pszName,pApp->pszName);
|
||||
p_pAppRequest->iInstance = pAppInstance->iInstance;
|
||||
|
@ -128,7 +140,8 @@ BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
|||
GSWLock_Unlock(g_lockAppList);
|
||||
|
||||
if (fFound)
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"LoadBalance: looking for %s, fFound instance %d on %s:%d",
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"LoadBalance: looking for %s, fFound instance %d on %s:%d",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
|
@ -141,7 +154,10 @@ BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServerData, GSWURLComponents* p_pURLComponents)
|
||||
BOOL
|
||||
GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData,
|
||||
GSWURLComponents *p_pURLComponents)
|
||||
{
|
||||
BOOL fFound=FALSE;
|
||||
GSWApp *pApp=NULL;
|
||||
|
@ -155,7 +171,9 @@ BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServ
|
|||
GSWAppInstance *pAppInstance=NULL;
|
||||
char szInstanceNum[50]="";
|
||||
sprintf(szInstanceNum,"%d",p_pAppRequest->iInstance);
|
||||
pAppInstance=(GSWAppInstance*)GSWDict_ValueForKey(&pApp->stInstancesDict,szInstanceNum);
|
||||
pAppInstance =
|
||||
(GSWAppInstance *)GSWDict_ValueForKey(&pApp->stInstancesDict,
|
||||
szInstanceNum);
|
||||
if (pAppInstance)
|
||||
{
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Instance Found");
|
||||
|
@ -163,22 +181,30 @@ BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServ
|
|||
{
|
||||
BOOL okay = TRUE;
|
||||
// check if refused, time to try again ?
|
||||
if (p_pURLComponents->stRequestHandlerKey.iLength==0 || p_pURLComponents->stRequestHandlerKey.pszStart==NULL) {
|
||||
GSWAppInfo *thisAppInfo = GSWAppInfo_Find(p_pAppRequest->pszName, pAppInstance->iInstance);
|
||||
if (thisAppInfo && thisAppInfo->isRefused) {
|
||||
if (p_pURLComponents->stRequestHandlerKey.iLength==0 ||
|
||||
p_pURLComponents->stRequestHandlerKey.pszStart==NULL)
|
||||
{
|
||||
GSWAppInfo *thisAppInfo =
|
||||
GSWAppInfo_Find(p_pAppRequest->pszName,
|
||||
pAppInstance->iInstance);
|
||||
if (thisAppInfo && thisAppInfo->isRefused)
|
||||
{
|
||||
time_t actTime = (time_t)0;
|
||||
// this instance refuses new sessions
|
||||
time(&actTime);
|
||||
if (actTime > thisAppInfo->timeNextRetryTime) {
|
||||
if (actTime > thisAppInfo->timeNextRetryTime)
|
||||
{
|
||||
thisAppInfo->isRefused = FALSE; // try it again
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
okay = FALSE; // try an other instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (okay == TRUE) {
|
||||
|
||||
if (okay == TRUE)
|
||||
{
|
||||
fFound=TRUE;
|
||||
p_pAppRequest->iInstance = pAppInstance->iInstance;
|
||||
p_pAppRequest->pszHost = pAppInstance->pszHostName;
|
||||
|
@ -201,7 +227,8 @@ BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServ
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest* p_pAppRequest,
|
||||
void
|
||||
GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWAppInstance *pAppInstance;
|
||||
|
@ -210,7 +237,8 @@ void GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest* p_pAppRequest,
|
|||
pAppInstance = p_pAppRequest->pAppInstance;
|
||||
pAppInstance->uOpenedRequestsNb--;
|
||||
pAppInstance->timeNextRetryTime=now+APP_CONNECT_RETRY_DELAY;
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,"Marking %s unresponsive",p_pAppRequest->pszName);
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,"Marking %s unresponsive",
|
||||
p_pAppRequest->pszName);
|
||||
if (!pAppInstance->fValid)
|
||||
{
|
||||
if (GSWAppInstance_FreeIFND(pAppInstance))
|
||||
|
@ -219,19 +247,22 @@ void GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest* p_pAppRequest,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLoadBalancing_StartAppRequest(GSWAppRequest* p_pAppRequest,
|
||||
void
|
||||
GSWLoadBalancing_StartAppRequest(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWAppInstance *pAppInstance=p_pAppRequest->pAppInstance;
|
||||
if (pAppInstance->timeNextRetryTime!=0)
|
||||
{
|
||||
pAppInstance->timeNextRetryTime=0;
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,"Marking %s as alive",p_pAppRequest->pszName);
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,
|
||||
"Marking %s as alive",p_pAppRequest->pszName);
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLoadBalancing_StopAppRequest(GSWAppRequest *p_pAppRequest,
|
||||
void
|
||||
GSWLoadBalancing_StopAppRequest(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWAppInstance *pAppInstance=p_pAppRequest->pAppInstance;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWLoadBalancing.h - GSWeb: GSWeb Load Balancing
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -24,11 +24,18 @@
|
|||
#ifndef _GSWLoadBalancing_h__
|
||||
#define _GSWLoadBalancing_h__
|
||||
|
||||
BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,void* p_pLogServerData, GSWURLComponents* p_pURLComponents);
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest* p_pAppRequest,void* p_pLogServerData, GSWURLComponents* p_pURLComponents);
|
||||
void GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
void GSWLoadBalancing_StartAppRequest(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
void GSWLoadBalancing_StopAppRequest(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
BOOL GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData,
|
||||
GSWURLComponents *p_pURLComponents);
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData,
|
||||
GSWURLComponents *p_pURLComponents);
|
||||
void GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData);
|
||||
void GSWLoadBalancing_StartAppRequest(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData);
|
||||
void GSWLoadBalancing_StopAppRequest(GSWAppRequest *p_pAppRequest,
|
||||
void *p_pLogServerData);
|
||||
|
||||
#endif // GSWLoadBalancing
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWLock.h - GSWeb: Lock
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWPropList.c - GSWeb: Adaptors: GSWPropList
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: March 2000
|
||||
|
@ -39,7 +39,8 @@
|
|||
#include "GSWPropList.h"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* PLGetType(proplist_t pl)
|
||||
CONST char *
|
||||
PLGetType(proplist_t pl)
|
||||
{
|
||||
if (!pl)
|
||||
return "NULL";
|
||||
|
@ -60,7 +61,8 @@ CONST char* PLGetType(proplist_t pl)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWPropList_TestDictionary(proplist_t pl,
|
||||
BOOL
|
||||
GSWPropList_TestDictionary(proplist_t pl,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszParents,
|
||||
|
@ -92,7 +94,8 @@ BOOL GSWPropList_TestDictionary(proplist_t pl,
|
|||
{
|
||||
GSWLogSized(GSW_CRITICAL,
|
||||
p_pLogServerData,
|
||||
256+SafeStrlen(p_pszParents)+SafeStrlen(p_pszKey)+SafeStrlen(pszMsgInfo0)+SafeStrlen(pszMsgInfo1),
|
||||
256+SafeStrlen(p_pszParents)+SafeStrlen(p_pszKey)+
|
||||
SafeStrlen(pszMsgInfo0)+SafeStrlen(pszMsgInfo1),
|
||||
"%s/%s %s %s",
|
||||
(p_pszParents ? p_pszParents : ""),
|
||||
(p_pszKey ? p_pszKey : ""),
|
||||
|
@ -107,7 +110,8 @@ BOOL GSWPropList_TestDictionary(proplist_t pl,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWPropList_TestArray(proplist_t pl,
|
||||
BOOL
|
||||
GSWPropList_TestArray(proplist_t pl,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszParents,
|
||||
|
@ -139,7 +143,8 @@ BOOL GSWPropList_TestArray(proplist_t pl,
|
|||
{
|
||||
GSWLogSized(GSW_CRITICAL,
|
||||
p_pLogServerData,
|
||||
256+SafeStrlen(p_pszParents)+SafeStrlen(p_pszKey)+SafeStrlen(pszMsgInfo0)+SafeStrlen(pszMsgInfo1),
|
||||
256+SafeStrlen(p_pszParents)+SafeStrlen(p_pszKey)+
|
||||
SafeStrlen(pszMsgInfo0)+SafeStrlen(pszMsgInfo1),
|
||||
"%s/%s %s %s",
|
||||
(p_pszParents ? p_pszParents : ""),
|
||||
(p_pszKey ? p_pszKey : ""),
|
||||
|
@ -154,7 +159,8 @@ BOOL GSWPropList_TestArray(proplist_t pl,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWPropList_TestString(proplist_t pl,
|
||||
BOOL
|
||||
GSWPropList_TestString(proplist_t pl,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszParents,
|
||||
|
@ -186,7 +192,8 @@ BOOL GSWPropList_TestString(proplist_t pl,
|
|||
{
|
||||
GSWLogSized(GSW_CRITICAL,
|
||||
p_pLogServerData,
|
||||
256+SafeStrlen(p_pszParents)+SafeStrlen(p_pszKey)+SafeStrlen(pszMsgInfo0)+SafeStrlen(pszMsgInfo1),
|
||||
256+SafeStrlen(p_pszParents)+SafeStrlen(p_pszKey)+
|
||||
SafeStrlen(pszMsgInfo0)+SafeStrlen(pszMsgInfo1),
|
||||
"%s/%s %s %s",
|
||||
(p_pszParents ? p_pszParents : ""),
|
||||
(p_pszKey ? p_pszKey : ""),
|
||||
|
@ -202,7 +209,8 @@ BOOL GSWPropList_TestString(proplist_t pl,
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
//Do not destroy the returned proplist !
|
||||
proplist_t GSWPropList_GetDictionaryEntry(proplist_t p_propListDictionary,
|
||||
proplist_t
|
||||
GSWPropList_GetDictionaryEntry(proplist_t p_propListDictionary,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszParents,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
|
@ -211,12 +219,14 @@ proplist_t GSWPropList_GetDictionaryEntry(proplist_t p_propListDictionary,
|
|||
{
|
||||
proplist_t propListKey=PLMakeString((char *)p_pszKey);
|
||||
proplist_t propList=NULL;
|
||||
if (GSWPropList_TestDictionary(p_propListDictionary,TRUE,NULL,p_pszParents,p_pLogServerData))
|
||||
if (GSWPropList_TestDictionary(p_propListDictionary,TRUE,NULL,
|
||||
p_pszParents,p_pLogServerData))
|
||||
{
|
||||
propList=PLGetDictionaryEntry(p_propListDictionary,propListKey);
|
||||
if (p_pTestFn)
|
||||
{
|
||||
if (!(*p_pTestFn)(propList,p_fErrorIfNotExists,p_pszKey,p_pszParents,p_pLogServerData))
|
||||
if (!(*p_pTestFn)(propList,p_fErrorIfNotExists,
|
||||
p_pszKey,p_pszParents,p_pLogServerData))
|
||||
propList=NULL;
|
||||
};
|
||||
};
|
||||
|
@ -226,7 +236,8 @@ proplist_t GSWPropList_GetDictionaryEntry(proplist_t p_propListDictionary,
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
//Do not destroy the returned proplist !
|
||||
proplist_t GSWPropList_GetArrayElement(proplist_t p_propListArray,
|
||||
proplist_t
|
||||
GSWPropList_GetArrayElement(proplist_t p_propListArray,
|
||||
int p_iIndex,
|
||||
CONST char *p_pszParents,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
|
@ -234,14 +245,16 @@ proplist_t GSWPropList_GetArrayElement(proplist_t p_propListArray,
|
|||
void *p_pLogServerData)
|
||||
{
|
||||
proplist_t propList=NULL;
|
||||
if (GSWPropList_TestArray(p_propListArray,TRUE,NULL,p_pszParents,p_pLogServerData))
|
||||
if (GSWPropList_TestArray(p_propListArray,TRUE,NULL,
|
||||
p_pszParents,p_pLogServerData))
|
||||
{
|
||||
propList=PLGetArrayElement(p_propListArray,p_iIndex);
|
||||
if (p_pTestFn)
|
||||
{
|
||||
char szKey[120]="";
|
||||
sprintf(szKey,"index: %d",p_iIndex);
|
||||
if (!(*p_pTestFn)(propList,p_fErrorIfNotExists,szKey,p_pszParents,p_pLogServerData))
|
||||
if (!(*p_pTestFn)(propList,p_fErrorIfNotExists,szKey,
|
||||
p_pszParents,p_pLogServerData))
|
||||
propList=NULL;
|
||||
};
|
||||
};
|
||||
|
@ -250,21 +263,25 @@ proplist_t GSWPropList_GetArrayElement(proplist_t p_propListArray,
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
//You have to free the returned proplist !
|
||||
proplist_t GSWPropList_GetAllDictionaryKeys(proplist_t p_propListDictionary,
|
||||
proplist_t
|
||||
GSWPropList_GetAllDictionaryKeys(proplist_t p_propListDictionary,
|
||||
CONST char *p_pszParents,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
PLTypeTestFn p_pTestFn,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
proplist_t propList=NULL;
|
||||
if (GSWPropList_TestDictionary(p_propListDictionary,TRUE,NULL,p_pszParents,p_pLogServerData))
|
||||
if (GSWPropList_TestDictionary(p_propListDictionary,TRUE,NULL,
|
||||
p_pszParents,p_pLogServerData))
|
||||
{
|
||||
propList=PLGetAllDictionaryKeys(p_propListDictionary);
|
||||
if (p_pTestFn)
|
||||
{
|
||||
if (!(*p_pTestFn)(propList,p_fErrorIfNotExists,NULL,p_pszParents,p_pLogServerData))
|
||||
if (!(*p_pTestFn)(propList,p_fErrorIfNotExists,NULL,
|
||||
p_pszParents,p_pLogServerData))
|
||||
propList=NULL;
|
||||
};
|
||||
};
|
||||
return propList;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWPropList.h - GSWeb: PropList
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: March 2000
|
||||
|
@ -28,7 +28,11 @@
|
|||
#include <time.h>
|
||||
#include "GSWList.h"
|
||||
|
||||
typedef BOOL (*PLTypeTestFn)(proplist_t pl,BOOL p_fErrorIfNotExists,CONST char* p_pszKey,CONST char* p_pszParents,void* p_pLogServerData);
|
||||
typedef BOOL (*PLTypeTestFn)(proplist_t pl,
|
||||
BOOL p_fErrorIfNotExists,
|
||||
CONST char *p_pszKey,
|
||||
CONST char *p_pszParents,
|
||||
void *p_pLogServerData);
|
||||
|
||||
CONST char *PLGetType(proplist_t pl);
|
||||
BOOL GSWPropList_TestDictionary(proplist_t pl,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWString.c - GSWeb: Adaptors: String
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
|
@ -33,7 +33,8 @@
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWString* GSWString_New()
|
||||
GSWString *
|
||||
GSWString_New()
|
||||
{
|
||||
GSWString *pString = malloc(sizeof(GSWString));
|
||||
memset(pString,0,sizeof(GSWString));
|
||||
|
@ -41,7 +42,8 @@ GSWString* GSWString_New()
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWString_Free(GSWString* p_pString)
|
||||
void
|
||||
GSWString_Free(GSWString *p_pString)
|
||||
{
|
||||
if (p_pString)
|
||||
{
|
||||
|
@ -55,19 +57,22 @@ void GSWString_Free(GSWString* p_pString)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int GSWString_Len(GSWString* p_pString)
|
||||
int
|
||||
GSWString_Len(GSWString *p_pString)
|
||||
{
|
||||
return p_pString->iLen;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWString_Detach(GSWString* p_pString)
|
||||
void
|
||||
GSWString_Detach(GSWString *p_pString)
|
||||
{
|
||||
memset(p_pString,0,sizeof(GSWString));
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWString_GrowUpToSize(GSWString* p_pString,
|
||||
void
|
||||
GSWString_GrowUpToSize(GSWString *p_pString,
|
||||
int p_iSize)
|
||||
{
|
||||
if (p_iSize>p_pString->iSize)
|
||||
|
@ -86,7 +91,8 @@ void GSWString_GrowUpToSize(GSWString* p_pString,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWString_Append(GSWString* p_pString,
|
||||
void
|
||||
GSWString_Append(GSWString *p_pString,
|
||||
CONST char *p_pszString)
|
||||
{
|
||||
int iLen = strlen(p_pszString);
|
||||
|
@ -96,7 +102,8 @@ void GSWString_Append(GSWString* p_pString,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWString_SearchReplace(GSWString* p_pString,
|
||||
void
|
||||
GSWString_SearchReplace(GSWString *p_pString,
|
||||
CONST char *p_pszSearch,
|
||||
CONST char *p_pszReplace)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWString.h - GSWeb: String
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWTemplates.c - GSWeb: GSWTemplates
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: March 2000
|
||||
|
@ -132,30 +132,39 @@ char* g_szDump_AppInstanceTemplate[2]={
|
|||
"</TR>"};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_GetTemplate(BOOL p_fHTML,GSWApp* pApp,CONST char* p_pszTemplateName)
|
||||
char *
|
||||
GSWTemplate_GetTemplate(BOOL p_fHTML,
|
||||
GSWApp *pApp,
|
||||
CONST char *p_pszTemplateName)
|
||||
{
|
||||
char *pszTemplate=NULL;
|
||||
if (pApp && pApp->pszAdaptorTemplatesPath && p_pszTemplateName)
|
||||
{
|
||||
FILE *fd=NULL;
|
||||
GSWConfig *gswConfig=GSWConfig_GetConfig();
|
||||
int applen=strlen(pApp->pszAdaptorTemplatesPath)+strlen(p_pszTemplateName);
|
||||
int globallen=strlen(gswConfig->pszAdaptorTemplatesPath)+strlen(p_pszTemplateName);
|
||||
int applen=strlen(pApp->pszAdaptorTemplatesPath)+
|
||||
strlen(p_pszTemplateName);
|
||||
int globallen=strlen(gswConfig->pszAdaptorTemplatesPath)+
|
||||
strlen(p_pszTemplateName);
|
||||
int maxlen=(applen > globallen ? applen : globallen)+20;
|
||||
{
|
||||
char *pathName=malloc(maxlen);
|
||||
memset(pathName,0,maxlen);
|
||||
if (p_fHTML)
|
||||
sprintf(pathName,"%s/%s.html",pApp->pszAdaptorTemplatesPath,p_pszTemplateName);
|
||||
sprintf(pathName,"%s/%s.html",pApp->pszAdaptorTemplatesPath,
|
||||
p_pszTemplateName);
|
||||
else
|
||||
sprintf(pathName,"%s/%s.txt",pApp->pszAdaptorTemplatesPath,p_pszTemplateName);
|
||||
sprintf(pathName,"%s/%s.txt",pApp->pszAdaptorTemplatesPath,
|
||||
p_pszTemplateName);
|
||||
fd=fopen(pathName,"r");
|
||||
if (!fd)
|
||||
{
|
||||
if (p_fHTML)
|
||||
sprintf(pathName,"%s/%s.html",gswConfig->pszAdaptorTemplatesPath,p_pszTemplateName);
|
||||
sprintf(pathName,"%s/%s.html",
|
||||
gswConfig->pszAdaptorTemplatesPath,p_pszTemplateName);
|
||||
else
|
||||
sprintf(pathName,"%s/%s.txt",gswConfig->pszAdaptorTemplatesPath,p_pszTemplateName);
|
||||
sprintf(pathName,"%s/%s.txt",
|
||||
gswConfig->pszAdaptorTemplatesPath,p_pszTemplateName);
|
||||
fd=fopen(pathName,"r");
|
||||
}
|
||||
if (fd)
|
||||
|
@ -180,7 +189,9 @@ char* GSWTemplate_GetTemplate(BOOL p_fHTML,GSWApp* pApp,CONST char* p_pszTemplat
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_ErrorResponseText(BOOL p_fHTML,GSWApp* pApp)
|
||||
char *
|
||||
GSWTemplate_ErrorResponseText(BOOL p_fHTML,
|
||||
GSWApp *pApp)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"ErrorResponseText");
|
||||
|
@ -190,7 +201,9 @@ char* GSWTemplate_ErrorResponseText(BOOL p_fHTML,GSWApp* pApp)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML,GSWApp* pApp)
|
||||
char *
|
||||
GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML,
|
||||
GSWApp *pApp)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"ErrorNoResponse");
|
||||
|
@ -200,7 +213,9 @@ char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML,GSWApp* pApp)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML,GSWApp* pApp)
|
||||
char *
|
||||
GSWTemplate_StatusAllowedResponse(BOOL p_fHTML,
|
||||
GSWApp *pApp)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"StatusAllowedResponse");
|
||||
|
@ -210,7 +225,9 @@ char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML,GSWApp* pApp)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML,GSWApp* pApp)
|
||||
char *
|
||||
GSWTemplate_StatusDeniedResponse(BOOL p_fHTML,
|
||||
GSWApp *pApp)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"StatusDeniedResponse");
|
||||
|
@ -220,7 +237,8 @@ char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML,GSWApp* pApp)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_GetDumpHead(BOOL p_fHTML)
|
||||
char *
|
||||
GSWTemplate_GetDumpHead(BOOL p_fHTML)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpHead");
|
||||
|
@ -230,7 +248,8 @@ char* GSWTemplate_GetDumpHead(BOOL p_fHTML)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_GetDumpFoot(BOOL p_fHTML)
|
||||
char *
|
||||
GSWTemplate_GetDumpFoot(BOOL p_fHTML)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpFoot");
|
||||
|
@ -240,7 +259,8 @@ char* GSWTemplate_GetDumpFoot(BOOL p_fHTML)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_GetDumpApp(BOOL p_fHTML)
|
||||
char *
|
||||
GSWTemplate_GetDumpApp(BOOL p_fHTML)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpApp");
|
||||
|
@ -250,7 +270,8 @@ char* GSWTemplate_GetDumpApp(BOOL p_fHTML)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML)
|
||||
char *
|
||||
GSWTemplate_GetDumpAppInstance(BOOL p_fHTML)
|
||||
{
|
||||
char *pszString=NULL;
|
||||
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpAppInstance");
|
||||
|
@ -260,9 +281,12 @@ char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWTemplate_ReplaceStd(GSWString* p_pString,GSWApp* p_pApp)
|
||||
void
|
||||
GSWTemplate_ReplaceStd(GSWString *p_pString,
|
||||
GSWApp *p_pApp)
|
||||
{
|
||||
GSWString_SearchReplace(p_pString,"##CONF_FILE##",GSWConfig_GetConfigFilePath());
|
||||
GSWString_SearchReplace(p_pString,"##CONF_FILE##",
|
||||
GSWConfig_GetConfigFilePath());
|
||||
if (p_pApp)
|
||||
{
|
||||
GSWString_SearchReplace(p_pString,"##APP_NAME##",p_pApp->pszName);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GSWTemplates.h - GSWeb: GSWTemplates
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: March 2000
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWURLUtil.c - GSWeb: Adaptors: URL Utils
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -36,7 +36,10 @@
|
|||
#include "GSWURLUtil.h"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,void* p_pLogServerData)
|
||||
GSWURLError
|
||||
GSWParseURL(GSWURLComponents *p_pURLComponents,
|
||||
CONST char *p_pszURL,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWURLError eError=GSWURLError_OK;
|
||||
GSWURLComponent *pURLCPrefix=&p_pURLComponents->stPrefix;
|
||||
|
@ -54,7 +57,8 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
CONST char *pszS=NULL;
|
||||
CONST char *pszURLEnd=p_pszURL+iURLLen;
|
||||
CONST char *pszQueryStringMark=strchr(pszStart,'?');
|
||||
CONST char* pszTmpStop=(pszQueryStringMark && pszQueryStringMark<pszURLEnd) ? pszQueryStringMark : pszURLEnd;
|
||||
CONST char *pszTmpStop=(pszQueryStringMark && pszQueryStringMark<pszURLEnd) ?
|
||||
pszQueryStringMark : pszURLEnd;
|
||||
int i, j;
|
||||
memset(p_pURLComponents,0,sizeof(GSWURLComponents));
|
||||
|
||||
|
@ -77,12 +81,14 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
|
||||
// Get Application Name
|
||||
pszStart=pszNext;
|
||||
pszAppExtension=strcasestr(pszStart,g_szGSWeb_AppExtention[GSWNAMES_INDEX]);
|
||||
pszAppExtension=strcasestr(pszStart,
|
||||
g_szGSWeb_AppExtention[GSWNAMES_INDEX]);
|
||||
if (pszAppExtension)
|
||||
pszfoundExtension=g_szGSWeb_AppExtention[GSWNAMES_INDEX];
|
||||
else
|
||||
{
|
||||
pszAppExtension=strcasestr(pszStart,g_szGSWeb_AppExtention[WONAMES_INDEX]);
|
||||
pszAppExtension=strcasestr(pszStart,
|
||||
g_szGSWeb_AppExtention[WONAMES_INDEX]);
|
||||
if (pszAppExtension)
|
||||
pszfoundExtension=g_szGSWeb_AppExtention[WONAMES_INDEX];
|
||||
};
|
||||
|
@ -117,7 +123,8 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
pURLCAppName->iLength = pszStop-pszStart;
|
||||
pURLCAppName->iLength = max(pURLCAppName->iLength,0);
|
||||
// Drop trailing slashes
|
||||
while(pURLCAppName->iLength && pURLCAppName->pszStart[pURLCAppName->iLength-1]== '/')
|
||||
while(pURLCAppName->iLength &&
|
||||
pURLCAppName->pszStart[pURLCAppName->iLength-1]== '/')
|
||||
pURLCAppName->iLength--;
|
||||
pURLCAppName->iLength = max(pURLCAppName->iLength,0);
|
||||
|
||||
|
@ -155,7 +162,8 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
// not all digits, so it's the request handler key !
|
||||
pURLCReqHandlerKey->pszStart = pURLCAppNum->pszStart;
|
||||
pURLCReqHandlerKey->iLength = pURLCAppNum->iLength;
|
||||
pURLCReqHandlerKey->iLength = max(pURLCReqHandlerKey->iLength,0);
|
||||
pURLCReqHandlerKey->iLength =
|
||||
max(pURLCReqHandlerKey->iLength,0);
|
||||
pURLCAppNum->pszStart="";
|
||||
pURLCAppNum->iLength=0;
|
||||
}
|
||||
|
@ -170,7 +178,8 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
pszStop = pszS;
|
||||
pURLCReqHandlerKey->pszStart = pszStart;
|
||||
pURLCReqHandlerKey->iLength = pszStop-pszStart;
|
||||
pURLCReqHandlerKey->iLength = max(pURLCReqHandlerKey->iLength,0);
|
||||
pURLCReqHandlerKey->iLength =
|
||||
max(pURLCReqHandlerKey->iLength,0);
|
||||
pszNext=(pszStop<pszTmpStop) ? pszStop+1 : pszStop;
|
||||
};
|
||||
};
|
||||
|
@ -204,7 +213,8 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
if (!pURLCAppName->pszStart || pURLCAppName->iLength<=0)
|
||||
{
|
||||
eError=GSWURLError_InvalidAppName;
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,"ParseURL GSWURLError_InvalidAppName");
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,
|
||||
"ParseURL GSWURLError_InvalidAppName");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -214,28 +224,34 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
if (!pURLCAppNum->pszStart)
|
||||
{
|
||||
eError=GSWURLError_InvalidAppNumber;
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,"ParseURL GSWURLError_InvalidAppNumber");
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,
|
||||
"ParseURL GSWURLError_InvalidAppNumber");
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"pURLCAppNum=%.*s",
|
||||
pURLCAppNum->iLength,pURLCAppNum->pszStart);
|
||||
if ((!pURLCReqHandlerKey->pszStart || pURLCReqHandlerKey->iLength<=0)
|
||||
if ((!pURLCReqHandlerKey->pszStart ||
|
||||
pURLCReqHandlerKey->iLength<=0)
|
||||
&& pURLCReqHandlerPath->iLength>0)
|
||||
{
|
||||
eError=GSWURLError_InvalidRequestHandlerKey;
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,"ParseURL GSWURLError_InvalidRequestHandlerKey");
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,
|
||||
"ParseURL GSWURLError_InvalidRequestHandlerKey");
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"pURLCReqHandlerPath=%.*s",
|
||||
pURLCReqHandlerPath->iLength,pURLCReqHandlerPath->pszStart);
|
||||
pURLCReqHandlerPath->iLength,
|
||||
pURLCReqHandlerPath->pszStart);
|
||||
/*
|
||||
if (!pURLCReqHandlerPath->pszStart || pURLCReqHandlerPath->iLength<=0)
|
||||
if (!pURLCReqHandlerPath->pszStart ||
|
||||
pURLCReqHandlerPath->iLength<=0)
|
||||
eError=GSWURLError_InvalidRequestHandlerPath;
|
||||
else if (!pURLCQueryString->pszStart || pURLCQueryString->iLength<=0)
|
||||
else if (!pURLCQueryString->pszStart ||
|
||||
pURLCQueryString->iLength<=0)
|
||||
eError=GSWURLError_InvalidQueryString;
|
||||
*/
|
||||
};
|
||||
|
@ -247,7 +263,10 @@ GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWComposeURL(char* p_pszURL,GSWURLComponents* p_pURLComponents,void* p_pLogServerData)
|
||||
void
|
||||
GSWComposeURL(char *p_pszURL,
|
||||
GSWURLComponents *p_pURLComponents,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
GSWURLComponent *pURLCPrefix=&p_pURLComponents->stPrefix;
|
||||
GSWURLComponent *pURLCAppName=&p_pURLComponents->stAppName;
|
||||
|
@ -275,28 +294,33 @@ void GSWComposeURL(char* p_pszURL,GSWURLComponents* p_pURLComponents,void* p_pLo
|
|||
if (pURLCReqHandlerKey->iLength>0)
|
||||
{
|
||||
*p_pszURL++='/';
|
||||
strncpy(p_pszURL, pURLCReqHandlerKey->pszStart,pURLCReqHandlerKey->iLength);
|
||||
strncpy(p_pszURL, pURLCReqHandlerKey->pszStart,
|
||||
pURLCReqHandlerKey->iLength);
|
||||
p_pszURL+= pURLCReqHandlerKey->iLength;
|
||||
};
|
||||
|
||||
if (pURLCReqHandlerPath->iLength>0)
|
||||
{
|
||||
*p_pszURL++='/';
|
||||
strncpy(p_pszURL, pURLCReqHandlerPath->pszStart,pURLCReqHandlerPath->iLength);
|
||||
strncpy(p_pszURL, pURLCReqHandlerPath->pszStart,
|
||||
pURLCReqHandlerPath->iLength);
|
||||
p_pszURL+= pURLCReqHandlerPath->iLength;
|
||||
};
|
||||
|
||||
if (pURLCQueryString->iLength>0)
|
||||
{
|
||||
*p_pszURL++='?';
|
||||
strncpy(p_pszURL,pURLCQueryString->pszStart,pURLCQueryString->iLength);
|
||||
strncpy(p_pszURL,pURLCQueryString->pszStart,
|
||||
pURLCQueryString->iLength);
|
||||
p_pszURL+= pURLCQueryString->iLength;
|
||||
};
|
||||
*p_pszURL=0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int GSWComposeURLLen(GSWURLComponents* p_pURLComponents,void* p_pLogServerData)
|
||||
int
|
||||
GSWComposeURLLen(GSWURLComponents *p_pURLComponents,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
int iLength=0;
|
||||
GSWURLComponent *pURLCPrefix=&p_pURLComponents->stPrefix;
|
||||
|
@ -339,9 +363,12 @@ CONST char* szGSWURLErrorMessage[]=
|
|||
"Invalid suffix in URL" //GSWURLError_InvalidSuffix
|
||||
};
|
||||
|
||||
CONST char* GSWURLErrorMessage(GSWURLError p_eError,void* p_pLogServerData)
|
||||
CONST char *
|
||||
GSWURLErrorMessage(GSWURLError p_eError,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
if (p_eError>=0 && p_eError<sizeof(szGSWURLErrorMessage)/sizeof(szGSWURLErrorMessage[0]))
|
||||
if (p_eError>=0 &&
|
||||
p_eError<sizeof(szGSWURLErrorMessage)/sizeof(szGSWURLErrorMessage[0]))
|
||||
return szGSWURLErrorMessage[p_eError];
|
||||
else
|
||||
return "";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWURLUtil.h - GSWeb: Adaptors: URL Utils
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -69,10 +69,20 @@ typedef enum
|
|||
GSWURLError_InvalidSuffix
|
||||
} GSWURLError;
|
||||
|
||||
GSWURLError GSWParseURL(GSWURLComponents* p_pURLComponents,CONST char* p_pszURL,void* p_pLogServerData);
|
||||
void GSWComposeURL(char* p_pszURL,GSWURLComponents* p_pURLComponents,void* p_pLogServerData);
|
||||
int GSWComposeURLLen(GSWURLComponents* p_pURLComponents,void* p_pLogServerData);
|
||||
CONST char* GSWURLErrorMessage(GSWURLError p_eError,void* p_pLogServerData);
|
||||
GSWURLError GSWParseURL(GSWURLComponents *p_pURLComponents,
|
||||
CONST char *p_pszURL,
|
||||
void *p_pLogServerData);
|
||||
|
||||
void GSWComposeURL(char *p_pszURL,
|
||||
GSWURLComponents *p_pURLComponents,
|
||||
void *p_pLogServerData);
|
||||
|
||||
int GSWComposeURLLen(GSWURLComponents *p_pURLComponents,
|
||||
void *p_pLogServerData);
|
||||
|
||||
CONST char *GSWURLErrorMessage(GSWURLError p_eError,
|
||||
void *p_pLogServerData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //_cplusplus
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWUtil.c - GSWeb: Util
|
||||
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
@ -57,12 +57,15 @@ static GSWDict* g_pHostCache = NULL;
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLog_Init(GSWDict* p_pDict,int p_iLevel)
|
||||
void
|
||||
GSWLog_Init(GSWDict *p_pDict,
|
||||
int p_iLevel)
|
||||
{
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void VGSWLogSizedIntern(char* file,
|
||||
void
|
||||
VGSWLogSizedIntern(char *file,
|
||||
int line,
|
||||
char *fn,
|
||||
int p_iLevel,
|
||||
|
@ -100,7 +103,8 @@ void VGSWLogSizedIntern(char* file,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLog(int p_iLevel,
|
||||
void
|
||||
GSWLog(int p_iLevel,
|
||||
#if defined(Apache)
|
||||
server_rec *p_pLogServerData,
|
||||
#else
|
||||
|
@ -122,7 +126,8 @@ void GSWLog(int p_iLevel,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLogSized(int p_iLevel,
|
||||
void
|
||||
GSWLogSized(int p_iLevel,
|
||||
#if defined(Apache)
|
||||
server_rec *p_pLogServerData,
|
||||
#else
|
||||
|
@ -145,7 +150,8 @@ void GSWLogSized(int p_iLevel,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLogIntern(char* file,
|
||||
void
|
||||
GSWLogIntern(char *file,
|
||||
int line,
|
||||
char *fn,
|
||||
int p_iLevel,
|
||||
|
@ -170,7 +176,8 @@ void GSWLogIntern(char* file,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWLogSizedIntern(char* file,
|
||||
void
|
||||
GSWLogSizedIntern(char *file,
|
||||
int line,
|
||||
char *fn,
|
||||
int p_iLevel,
|
||||
|
@ -198,13 +205,15 @@ void GSWLogSizedIntern(char* file,
|
|||
|
||||
//--------------------------------------------------------------------
|
||||
// return new len
|
||||
int DeleteTrailingCRNL(char* p_pszString)
|
||||
int
|
||||
DeleteTrailingCRNL(char *p_pszString)
|
||||
{
|
||||
int i=0;
|
||||
if (p_pszString)
|
||||
{
|
||||
i=strlen(p_pszString)-1;
|
||||
while (i>=0 && p_pszString[i] && (p_pszString[i]=='\r' || p_pszString[i]=='\n'))
|
||||
while (i>=0 && p_pszString[i] &&
|
||||
(p_pszString[i]=='\r' || p_pszString[i]=='\n'))
|
||||
p_pszString[i--]=0;
|
||||
i++;
|
||||
};
|
||||
|
@ -212,7 +221,8 @@ int DeleteTrailingCRNL(char* p_pszString)
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int DeleteTrailingSlash(char* p_pszString)
|
||||
int
|
||||
DeleteTrailingSlash(char *p_pszString)
|
||||
{
|
||||
int i=0;
|
||||
if (p_pszString)
|
||||
|
@ -226,7 +236,8 @@ int DeleteTrailingSlash(char* p_pszString)
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int DeleteTrailingSpaces(char* p_pszString)
|
||||
int
|
||||
DeleteTrailingSpaces(char *p_pszString)
|
||||
{
|
||||
int i=0;
|
||||
if (p_pszString)
|
||||
|
@ -240,18 +251,21 @@ int DeleteTrailingSpaces(char* p_pszString)
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
int SafeStrlen(CONST char* p_pszString)
|
||||
int
|
||||
SafeStrlen(CONST char *p_pszString)
|
||||
{
|
||||
return (p_pszString ? strlen(p_pszString) : 0);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* SafeStrdup(CONST char* p_pszString)
|
||||
char *
|
||||
SafeStrdup(CONST char *p_pszString)
|
||||
{
|
||||
return (p_pszString ? strdup(p_pszString) : NULL);
|
||||
};
|
||||
|
||||
char* strcasestr(CONST char* p_pszString,CONST char* p_pszSearchedString)
|
||||
char *
|
||||
strcasestr(CONST char *p_pszString,CONST char *p_pszSearchedString)
|
||||
{
|
||||
if (p_pszString && p_pszSearchedString)
|
||||
{
|
||||
|
@ -268,7 +282,8 @@ char* strcasestr(CONST char* p_pszString,CONST char* p_pszSearchedString)
|
|||
BOOL fSame=TRUE;
|
||||
int j=0;
|
||||
for(j=1;j<iSearchedStringLen && fSame;j++)
|
||||
fSame=toupper(p_pszString[i+j])==toupper(p_pszSearchedString[j]);
|
||||
fSame=toupper(p_pszString[i+j]) ==
|
||||
toupper(p_pszSearchedString[j]);
|
||||
if (fSame)
|
||||
return p_pszString+i;
|
||||
};
|
||||
|
@ -283,7 +298,8 @@ char* strcasestr(CONST char* p_pszString,CONST char* p_pszSearchedString)
|
|||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWUtil_ClearHostCache()
|
||||
void
|
||||
GSWUtil_ClearHostCache()
|
||||
{
|
||||
if (g_pHostCache)
|
||||
{
|
||||
|
@ -293,13 +309,16 @@ void GSWUtil_ClearHostCache()
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
PSTHostent GSWUtil_FindHost(CONST char* p_pszHost,void* p_pLogServerData)
|
||||
PSTHostent
|
||||
GSWUtil_FindHost(CONST char *p_pszHost,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
PSTHostent pHost=NULL;
|
||||
if (!p_pszHost)
|
||||
p_pszHost="localhost";
|
||||
|
||||
pHost = (g_pHostCache) ? (PSTHostent)GSWDict_ValueForKey(g_pHostCache,p_pszHost) : NULL;
|
||||
pHost = (g_pHostCache) ?
|
||||
(PSTHostent)GSWDict_ValueForKey(g_pHostCache,p_pszHost) : NULL;
|
||||
if (!pHost)
|
||||
{
|
||||
pHost = GSWUtil_HostLookup(p_pszHost,p_pLogServerData);
|
||||
|
@ -325,7 +344,8 @@ PSTHostent GSWUtil_FindHost(CONST char* p_pszHost,void* p_pLogServerData)
|
|||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CONST char* hstrerror(int herr)
|
||||
CONST char *
|
||||
hstrerror(int herr)
|
||||
{
|
||||
if (herr == -1) // see errno
|
||||
return strerror(errno);
|
||||
|
@ -347,10 +367,12 @@ CONST char* hstrerror(int herr)
|
|||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static PSTHostent GSWUtil_CopyHostent(PSTHostent p_pHost)
|
||||
static PSTHostent
|
||||
GSWUtil_CopyHostent(PSTHostent p_pHost)
|
||||
{
|
||||
PSTHostent pNewHost=NULL;
|
||||
int iSize=(ROUND_UP(sizeof(struct hostent), sizeof(void *)))+strlen(p_pHost->h_name)+1;
|
||||
int iSize=(ROUND_UP(sizeof(struct hostent),
|
||||
sizeof(void *)))+strlen(p_pHost->h_name)+1;
|
||||
int iAliasNb=0;
|
||||
int iAddressesNb = 0;
|
||||
char **ppszAliasOrAddress=NULL;
|
||||
|
@ -393,7 +415,8 @@ static PSTHostent GSWUtil_CopyHostent(PSTHostent p_pHost)
|
|||
pTmp+=strlen(pNewHost->h_name)+1;
|
||||
|
||||
// Copy Aliases
|
||||
for (ppszAliasOrAddress=p_pHost->h_aliases,ppszNewHostAliasOrAddress=pNewHost->h_aliases;
|
||||
for (ppszAliasOrAddress=p_pHost->h_aliases,
|
||||
ppszNewHostAliasOrAddress=pNewHost->h_aliases;
|
||||
ppszAliasOrAddress && *ppszAliasOrAddress;
|
||||
ppszAliasOrAddress++,ppszNewHostAliasOrAddress++)
|
||||
{
|
||||
|
@ -404,12 +427,14 @@ static PSTHostent GSWUtil_CopyHostent(PSTHostent p_pHost)
|
|||
*ppszNewHostAliasOrAddress=NULL;
|
||||
|
||||
pTmp=(void *)ROUND_UP(pTmp,pNewHost->h_length);
|
||||
for (ppszAliasOrAddress=p_pHost->h_addr_list,ppszNewHostAliasOrAddress=pNewHost->h_addr_list;
|
||||
for (ppszAliasOrAddress=p_pHost->h_addr_list,
|
||||
ppszNewHostAliasOrAddress=pNewHost->h_addr_list;
|
||||
ppszAliasOrAddress && *ppszAliasOrAddress;
|
||||
ppszAliasOrAddress++,ppszNewHostAliasOrAddress++)
|
||||
{
|
||||
*ppszNewHostAliasOrAddress=(char *)pTmp;
|
||||
memcpy(*ppszNewHostAliasOrAddress,*ppszAliasOrAddress,pNewHost->h_length);
|
||||
memcpy(*ppszNewHostAliasOrAddress,*ppszAliasOrAddress,
|
||||
pNewHost->h_length);
|
||||
pTmp+=pNewHost->h_length;
|
||||
};
|
||||
*ppszNewHostAliasOrAddress=NULL;
|
||||
|
@ -417,7 +442,9 @@ static PSTHostent GSWUtil_CopyHostent(PSTHostent p_pHost)
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
PSTHostent GSWUtil_HostLookup(CONST char *p_pszHost,void* p_pLogServerData)
|
||||
PSTHostent
|
||||
GSWUtil_HostLookup(CONST char *p_pszHost,
|
||||
void *p_pLogServerData)
|
||||
{
|
||||
PSTHostent pHost=NULL;
|
||||
struct in_addr hostaddr;
|
||||
|
@ -474,14 +501,16 @@ PSTHostent GSWUtil_HostLookup(CONST char *p_pszHost,void* p_pLogServerData)
|
|||
BUFLEN,
|
||||
&error);
|
||||
#else // !SOLARIS
|
||||
pHost = (gethostbyname_r(p_pszHost,&stTmpHost,szBuffer)==0) ? &stTmpHost : NULL;
|
||||
pHost = (gethostbyname_r(p_pszHost,&stTmpHost,szBuffer)==0) ?
|
||||
&stTmpHost : NULL;
|
||||
error = (pHost) ? 0 : h_errno;
|
||||
#endif // SOLARIS
|
||||
};
|
||||
#else // !HAS_REENTRANT_GETHOSTENT
|
||||
if (isdigit(*p_pszHost))
|
||||
{
|
||||
pHost = gethostbyaddr((char *)&hostaddr.s_addr, sizeof(hostaddr.s_addr), AF_INET);
|
||||
pHost = gethostbyaddr((char *)&hostaddr.s_addr, sizeof(hostaddr.s_addr),
|
||||
AF_INET);
|
||||
error = (pHost) ? 0 : h_errno;
|
||||
}
|
||||
else
|
||||
|
@ -493,7 +522,8 @@ PSTHostent GSWUtil_HostLookup(CONST char *p_pszHost,void* p_pLogServerData)
|
|||
|
||||
if (!pHost)
|
||||
{
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,"gethostbyname(%s) returns no host: %s",
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,
|
||||
"gethostbyname(%s) returns no host: %s",
|
||||
p_pszHost,
|
||||
hstrerror(error));
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* GSWUtil.h - GSWeb: Adaptors: Util
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Set all of the common environment variables.
|
||||
#
|
||||
# Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
#
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* config.h - GSWeb: Adaptors: Config
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* config.h - GSWeb: Adaptors: Config
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jully 1999
|
||||
Date: July 1999
|
||||
|
||||
This file is part of the GNUstep Web Library.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue