summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-12-23 08:18:38 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-12-23 08:18:38 +0000
commit681567b28116421496c4b7560a5b70f9730b8a79 (patch)
tree527231756f6a291ba35a217e3cd880c2cf15e5e0 /sca-cpp/trunk/modules/http
parentf55fe8a88efb11b57fcb393ce5958e5dcace24d7 (diff)
Use HTTPD ap_log_error instead of stderr to log when running inside HTTPD, to get log piping and rotation to work.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1222604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/http')
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-conf2
-rw-r--r--sca-cpp/trunk/modules/http/httpd.hpp5
-rw-r--r--sca-cpp/trunk/modules/http/mod-openauth.cpp26
-rw-r--r--sca-cpp/trunk/modules/http/mod-ssltunnel.cpp1
4 files changed, 21 insertions, 13 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd-conf b/sca-cpp/trunk/modules/http/httpd-conf
index 50134410a9..5bcde9f633 100755
--- a/sca-cpp/trunk/modules/http/httpd-conf
+++ b/sca-cpp/trunk/modules/http/httpd-conf
@@ -81,7 +81,6 @@ HostNameLookups Off
# [timestamp] [access] remote-host remote-ident remote-user "request-line"
# status response-size "referrer" "user-agent" "user-track" local-IP
# virtual-host response-time bytes-received bytes-sent
-LogLevel notice
LogFormat "[%{%a %b %d %H:%M:%S %Y}t] [access] %h %l %u \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{cookie}n\" %A %V %D %I %O" combined
Include conf/log.conf
@@ -152,6 +151,7 @@ EOF
# Configure logging
cat >$root/conf/log.conf <<EOF
# Generated by: httpd-conf $*
+LogLevel notice
ErrorLog $root/logs/error_log
CustomLog $root/logs/access_log combined
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp
index 06d53e28c2..f4e3767881 100644
--- a/sca-cpp/trunk/modules/http/httpd.hpp
+++ b/sca-cpp/trunk/modules/http/httpd.hpp
@@ -672,7 +672,6 @@ const char* debugOptional(const char* s) {
* Log a header
*/
int debugHeader(unused void* r, const char* key, const char* value) {
- gc_scoped_pool();
cdebug << " header key: " << key << ", value: " << value << endl;
return 1;
}
@@ -681,7 +680,6 @@ int debugHeader(unused void* r, const char* key, const char* value) {
* Log an environment variable
*/
int debugEnv(unused void* r, const char* key, const char* value) {
- gc_scoped_pool();
cdebug << " var key: " << key << ", value: " << value << endl;
return 1;
}
@@ -690,7 +688,6 @@ int debugEnv(unused void* r, const char* key, const char* value) {
* Log a note.
*/
int debugNote(unused void* r, const char* key, const char* value) {
- gc_scoped_pool();
cdebug << " note key: " << key << ", value: " << value << endl;
return 1;
}
@@ -699,6 +696,8 @@ int debugNote(unused void* r, const char* key, const char* value) {
* Log a request.
*/
const bool debugRequest(request_rec* r, const string& msg) {
+ if (!isDebugLog())
+ return true;
gc_scoped_pool();
cdebug << msg << ":" << endl;
cdebug << " unparsed uri: " << debugOptional(r->unparsed_uri) << endl;
diff --git a/sca-cpp/trunk/modules/http/mod-openauth.cpp b/sca-cpp/trunk/modules/http/mod-openauth.cpp
index c2791b5402..09d62bf5f7 100644
--- a/sca-cpp/trunk/modules/http/mod-openauth.cpp
+++ b/sca-cpp/trunk/modules/http/mod-openauth.cpp
@@ -33,6 +33,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"
@@ -79,13 +80,20 @@ public:
#ifdef WANT_MAINTAINER_MODE
/**
- * Log a session entry.
+ * Log session entries.
*/
-int debugSession(unused void* r, const char* key, const char* value) {
+int debugSessionEntry(unused void* r, const char* key, const char* value) {
cdebug << " session key: " << key << ", value: " << value << endl;
return 1;
}
+const bool debugSession(request_rec* r, session_rec* z) {
+ if (!isDebugLog())
+ return true;
+ apr_table_do(debugSessionEntry, r, z->entries, NULL);
+ return true;
+}
+
#endif
/**
@@ -103,7 +111,7 @@ const failable<value> userInfoFromSession(const string& realm, request_rec* r) {
if (z == NULL)
return mkfailure<value>("Couldn't retrieve user session");
#ifdef WANT_MAINTAINER_MODE
- apr_table_do(debugSession, r, z->entries, NULL);
+ debugSession(r, z);
#endif
if (ap_session_get_fn == NULL)
@@ -225,8 +233,8 @@ static int checkAuthn(request_rec *r) {
if (hasContent(info)) {
// Try to authenticate the request
- const value cinfo = content(info);
- const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", cinfo)), cadr(assoc<value>("password", cinfo)), r);
+ const value uinfo = content(info);
+ const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", uinfo)), cadr(assoc<value>("password", uinfo)), r);
if (!hasContent(authz)) {
// Authentication failed, redirect to login page
@@ -236,7 +244,7 @@ static int checkAuthn(request_rec *r) {
// Successfully authenticated, store the user info in the request
r->ap_auth_type = const_cast<char*>(atype);
- return httpd::reportStatus(authenticated(cinfo, r));
+ return httpd::reportStatus(authenticated(uinfo, r));
}
}
@@ -254,8 +262,8 @@ static int checkAuthn(request_rec *r) {
if (hasContent(info)) {
// Try to authenticate the request
- const value cinfo = content(info);
- const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", cinfo)), cadr(assoc<value>("password", cinfo)), r);
+ const value uinfo = content(info);
+ const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", uinfo)), cadr(assoc<value>("password", uinfo)), r);
if (!hasContent(authz)) {
// Authentication failed, redirect to login page
@@ -265,7 +273,7 @@ static int checkAuthn(request_rec *r) {
// Successfully authenticated, store the user info in the request
r->ap_auth_type = const_cast<char*>(atype);
- return httpd::reportStatus(authenticated(cinfo, r));
+ return httpd::reportStatus(authenticated(uinfo, r));
}
}
diff --git a/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp b/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp
index 521b86626d..49ce6bbe52 100644
--- a/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp
+++ b/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp
@@ -25,6 +25,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"