From 4f1a89aee4f92a3d33438fb2bf0600fb42904293 Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 16 Jun 2004 15:28:47 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@40 d1b88da0-ebda-0310-925b-ed51d893ca5b --- dbd/MainPage.m | 1 + dbd/README | 9 +++++++++ dbd/dbd.m | 17 ++++++++++++++--- dbd/product.plist | 4 ++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/dbd/MainPage.m b/dbd/MainPage.m index 6407bf40..18f18a91 100644 --- a/dbd/MainPage.m +++ b/dbd/MainPage.m @@ -78,6 +78,7 @@ url = [_ctx urlWithRequestHandlerKey:@"so" path:@"/" queryString:nil]; [_response setStatus:302 /* moved */]; [_response setHeader:url forKey:@"location"]; + [self logWithFormat:@"URL: %@", url]; return; } diff --git a/dbd/README b/dbd/README index c82916aa..68d151d8 100644 --- a/dbd/README +++ b/dbd/README @@ -53,3 +53,12 @@ Tricks used - we are not really clever with DSoUserManager and DSoDatabaseManager, those two classes are basically identical + +- the "GET" method is explicitly mapped in product.plist for the application + object because otherwise "GET" will be treated as a hostname (because we + perform no check on the hostname!) + - need to check whether we can make SOPE smarter on this front, but I guess + that issue is inherent to all containers which map to arbitary, external + collections + - we could create an EOAdaptor and connect it to 'template1', but this would + result in one unnecessary DB connection? diff --git a/dbd/dbd.m b/dbd/dbd.m index 6dfa0bb9..55089e52 100644 --- a/dbd/dbd.m +++ b/dbd/dbd.m @@ -41,6 +41,16 @@ /* name lookup */ +- (BOOL)isHostName:(NSString *)_key inContext:(id)_ctx { + NSRange r; + + r = [_key rangeOfString:@"."]; // TODO: this also catches IPs! + if (r.length > 0) + return NO; + + return YES; +} + - (id)lookupHost:(NSString *)_key inContext:(id)_ctx { NSRange r; NSString *hostName; @@ -59,7 +69,6 @@ } - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { - NSRange r; id obj; /* first check attributes directly bound to the application */ @@ -74,9 +83,11 @@ One way to check for a valid key would be to check whether the key is a valid hostname, but I would like to avoid that for performance reasons. + + Addition: we also get queries for various other methods, like "GET" if + no method was provided in the query path. */ - r = [_key rangeOfString:@"."]; - if (r.length == 0) + if ([self isHostName:_key inContext:_ctx]) return [self lookupHost:_key inContext:_ctx]; return nil; diff --git a/dbd/product.plist b/dbd/product.plist index 8a02ae0f..4539405b 100644 --- a/dbd/product.plist +++ b/dbd/product.plist @@ -17,6 +17,10 @@ protectedBy = "View"; pageName = "MainPage"; }; + "GET" = { // more or less a hack, see README + protectedBy = "View"; + pageName = "MainPage"; + }; "connect" = { protectedBy = "View"; pageName = "MainPage"; -- 2.39.5