more debugging
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 14 Apr 2006 15:17:22 +0000 (15:17 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 14 Apr 2006 15:17:22 +0000 (15:17 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@692 9efc2488-bf62-4759-914b-345cdb29e865

src/gateway/Makefile
src/gateway/apachetools.c
src/gateway/osrf_json_gateway.c

index 614887c..2120b23 100644 (file)
@@ -1,4 +1,5 @@
-CFLAGS += -DASSUME_STATELESS -DOSRF_GATEWAY_NASTY_DEBUG
+#CFLAGS        += -DASSUME_STATELESS -DOSRF_GATEWAY_NASTY_DEBUG
+CFLAGS += -DASSUME_STATELESS 
 LDLIBS += -lobjson -lopensrf
 
 all: osrf_json_gateway.so copy
index 458d7b8..e5b86b5 100644 (file)
@@ -17,7 +17,11 @@ string_array* apacheParseParms(request_rec* r) {
        /* gather the post args and append them to the url query string */
        if( !strcmp(r->method,"POST") ) {
 
+               osrfLogDebug(OSRF_LOG_MARK, "gateway checking for post data..");
+
                ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
+               
+               osrfLogDebug(OSRF_LOG_MARK, "gateway reading post data..");
 
                if(ap_should_client_block(r)) {
 
@@ -25,18 +29,24 @@ string_array* apacheParseParms(request_rec* r) {
                        memset(body,0,1025);
                        buffer = buffer_init(1025);
        
+                       osrfLogDebug(OSRF_LOG_MARK, "gateway entering ap_get_client_block loop");
+
                        while(ap_get_client_block(r, body, 1024)) {
                                buffer_add( buffer, body );
                                memset(body,0,1025);
 
+                               osrfLogDebug(OSRF_LOG_MARK, 
+                                       "gateway read %d bytes of data so far", buffer->n_used);
+
                                if(buffer->n_used > APACHE_TOOLS_MAX_POST_SIZE) {
                                        osrfLogError(OSRF_LOG_MARK, "gateway received POST larger "
                                                "than %d bytes. dropping reqeust", APACHE_TOOLS_MAX_POST_SIZE);
                                        buffer_free(buffer);
-                                       arg = NULL;
+                                       return NULL;
                                }
-
                        }
+
+                       osrfLogDebug(OSRF_LOG_MARK, "gateway done reading post data");
        
                        if(arg && arg[0]) {
 
@@ -55,11 +65,14 @@ string_array* apacheParseParms(request_rec* r) {
        } 
 
 
+       osrfLogDebug(OSRF_LOG_MARK, "gateway done mangling post data");
+
        if( ! arg || !arg[0] ) { /* we received no request */
                return NULL;
        }
 
 
+       osrfLogDebug(OSRF_LOG_MARK, "parsing URL params from post/get request data: %s", arg);
        int sanity = 0;
        while( arg && (val = ap_getword(p, (const char**) &arg, '&'))) {
 
@@ -70,6 +83,8 @@ string_array* apacheParseParms(request_rec* r) {
                ap_unescape_url((char*)key);
                ap_unescape_url((char*)val);
 
+               osrfLogDebug(OSRF_LOG_MARK, "parsed URL params %s=%s", key, val);
+
                string_array_add(sarray, key);
                string_array_add(sarray, val);
 
index a6c12af..578238a 100644 (file)
@@ -234,6 +234,7 @@ static int osrf_json_gateway_method_handler (request_rec *r) {
 }
 
 
+#ifdef OSRF_GATEWAY_NASTY_DEBUG
 /* --------------------------------------------------------------------- */
 /* DEBUG HOOKS */
 static int osrf_dbg_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp){
@@ -300,6 +301,7 @@ static void osrf_dbg_insert_filter(request_rec *r) {
        osrfLogDebug(OSRF_LOG_MARK, "osrf gateway: osrf_dbg_insert_filter hook");
 }
 /* --------------------------------------------------------------------- */
+#endif
 
 
 static void osrf_json_gateway_register_hooks (apr_pool_t *p) {