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
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 {
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]
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#include "NGHttpRequest.h"
#include "common.h"
# version file
-SUBMINOR_VERSION:=93
+SUBMINOR_VERSION:=94
# v4.5.91 requires libNGExtensions v4.5.134
# v4.5.84 requires libNGExtensions v4.5.127
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) */
/*
- Copyright (C) 2000-2004 SKYRIX Software AG
+ Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org