]> err.no Git - sope/commitdiff
cleaned up cookie handling
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Fri, 19 Nov 2004 01:23:30 +0000 (01:23 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Fri, 19 Nov 2004 01:23:30 +0000 (01:23 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@398 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/NGObjWeb/ChangeLog
sope-appserver/NGObjWeb/NGHttp+WO.m
sope-appserver/NGObjWeb/NGHttp/NGHttpRequest.m
sope-appserver/NGObjWeb/Version
sope-appserver/NGObjWeb/WORequestHandler.m
sope-core/NGExtensions/NGExtensions/NSObject+Logs.h

index e1b2122bd90540f04c543722be1c73dcd9febf74..2b5fad2f27fef17971db196e80e58215b9313427 100644 (file)
@@ -1,5 +1,11 @@
 2004-11-19  Helge Hess  <helge.hess@opengroupware.org>
 
+       * v4.5.94
+
+       * NGHttp+WO.m: minor improvements to cookie handling
+
+       * WORequestHandler.m: cleaned up cookie adder
+
        * v4.5.93
        
        * WOApplication.m: print a note if debug logging is enabled
index 3e83d4fc442640f1f7776edcc1f2d3051c263d3f..0c06a98cf5a6a8df575a3093643521f6f62afb2d 100644 (file)
@@ -195,34 +195,34 @@ static Class NSArrayClass = Nil;
     return;
   }
 
-    
-    cookieValue = [_cookie value];
-    if ([cookieValue isKindOfClass:[NSArray class]]) {
-      if ([cookieValue count] == 0)
-        cookieValue = @"";
-      else if ([cookieValue count] == 1)
-        cookieValue = [[cookieValue objectAtIndex:0] stringValue];
-      else {
-        [self logWithFormat:
-                @"got %i values for cookie '%@', using first only.",
-                [cookieValue count],
-                [_cookie cookieName]];
-        cookieValue = [[cookieValue objectAtIndex:0] stringValue];
-      }
+  cookieValue = [_cookie value];
+  if ([cookieValue isKindOfClass:[NSArray class]]) {
+    if ([cookieValue count] == 0)
+      cookieValue = @"";
+    else if ([cookieValue count] == 1)
+      cookieValue = [[cookieValue objectAtIndex:0] stringValue];
+    else {
+      [self logWithFormat:
+             @"got %d values for cookie '%@', using first only: %@",
+             [cookieValue count],
+             [_cookie cookieName], 
+             [cookieValue componentsJoinedByString:@","]];
+      cookieValue = [[cookieValue objectAtIndex:0] stringValue];
     }
-    else
-      cookieValue = [cookieValue stringValue];
+  }
+  else
+    cookieValue = [cookieValue stringValue];
     
-    cookie = [WOCookieClass cookieWithName:[_cookie cookieName]
-                            value:cookieValue
-                            path:[_cookie path]
-                            domain:[_cookie domainName]
-                            expires:[_cookie expireDate]
-                            isSecure:[_cookie needsSecureChannel]];
-  
-    /* WOMessage */
-    if (cookie)
-      [_a addObject:cookie];
+  cookie = [WOCookieClass cookieWithName:[_cookie cookieName]
+                         value:cookieValue
+                         path:[_cookie path]
+                         domain:[_cookie domainName]
+                         expires:[_cookie expireDate]
+                         isSecure:[_cookie needsSecureChannel]];
+  
+  /* WOMessage */
+  if (cookie != nil)
+    [_a addObject:cookie];
 }
 
 - (NSArray *)woCookies {
@@ -421,7 +421,9 @@ static Class      DispClass = Nil;
   if ([[self methodName] isEqualToString:@"POST"]) {
     NGMimeType *contentType = [self contentType];
     
-    //NSLog(@"%s: process POST, ctype %@", __PRETTY_FUNCTION__, contentType);
+#if 0
+    NSLog(@"%s: process POST, ctype %@", __PRETTY_FUNCTION__, contentType);
+#endif
     
     formContent = [contentType hasSameType:multipartFormData]
       ? [self _decodeMultiPartFormDataContent]
index cc9ff0f839cd2c3d973950c5a709c199c0c53129..9bc431c484926692137d114c0b41d2703c0d13e8 100644 (file)
@@ -18,7 +18,6 @@
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 #include "NGHttpRequest.h"
 #include "common.h"
index 83d960287e8faee2067eabc0dadac54cccb9a7df..625a956761eb727aad540b8cb67c2c123128bae4 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=93
+SUBMINOR_VERSION:=94
 
 # v4.5.91  requires libNGExtensions v4.5.134
 # v4.5.84  requires libNGExtensions v4.5.127
index 88866feb200e075a9b3847f31b1711e1a8bef8d3..ac3e8fe851b4f10705a07bab5fd83cb0d6949fee 100644 (file)
@@ -339,49 +339,50 @@ static NGLogger *perfLogger        = nil;
   toResponse:(WOResponse *)_response
   inContext:(WOContext *)_ctx
 {
-  if ([_sn storesIDsInCookies]) {
-    WOApplication *app;
-    NSString *cookieName = nil;
-    WOCookie *cookie     = nil;
-    NSString *uri;
-    NSString *value;
-    
-    app        = [WOApplication application];
-    cookieName = [app name];
-
-    if (!doNotSetCookiePath) {
-      NSString *tmp;
+  WOApplication *app;
+  WOCookie *cookie     = nil;
+  NSString *uri;
+  NSString *value;
+  
+  if (![_sn storesIDsInCookies])
+    return;
+  
+  app = [WOApplication application];
+  
+  // TODO: there is a DUP of this section in OpenGroupware.m to set an
+  //       expiration cookie
+  if (!doNotSetCookiePath) {
+    NSString *tmp;
       
-      if ((uri = [[_ctx request] applicationName]) == nil)
-        uri = [app name];
-      uri = [@"/" stringByAppendingString:uri];
-      if ((tmp = [[_ctx request] adaptorPrefix]))
-        uri = [tmp stringByAppendingString:uri];
-    }
-    else
-      uri = @"/";
-    
-#if 0
-    uri = [_ctx urlSessionPrefix];
-    uri = [_ctx urlWithRequestHandlerKey:
-                  [WOApplication componentRequestHandlerKey]
-                path:@"/"
-                queryString:nil];
+    if ((uri = [[_ctx request] applicationName]) == nil)
+      uri = [app name];
+    uri = [@"/" stringByAppendingString:uri];
+    if ((tmp = [[_ctx request] adaptorPrefix]))
+      uri = [tmp stringByAppendingString:uri];
+  }
+  else
+    uri = @"/";
+  
+#if 0 // TODO: explain!
+  uri = [_ctx urlSessionPrefix];
+  uri = [_ctx urlWithRequestHandlerKey:
+               [WOApplication componentRequestHandlerKey]
+             path:@"/"
+             queryString:nil];
 #endif
     
-    value = [_sn isTerminating]
-      ? (id)@"nil"
-      : [_sn sessionID];
+  value = [_sn isTerminating]
+    ? (id)@"nil"
+    : [_sn sessionID];
     
-    cookie = [WOCookie cookieWithName:cookieName
-                       value:value
-                       path:uri
-                       domain:[_sn domainForIDCookies]
-                       expires:[_sn expirationDateForIDCookies]
-                       isSecure:NO];
-    if (cookie)
-      [_response addCookie:cookie];
-  }
+  cookie = [WOCookie cookieWithName:[app name]
+                    value:value
+                    path:uri
+                    domain:[_sn domainForIDCookies]
+                    expires:[_sn expirationDateForIDCookies]
+                    isSecure:NO];
+  if (cookie != nil)
+    [_response addCookie:cookie];
 }
 
 @end /* WORequestHandler(Cookies) */
index a973a6207ea9c110e4b9ee6af95b0cd0c182447d..58831a1fb583ba7c969a799035a3fd161650bbca 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2000-2004 SKYRIX Software AG
+  Copyright (C) 2004 SKYRIX Software AG
 
   This file is part of OpenGroupware.org