From 15f45b2db0e9dc0f90bdd19aeba86206bacabf2c Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 20 Nov 2005 18:00:37 +0000 Subject: [PATCH] fixed some logging bug (#1624) git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1184 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 9 +++++++ .../NGObjWeb/DynamicElements/WORadioButton.m | 3 +++ .../DynamicElements/_WOComplexHyperlink.m | 24 +++++++++++++------ .../SoObjects/SoObjectRequestHandler.m | 6 ++--- sope-appserver/NGObjWeb/Version | 2 +- .../WebDAV/SoObjectWebDAVDispatcher.m | 1 + 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index a35535aa..5eb55d98 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,12 @@ +2005-11-20 Helge Hess + + * v4.5.213 + + * DynamicElements/_WOComplexHyperlink.m: fixed a logging bug of + WODebugStaticLinkProcessing (#fixes OGo bug #1624) + + * SoObjects/SoObjectRequestHandler.m: minor code cleanups + 2005-11-17 Helge Hess * v4.5.212 diff --git a/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m b/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m index a514d2bf..57d7c06e 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m @@ -71,6 +71,9 @@ return; // TODO: this seems to have issues + + // TODO: when a page is called with GET, this overwrites the selection! + // - so we should probably only push the value for POST? formValue = [_req formValueForKey:OWFormElementName(self, _ctx)]; diff --git a/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m b/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m index 4fc7dda5..31d02d4d 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m +++ b/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m @@ -370,11 +370,14 @@ static BOOL debugStaticLinks = NO; - (BOOL)shouldRewriteURLString:(NSString *)_s inContext:(WOContext *)_ctx { // TODO: we need a binding to disable rewriting! - NSRange r; + NSRange r; r = [_s rangeOfString:@":"]; - if (!r.length) return YES; - return [[_s substringToIndex:r.location] isEqualToString:@"http"]; + if (r.length == 0) + return YES; + + /* only rewrite HTTP URLs */ + return [_s hasPrefix:@"http"]; } - (BOOL)_appendHrefToResponse:(WOResponse *)_r inContext:(WOContext *)_ctx { @@ -384,17 +387,20 @@ static BOOL debugStaticLinks = NO; base = [_ctx baseURL]; hrefValue = [self->href valueInContext:_ctx]; - url = hrefValue; + url = nil; if (hrefValue == nil) return NO; - if ([hrefValue isKindOfClass:NSURLClass]) { + if ((*(Class *)hrefValue == NSURLClass) || + [hrefValue isKindOfClass:NSURLClass]) { s = [hrefValue stringValueRelativeToURL:base]; } else { + /* given HREF is a string */ s = [hrefValue stringValue]; + /* we do not want to rewrite stuff like mailto: or javascript: URLs */ if ([self shouldRewriteURLString:s inContext:_ctx]) { if ([s isAbsoluteURL]) { // TODO: why are we doing this? we could just pass through the string? @@ -415,7 +421,7 @@ static BOOL debugStaticLinks = NO; if (url == nil) { [self logWithFormat: - @"couldn't construct URL from 'href' string '%@' (base=%@)", + @"could not construct URL from 'href' string '%@' (base=%@)", s, base]; return NO; } @@ -431,9 +437,13 @@ static BOOL debugStaticLinks = NO; [self logWithFormat:@" base %@", base]; [self logWithFormat:@" base-abs %@", [base absoluteString]]; [self logWithFormat:@" url %@", url]; - [self logWithFormat:@" url-abs %@", [url absoluteString]]; + if (url != nil) + [self logWithFormat:@" url-abs %@", [url absoluteString]]; + else + [self logWithFormat:@" href %@", hrefValue]; [self logWithFormat:@" string %@", s]; } + WOResponse_AddString(_r, s); return YES; } diff --git a/sope-appserver/NGObjWeb/SoObjects/SoObjectRequestHandler.m b/sope-appserver/NGObjWeb/SoObjects/SoObjectRequestHandler.m index 4e5bccfe..38a4d35c 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoObjectRequestHandler.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoObjectRequestHandler.m @@ -352,7 +352,7 @@ static NSString *redirectURISafetySuffix = nil; inContext:_ctx error:&error acquire:doAcquire]; - if (error) + if (error != nil) currentObject = error; /* retain result */ @@ -552,14 +552,14 @@ static NSString *redirectURISafetySuffix = nil; doDispatch = YES; object = [self lookupObjectForRequest:_rq inContext:_ctx]; - if (object) { + if (object != nil) { [self->dispatcherRules takeValue:[_ctx clientObject] forKey:@"clientObject"]; [self->dispatcherRules takeValue:object forKey:@"object"]; } else { r = [_ctx response]; - [r setStatus:404]; + [r setStatus:404 /* not found */]; [r setHeader:@"text/html" forKey:@"content-type"]; [r appendContentString:@"object not found: "]; [r appendContentHTMLString: diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 1ff73710..08121c7d 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=212 +SUBMINOR_VERSION:=213 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m index 1bf37608..0b18d875 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m @@ -211,6 +211,7 @@ static NSTimeZone *gmt = nil; if ([pathInfo length] > 0) { /* check whether all the parent collections are available */ + // TODO: we might also want to check for a 'create' permission if ([pathInfo rangeOfString:@"/"].length > 0) { return [self httpException:409 /* Conflict */ reason: -- 2.39.5