From 85078fe78cde6bc898ee21ed930615e199f91a74 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 11 Mar 2008 23:18:55 +0000 Subject: [PATCH] added a few debug logs git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1618 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- .../WOHttpAdaptor/WOHttpTransaction.m | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m b/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m index dbb44661..2e4e62c7 100644 --- a/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m +++ b/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m @@ -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) { -- 2.39.5