]> err.no Git - sope/commitdiff
added a few debug logs
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 11 Mar 2008 23:18:55 +0000 (23:18 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 11 Mar 2008 23:18:55 +0000 (23:18 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1618 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m

index dbb44661126fdc5b84ebf9f3417c4204dec11692..2e4e62c7feb10e64206032b4cd65ae16c62525af 100644 (file)
@@ -1,5 +1,6 @@
 /*
-  Copyright (C) 2000-2005 SKYRIX Software AG
+  Copyright (C) 2000-2008 SKYRIX Software AG
+  Copyright (C) 2008      Helge Hess
 
   This file is part of SOPE.
 
@@ -691,7 +692,7 @@ static int logCounter = 0;
     @"delivering of response failed with exception: %@";
 
   *(&out) = nil;
-  
+
   [self _httpValidateResponse:_response];
   
   out = [(NGCTextStream *)[NGCTextStream alloc] initWithSource:_out];
@@ -714,11 +715,12 @@ static int logCounter = 0;
       s  = [_response status];
       t1 = [_response httpVersion];
       r  = [self _reasonForStatus:s];
-      
+
+      // TBD: replace -cStringLength/-getCString:
       slen = [t1 cStringLength];
       rlen = strlen((const char *)r);
       if ((slen + rlen + 8) < 1000) {
-        [t1 getCString:(char *)buf];
+        [t1 getCString:(char *)buf]; // HTTP status
         snprintf((char *)&(buf[slen]), sizeof(buf), " %i %s\r\n", s, r);
         isok = [_out safeWriteBytes:buf count:strlen((char *)buf)];
       }
@@ -748,6 +750,10 @@ static int logCounter = 0;
       BOOL hasConnectionHeader;
       IMP  addStr;
       
+#if HEAVY_DEBUG
+      NSLog(@"DELIVER: %@", _response);
+#endif
+    
       hasConnectionHeader = NO;
       header = [[NSMutableString alloc] initWithCapacity:4096];
       addStr = [header methodForSelector:@selector(appendString:)];
@@ -762,17 +768,32 @@ static int logCounter = 0;
            hasConnectionHeader = YES;
        }
        
+#if HEAVY_DEBUG
+       NSLog(@"  FIELD: %@", fieldName);
+#endif
+       
         values = [[_response headersForKey:fieldName] objectEnumerator];
        
         while ((value = [values nextObject]) && isok) {
+#if HEAVY_DEBUG
+         NSLog(@"    VAL: %@", value);
+#endif
           addStr(header, @selector(appendString:), fieldName);
           addStr(header, @selector(appendString:), @": ");
           addStr(header, @selector(appendString:), value);
           addStr(header, @selector(appendString:), @"\r\n");
         }
+#if HEAVY_DEBUG
+       NSLog(@"  END:   %@", fieldName);
+#endif
       }
+      
+#if HEAVY_DEBUG
+      NSLog(@"  HEADER:\n%@", header);
+      NSLog(@"  OUT: %@", out);
+#endif
       isok = [out writeString:header];
-      [header release];
+      [header release]; header = nil;
 
 #if 0
 #warning TODO: experimental, need to check for direct connect
@@ -780,6 +801,11 @@ static int logCounter = 0;
        isok = [out writeString:@"connection: close\r\n"];
 #endif
     }
+#if HEAVY_DEBUG
+    else {
+      NSLog(@"NOT OK TO DELIVER HEADERS ...");
+    }
+#endif
     
     /* write cookie headers */
     if (isok) {