From fe3b9ce17c03557a5a9b48e5207dbd948a862c14 Mon Sep 17 00:00:00 2001 From: Sebastian Reitenbach Date: Sun, 9 Jun 2013 08:14:21 +0000 Subject: [PATCH] * GSWAdaptors/Apache/mod_gsweb.c * GSWAdaptors/common/GNUmakefile * GSWAdaptors/common/GSWConfig.[h|c] * GSWAdaptors/common/GSWLock.h * GSWAdaptors/common/GSWStats.c * GSWAdaptors/common/GSWUtil.[h|c] * GSWAdaptors/common/config.h remove #ifdefs of Netscape, Apache and Apache2, only leave parts of Apache git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@36712 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 12 ++++- GSWAdaptors/Apache/mod_gsweb.c | 2 +- GSWAdaptors/common/GNUmakefile | 7 --- GSWAdaptors/common/GSWConfig.c | 20 ------- GSWAdaptors/common/GSWConfig.h | 11 ---- GSWAdaptors/common/GSWLock.h | 26 +++------ GSWAdaptors/common/GSWStats.c | 4 -- GSWAdaptors/common/GSWUtil.c | 97 ---------------------------------- GSWAdaptors/common/GSWUtil.h | 29 ---------- GSWAdaptors/common/config.h | 29 ---------- 10 files changed, 18 insertions(+), 219 deletions(-) diff --git a/ChangeLog b/ChangeLog index e91f0a0..36fba67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-06-09: Sebastian Reitenbach + * GSWAdaptors/Apache/mod_gsweb.c + * GSWAdaptors/common/GNUmakefile + * GSWAdaptors/common/GSWConfig.[h|c] + * GSWAdaptors/common/GSWLock.h + * GSWAdaptors/common/GSWStats.c + * GSWAdaptors/common/GSWUtil.[h|c] + * GSWAdaptors/common/config.h + remove #ifdefs of Netscape, Apache and Apache2, only + leave parts of Apache + 2013-06-06: Sebastian Reitenbach * GSWAdaptors/common/GSWAppConnectSocket.c * GSWAdaptors/common/GSWUtil.c @@ -9,7 +20,6 @@ note about Apache adaptor to work with OpenBSD Apache delete GSWAdaptors/netscape - 2013-06-02: David Wetzel * GSWeb/GSWMessage.m Remove warning diff --git a/GSWAdaptors/Apache/mod_gsweb.c b/GSWAdaptors/Apache/mod_gsweb.c index 5c4ffad..e48b256 100644 --- a/GSWAdaptors/Apache/mod_gsweb.c +++ b/GSWAdaptors/Apache/mod_gsweb.c @@ -525,7 +525,7 @@ GSWeb_Handler(request_rec *p_pRequestRec) memset(&stStats,0,sizeof(stStats)); // The request time stamp - stStats._requestTS=GSWTime_makeFromAPRTime(p_pRequestRec->request_time); + stStats._requestTS=(GSWTime)(p_pRequestRec->request_time); // Handling start time stamp stStats._beginHandleRequestTS=GSWTime_now(); diff --git a/GSWAdaptors/common/GNUmakefile b/GSWAdaptors/common/GNUmakefile index 9f108cb..0622239 100644 --- a/GSWAdaptors/common/GNUmakefile +++ b/GSWAdaptors/common/GNUmakefile @@ -1,5 +1,3 @@ - - #Defaults #Directories @@ -18,12 +16,7 @@ ADAPTORLIB = $(OBJROOT)/libAdaptor.a COMMON = $(SRCROOT)/common INCLUDE = -I$(COMMON) -ifeq "solaris" "$(PLATFORM_OS)" -CFLAGS = -O2 $(RC_CFLAGS) $(INCLUDE) -DCGI -DSOLARIS -DNEEDS_HSTRERR -else CFLAGS = -O2 $(RC_CFLAGS) $(INCLUDE) -DCGI -endif - all:: $(ADAPTORLIB) diff --git a/GSWAdaptors/common/GSWConfig.c b/GSWAdaptors/common/GSWConfig.c index 24792c0..08c6329 100644 --- a/GSWAdaptors/common/GSWConfig.c +++ b/GSWAdaptors/common/GSWConfig.c @@ -62,39 +62,19 @@ const char *g_szGSWeb_MimeType=GSWEB__MIME_TYPE; //const char *g_szGSWeb_Conf_DocRoot=GSWEB_CONF__DOC_ROOT; const char *g_szGSWeb_Conf_ConfigFilePath=GSWEB_CONF__CONFIG_FILE_PATH; - -// Apache -#if defined(Apache) const char *g_szGSWeb_Conf_Alias=GSWEB_CONF__ALIAS; -#endif - -// Netscape -#if defined(Netscape) -const char *g_szGSWeb_Conf_PathTrans=GSWEB_CONF__PATH_TRANS; -const char *g_szGSWeb_Conf_AppRoot=GSWEB_CONF__APP_ROOT; -const char *g_szGSWeb_Conf_Name=GSWEB_CONF__NAME; -#endif - const char *g_szGSWeb_InstanceCookie[2]={ GSWEB_INSTANCE_COOKIE_GSW, GSWEB_INSTANCE_COOKIE_WO }; - const char *g_szGSWeb_Server=SERVER; const char *g_szGSWeb_ServerAndAdaptorVersion=SERVER "/" GSWEB_SERVER_ADAPTOR_VERSION_MAJOR_STRING "." GSWEB_SERVER_ADAPTOR_VERSION_MINOR_STRING; - const char *const g_szGNUstep = "GNUstep"; const char *const g_szOKGSWeb[2] = { "OK GSWeb", "OK Apple"}; const char *const g_szOKStatus[2] = { "HTTP/1.0 200 OK GNUstep GSWeb", "HTTP/1.0 200 OK Apple GSWeb"}; -#if defined(Apache) #define GSWServerVersion ap_get_server_version() #define GSWServerBuilt ap_get_server_built() #define GSWServerURL "http://www.apache.org" -#else -#define GSWServerVersion "Unknown" -#define GSWServerBuilt "Unknown" -#define GSWServerURL "http://www.gnustepweb.org" -#endif //==================================================================== GSWLock g_lockAppList=NULL; diff --git a/GSWAdaptors/common/GSWConfig.h b/GSWAdaptors/common/GSWConfig.h index 6d7ba11..c8e4462 100644 --- a/GSWAdaptors/common/GSWConfig.h +++ b/GSWAdaptors/common/GSWConfig.h @@ -53,18 +53,7 @@ extern const char *g_szGSWeb_MimeType; //extern const char *g_szGSWeb_Conf_DocRoot; extern const char *g_szGSWeb_Conf_ConfigFilePath; -// Apache -#if defined(Apache) extern const char *g_szGSWeb_Conf_Alias; -#endif - -// Netscape -#if defined(Netscape) -extern const char *g_szGSWeb_Conf_PathTrans; -extern const char *g_szGSWeb_Conf_AppRoot; -extern const char *g_szGSWeb_Conf_Name; -#endif - extern const char *g_szGSWeb_InstanceCookie[2]; diff --git a/GSWAdaptors/common/GSWLock.h b/GSWAdaptors/common/GSWLock.h index fbbdba4..f2e067e 100644 --- a/GSWAdaptors/common/GSWLock.h +++ b/GSWAdaptors/common/GSWLock.h @@ -31,26 +31,12 @@ extern "C" { // Apache has no theading for old versions -#if !defined(REENTRANT) || defined(Apache) - #define GSWLock void* - #define GSWLock_Init(TheLock) - #define GSWLock_Lock(TheLock) - #define GSWLock_Unlock(TheLock) - #define GSWLock_Free(TheLock) - #define GSWLock_Sleep(SecNb) sleep(SecNb) -#elif defined(Netscape) - #include - #include - #include - #define GSWLock CRITICAL - #define GSWLock_Init(TheLock) (TheLock = crit_init()) - #define GSWLock_Lock(TheLock) crit_enter(TheLock) - #define GSWLock_Unlock(TheLock) crit_exit(TheLock) - #define GSWLock_Free(TheLock) crit_terminate(TheLock) - #define GSWLock_Sleep(SecNb) systhread_sleep(SecNb*1000) -#else - #error "GSWLock.h Unknwon server" -#endif +#define GSWLock void* +#define GSWLock_Init(TheLock) +#define GSWLock_Lock(TheLock) +#define GSWLock_Unlock(TheLock) +#define GSWLock_Free(TheLock) +#define GSWLock_Sleep(SecNb) sleep(SecNb) #ifdef __cplusplus } diff --git a/GSWAdaptors/common/GSWStats.c b/GSWAdaptors/common/GSWStats.c index ec80982..1bc56ef 100644 --- a/GSWAdaptors/common/GSWStats.c +++ b/GSWAdaptors/common/GSWStats.c @@ -38,12 +38,8 @@ #include "config.h" #include "GSWLock.h" -#if defined(Netscape) -#include -#elif defined(Apache) #include #include -#endif #include "config.h" #include "GSWUtil.h" diff --git a/GSWAdaptors/common/GSWUtil.c b/GSWAdaptors/common/GSWUtil.c index c43bfab..2e47edb 100644 --- a/GSWAdaptors/common/GSWUtil.c +++ b/GSWAdaptors/common/GSWUtil.c @@ -38,12 +38,8 @@ #include "config.h" #include "GSWLock.h" -#if defined(Netscape) -#include -#elif defined(Apache) #include #include -#endif #include "config.h" #include "GSWUtil.h" @@ -136,11 +132,7 @@ VGSWLogSizedIntern(char *file, int line, char *fn, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif int p_iBufferSize, CONST char *p_pszFormat, va_list ap) @@ -156,21 +148,9 @@ VGSWLogSizedIntern(char *file, vsnprintf(szBuffer, p_iBufferSize+511, p_pszFormat, ap); szBuffer[p_iBufferSize+511] = 0; -#if defined(Netscape) - log_error(0,"GSWeb: ",NULL,NULL,szBuffer); -#endif - -#if defined(Apache) -#if defined(Apache2) - ap_log_error(file,line,p_iLevel,0, - (server_rec *)p_pLogServerData, - "GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer); -#else ap_log_error(file,line,p_iLevel, (server_rec *)p_pLogServerData, "GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer); -#endif -#endif }; } @@ -180,11 +160,7 @@ GSWLog( char *file, int line, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif CONST char *p_pszFormat, ...) { va_list ap; @@ -204,11 +180,7 @@ GSWLog( //-------------------------------------------------------------------- void GSWLogSized(int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif int p_iBufferSize, CONST char *p_pszFormat, ...) { @@ -231,11 +203,7 @@ GSWLogIntern(char *file, int line, char *fn, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif CONST char *p_pszFormat,...) { va_list ap; @@ -257,11 +225,7 @@ GSWLogSizedIntern(char *file, int line, char *fn, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif int p_iBufferSize, CONST char *p_pszFormat,...) { @@ -369,10 +333,6 @@ strcasestr(CONST char *p_pszString,CONST char *p_pszSearchedString) return NULL; }; -#if defined(HAS_REENTRANT_GETHOSTENT) && !defined(_REENTRANT) -#define _REENTRANT /* needs to be defined so proper structs get included */ -#endif - //-------------------------------------------------------------------- void GSWUtil_ClearHostCache() @@ -414,11 +374,6 @@ GSWUtil_FindHost(CONST char *p_pszHost, #define BUFLEN 4096 -#if defined(NEEDS_HSTRERR) -#ifndef NETDB_SUCCESS -#define NETDB_SUCCESS 0 -#endif - //-------------------------------------------------------------------- CONST char * hstrerror(int herr) @@ -440,7 +395,6 @@ hstrerror(int herr) else return "unknown error"; } -#endif //-------------------------------------------------------------------- static PSTHostent @@ -488,62 +442,12 @@ GSWUtil_HostLookup(CONST char *p_pszHost, struct hostent stTmpHost; int error=0; -#if defined(HAS_REENTRANT_GETHOSTENT) - char szBuffer[BUFLEN]; - - pHost = &stTmpHost; /* point to struct on the stack */ - memset(pHost,0,sizeof(struct hostent)); - memset(szBuffer,0,sizeof(szBuffer)); -#endif - if (!p_pszHost) p_pszHost="localhost"; if (isdigit(*p_pszHost)) hostaddr.s_addr=inet_addr(p_pszHost); -#if defined(HAS_REENTRANT_GETHOSTENT) - if (isdigit(*p_pszHost)) - { -#if defined(SOLARIS) - pHost = gethostbyaddr_r((char *)&hostaddr.s_addr, - sizeof(hostaddr.s_addr), - AF_INET, - pHost, - szBuffer, - BUFLEN, &error); -#else // !SOLARIS - if (gethostbyaddr_r((char *)&hostaddr.s_addr, - sizeof(hostaddr.s_addr), - AF_INET, - &stTmpHost, - szBuffer) == 0) - { - pHost = &stTmpHost; - error = 0; - } - else - { - pHost=NULL; - error = h_errno; - }; -#endif // SOLARIS - } - else - { -#if defined(SOLARIS) - pHost = gethostbyname_r(p_pszHost, - &stTmpHost, - szBuffer, - BUFLEN, - &error); -#else // !SOLARIS - pHost = (gethostbyname_r(p_pszHost,&stTmpHost,szBuffer)==0) ? - &stTmpHost : NULL; - error = (pHost) ? 0 : h_errno; -#endif // SOLARIS - }; -#else // !HAS_REENTRANT_GETHOSTENT pHost = &stTmpHost; if (isdigit(*p_pszHost)) { @@ -557,7 +461,6 @@ GSWUtil_HostLookup(CONST char *p_pszHost, pHost = gethostbyname(p_pszHost); error = (pHost) ? 0 : h_errno; } -#endif // HAS_REENTRANT_GETHOSTENT if (!pHost) { diff --git a/GSWAdaptors/common/GSWUtil.h b/GSWAdaptors/common/GSWUtil.h index eb3f4e7..9c7e499 100644 --- a/GSWAdaptors/common/GSWUtil.h +++ b/GSWAdaptors/common/GSWUtil.h @@ -37,7 +37,6 @@ extern "C" { #endif -#if defined(Apache) #include "httpd.h" #include "http_log.h" //#define APLOG_EMERG LOG_EMERG /* system is unusable */ @@ -48,14 +47,6 @@ extern "C" { //#define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */ #define GSW_INFO APLOG_INFO /* informational */ #define GSW_DEBUG APLOG_DEBUG /* debug-level messages */ -#else -#define GSW_DEBUG 0 -#define GSW_INFO 1 -#define GSW_WARNING 2 -#define GSW_ERROR 3 -#define GSW_CRITICAL 4 -#endif - #define max(x, y) ((x) > (y) ? (x) : (y)) #define min(x, y) ((x) < (y) ? (x) : (y)) @@ -76,10 +67,6 @@ long GSWTime_msecPart(GSWTime t); #define GSWTime_floatSec(t) ((double)(((double)GSWTime_secPart(t))+((double)GSWTime_usecPart(t))/USEC_PER_SEC)) -#ifdef Apache -#define GSWTime_makeFromAPRTime(aprtime) ((GSWTime)(aprtime)) -#endif - //==================================================================== // Asserts #define GSWAssert(condition,p_pLogServerData,p_pszFormat, args...); \ @@ -97,11 +84,7 @@ long GSWTime_msecPart(GSWTime t); void GSWLog( char *file, int line, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif CONST char *p_pszFormat, ...); #define GSWDebugLog(p_pLogServerData,p_pszFormat, args...); \ @@ -110,11 +93,7 @@ int p_iLevel, { if ((condition)) GSWLog(__FILE__, __LINE__,GSW_DEBUG,p_pLogServerData,p_pszFormat, ## args);}; void GSWLogSized(int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif int p_iBufferSize, CONST char *p_pszFormat, ...); @@ -122,11 +101,7 @@ void GSWLogIntern(char *file, int line, char *fn, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif CONST char *p_pszFormat, ...); @@ -134,11 +109,7 @@ void GSWLogSizedIntern(char *file, int line, char *fn, int p_iLevel, -#if defined(Apache) server_rec *p_pLogServerData, -#else - void *p_pLogServerData, -#endif int p_iBufferSize, CONST char *p_pszFormat, ...); diff --git a/GSWAdaptors/common/config.h b/GSWAdaptors/common/config.h index f138229..739fa77 100644 --- a/GSWAdaptors/common/config.h +++ b/GSWAdaptors/common/config.h @@ -30,10 +30,6 @@ extern "C" { #endif //_cplusplus -#if defined(Apache2) -#define Apache -#endif - #define CONST const #define DEBUG @@ -80,37 +76,12 @@ extern "C" { //#define GSWEB_CONF__DOC_ROOT "GSWeb_DocumentRoot" #define GSWEB_CONF__CONFIG_FILE_PATH "GSWeb_ConfigFilePath" -// Aapche -#if defined(Apache) #define GSWEB_CONF__ALIAS "GSWeb_Alias" -#endif - -// Netscape -#if defined(Netscape) -#define GSWEB_CONF__PATH_TRANS "from" // NameTrans -#define GSWEB_CONF__APP_ROOT "dir" // NameTrans -#define GSWEB_CONF__NAME "name" // NameTrans, Object -#endif - #define GSWEB_INSTANCE_COOKIE_WO "woinst=" #define GSWEB_INSTANCE_COOKIE_GSW "gswinst=" -/* - * operating specific things regarding gethostbyname() - */ -#if defined(SOLARIS) -#define HAS_REENTRANT_GETHOSTENT -#if defined(NSAPI) || defined(Apache) -#define NEEDS_HSTRERR -#endif -#endif - -#if defined(Apache) #define SERVER "Apache" -#elif defined(Netscape) -#define SERVER "NSAPI" -#endif #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256