added content-type back into gateway
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Dec 2005 18:27:51 +0000 (18:27 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Dec 2005 18:27:51 +0000 (18:27 +0000)
added some apache logging

git-svn-id: svn://svn.open-ils.org/ILS/trunk@2162 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/apachemods/apachetools.h
Open-ILS/src/apachemods/mod_xmlbuilder.c
OpenSRF/src/gateway/mod_ils_gateway.c

index 94edf7c..7a40500 100644 (file)
@@ -5,6 +5,7 @@
 #include "apr_compat.h"
 #include "apr_strings.h"
 #include "apr_reslist.h"
+#include "http_log.h"
 
 
 #include "string_array.h"
index 4b0f918..a002230 100644 (file)
@@ -1,6 +1,7 @@
 #include "mod_xmlbuilder.h"
 
 char* __xmlBuilderDynamicLocale        = NULL;
+request_rec* currentRec = NULL;
 
 
 /* set the base DTD directory */
@@ -59,19 +60,20 @@ static const char* xmlBuilderSetContentType(
        return NULL;
 }
 
+// ACCESS_CONF - OR_ALL ?
 static const command_rec xmlBuilderCommands[] = {
        AP_INIT_TAKE1( MODXMLB_CONFIG_LOCALE, 
-                       xmlBuilderSetDefaultLocale, NULL, ACCESS_CONF, "Default Locale"),
+                       xmlBuilderSetDefaultLocale, NULL, RSRC_CONF, "Default Locale"),
        AP_INIT_TAKE1( MODXMLB_CONFIG_BASE_DIR, 
-                       xmlBuilderSetBaseDir, NULL, ACCESS_CONF, "Base Directory"),
+                       xmlBuilderSetBaseDir, NULL, RSRC_CONF, "Base Directory"),
        AP_INIT_TAKE1( MODXMLB_CONFIG_POST_XSL, 
-                       xmlBuilderSetPostXSL, NULL, ACCESS_CONF, "Post XSL"),
+                       xmlBuilderSetPostXSL, NULL, RSRC_CONF, "Post XSL"),
        AP_INIT_TAKE1( MODXMLB_CONFIG_DEFAULT_DTD, 
-                       xmlBuilderSetDefaultDtd, NULL, ACCESS_CONF, "Default DTD"),
+                       xmlBuilderSetDefaultDtd, NULL, RSRC_CONF, "Default DTD"),
        AP_INIT_TAKE1( MODXMLB_CONFIG_LOCALE_PARAM,
-                       xmlBuilderSetLocaleParam, NULL, ACCESS_CONF, "Default DTD"),
+                       xmlBuilderSetLocaleParam, NULL, RSRC_CONF, "Locale URL param name"),
        AP_INIT_TAKE1( MODXMLB_CONFIG_CONTENT_TYPE,
-                       xmlBuilderSetContentType, NULL, ACCESS_CONF, "Content Type"),
+                       xmlBuilderSetContentType, NULL, RSRC_CONF, "Content Type"),
        {NULL}
 };
 
@@ -95,9 +97,21 @@ static void xmlBuilderChildInit( apr_pool_t *p, server_rec *s ) {
 static int xmlBuilderHandler( request_rec* r ) {
 
        if( strcmp(r->handler, MODULE_NAME ) ) return DECLINED;
+       currentRec = r;
 
        xmlBuilderConfig* config = ap_get_module_config( 
                        r->server->module_config, &xmlbuilder_module );
+
+       /*
+       xmlBuilderConfig* config = ap_get_module_config( 
+                       r->per_dir_config, &xmlbuilder_module );
+                       */
+
+       if(config == NULL) {
+               ap_log_rerror( APLOG_MARK, APLOG_ERR, 0, currentRec,
+                               "config is nulll...");
+               return HTTP_INTERNAL_SERVER_ERROR; 
+       }
        
        r->allowed |= (AP_METHOD_BIT << M_GET);
        r->allowed |= (AP_METHOD_BIT << M_POST);
@@ -176,6 +190,15 @@ xmlDocPtr xmlBuilderProcessFile( char* filename, xmlBuilderConfig* config ) {
        context.xmlFile = filename;
        context.dtdHash->freeItem = &__xmlBuilderFreeDtdHash;
 
+               
+       /*
+       ap_log_rerror( APLOG_MARK, APLOG_DEBUG, 0, currentRec,
+                       "xmlBuilderProcessFile() Options: "
+                       "XMLBuilderDefaultLocale : %s |  XMLBuilderBaseDir : %s | "
+         "XMLBuilderDefaultDTD : %s | XMLBuilderLocaleParam : %s",
+                       config->defaultLocale, config->baseDir, config->defaultDtd, config->localeParam );
+                       */
+
        /* pre-parse the default dtd if defined */
        if( config->defaultDtd ) 
                xmlBuilderAddDtd( config->defaultDtd, &context );
index 28e1337..83341b8 100644 (file)
@@ -71,6 +71,7 @@ static int mod_ils_gateway_method_handler (request_rec *r) {
        }
 
 
+       ap_set_content_type(r, "text/plain");
 
        /* gather the post args and append them to the url query string */
        if( !strcmp(r->method,"POST") ) {