From fd9c76a410827eac14fed085e5cc41b7837f9e9e Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 15 Apr 2005 13:18:37 +0000 Subject: [PATCH] minor improvements git-svn-id: http://svn.opengroupware.org/SOPE/trunk@737 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/mod_ngobjweb/ChangeLog | 6 ++++ sope-appserver/mod_ngobjweb/GNUmakefile | 11 ++++-- sope-appserver/mod_ngobjweb/handler.c | 47 +++++++++++++------------ 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/sope-appserver/mod_ngobjweb/ChangeLog b/sope-appserver/mod_ngobjweb/ChangeLog index 4a59a4d0..76b92f30 100644 --- a/sope-appserver/mod_ngobjweb/ChangeLog +++ b/sope-appserver/mod_ngobjweb/ChangeLog @@ -1,3 +1,9 @@ +2005-04-15 Helge Hess + + * GNUmakefile: autolocate apxs2 (tested on SuSE 9.1) + + * handler.c: minor code cleanups + 2005-02-24 Helge Hess * handler.c: only write the x-webobjects-port if the Apache variable diff --git a/sope-appserver/mod_ngobjweb/GNUmakefile b/sope-appserver/mod_ngobjweb/GNUmakefile index d55f750c..9ee5de52 100644 --- a/sope-appserver/mod_ngobjweb/GNUmakefile +++ b/sope-appserver/mod_ngobjweb/GNUmakefile @@ -13,15 +13,22 @@ ifneq ($(apxs),yes) ifneq ($(apxs),) APXS=$(apxs) else -APXS=$(shell which apxs) +APXS=$(shell which apxs 2>/dev/null) endif else -APXS=$(shell which apxs) +APXS=$(shell which apxs 2>/dev/null) endif else APXS= endif +ifeq ($(APXS),) +APXS=$(shell which apxs2 2>/dev/null) +ifeq ($(APXS),) +APXS = $(APACHE)/sbin/apxs2 +endif +endif + ifneq ($(APXS),) ifneq ($(shared),no) APXS_CFLAGS = $(shell $(APXS) -q CFLAGS_SHLIB) $(shell $(APXS) -q CFLAGS) diff --git a/sope-appserver/mod_ngobjweb/handler.c b/sope-appserver/mod_ngobjweb/handler.c index 8a861916..db16345a 100644 --- a/sope-appserver/mod_ngobjweb/handler.c +++ b/sope-appserver/mod_ngobjweb/handler.c @@ -373,7 +373,8 @@ int ngobjweb_handler(request_rec *r) { if (addressLen > 10000) { ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, - "suspect instance port length (%li) ...", (long int) addressLen); + "suspect instance port length (%li) ...", + (long int) addressLen); return 500; } @@ -401,8 +402,10 @@ int ngobjweb_handler(request_rec *r) { /* write request to application server */ - if (HEAVY_LOG) - ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, "transfer reqline"); + if (HEAVY_LOG) { + ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, + "transfer reqline"); + } { char *reqLine; @@ -428,8 +431,10 @@ int ngobjweb_handler(request_rec *r) { /* transfer headers */ if (writeError == 0) { - if (HEAVY_LOG) - ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, "transfer hdrs"); + if (HEAVY_LOG) { + ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, + "transfer hdrs"); + } /* extended adaptor headers */ { @@ -437,17 +442,15 @@ int ngobjweb_handler(request_rec *r) { const char *value; value = r->protocol; - value = value ? value : "http"; - if (value) { - if (!NGBufferedDescriptor_writeHttpHeader(toApp, - "x-webobjects-server-protocol", - value)) { - writeError = 1; - goto writeErrorHandler; - } + value = (value != NULL) ? value : "http"; + if (!NGBufferedDescriptor_writeHttpHeader(toApp, + "x-webobjects-server-protocol", + value)) { + writeError = 1; + goto writeErrorHandler; } - - if ((value = r->connection->remote_ip)) { + + if ((value = r->connection->remote_ip) != NULL) { if (!NGBufferedDescriptor_writeHttpHeader(toApp, "x-webobjects-remote-addr", value)) { @@ -458,7 +461,7 @@ int ngobjweb_handler(request_rec *r) { value = r->connection->remote_host; if (value == NULL) value = r->connection->remote_ip; - if (value) { + if (value != NULL) { if (!NGBufferedDescriptor_writeHttpHeader(toApp, "x-webobjects-remote-host", value)) { @@ -468,9 +471,9 @@ int ngobjweb_handler(request_rec *r) { } #ifdef AP_VERSION_1 - if ((value = r->connection->ap_auth_type)) { + if ((value = r->connection->ap_auth_type) != NULL) { #else - if ((value = r->ap_auth_type)) { + if ((value = r->ap_auth_type) != NULL) { #endif if (!NGBufferedDescriptor_writeHttpHeader(toApp, "x-webobjects-auth-type", @@ -481,9 +484,9 @@ int ngobjweb_handler(request_rec *r) { } #ifdef AP_VERSION_1 - if ((value = r->connection->user)) { + if ((value = r->connection->user) != NULL) { #else - if ((value = r->user)) { + if ((value = r->user) != NULL) { #endif if (!NGBufferedDescriptor_writeHttpHeader(toApp, "x-webobjects-remote-user", @@ -492,7 +495,7 @@ int ngobjweb_handler(request_rec *r) { goto writeErrorHandler; } } - + if (cfg != NULL) { if (cfg->appPrefix != NULL) { if (!NGBufferedDescriptor_writeHttpHeader(toApp, @@ -509,7 +512,7 @@ int ngobjweb_handler(request_rec *r) { writeError = 1; goto writeErrorHandler; } - + if (r->server->port != 0) { apr_snprintf(tmp, sizeof(tmp), "%i", r->server->port); if (!NGBufferedDescriptor_writeHttpHeader(toApp, -- 2.39.5