From f7ec804b0814d21c75bd70029d223ef1b0ad4483 Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 6 Jul 2005 15:46:22 +0000 Subject: [PATCH] added a method to detect HTTP safe methods git-svn-id: http://svn.opengroupware.org/SOGo/trunk@668 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/SOGoUI/ChangeLog | 5 +++++ SOGo/UI/SOGoUI/UIxComponent.h | 3 +++ SOGo/UI/SOGoUI/UIxComponent.m | 14 +++++++++++++- SOGo/UI/SOGoUI/Version | 4 ++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index c2b37e12..ab33da55 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,8 @@ +2005-07-06 Helge Hess + + * UIxComponent.m: added method -isInvokedBySafeMethod to check whether + the current HTTP method is a safe one (eg HEAD/GET) (v0.9.25) + 2005-07-05 Marcus Mueller * SOGoAptFormatter.[hm]: new API. -stringForObjectValue: is deprecated diff --git a/SOGo/UI/SOGoUI/UIxComponent.h b/SOGo/UI/SOGoUI/UIxComponent.h index a90ad765..3e61525c 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.h +++ b/SOGo/UI/SOGoUI/UIxComponent.h @@ -72,6 +72,9 @@ - (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek; - (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear; - (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear; + +/* HTTP method safety */ +- (BOOL)isInvokedBySafeMethod; /* locale */ - (NSDictionary *)locale; diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index 87dac44c..0d904db5 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -18,9 +18,9 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "UIxComponent.h" +#include "SOGoJSStringFormatter.h" #include "common.h" #include @@ -411,6 +411,18 @@ static BOOL uixDebugEnabled = NO; return [self labelForKey:key]; } +/* HTTP method safety */ + +- (BOOL)isInvokedBySafeMethod { + // TODO: move to WORequest? + NSString *m; + + m = [[[self context] request] method]; + if ([m isEqualToString:@"GET"]) return YES; + if ([m isEqualToString:@"HEAD"]) return YES; + return NO; +} + /* locale */ - (NSDictionary *)locale { diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index 78651189..c7520230 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,5 +1,5 @@ -# $Id$ +# version file -SUBMINOR_VERSION:=24 +SUBMINOR_VERSION:=25 # v0.9.18 requires NGExtensions v4.5.136 -- 2.39.5