From: helge Date: Tue, 19 Jul 2005 13:57:11 +0000 (+0000) Subject: properly handle multivalue query parameters X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fa777cfe6d9489ece1db59715b1247a3ff2e8ff;p=sope properly handle multivalue query parameters git-svn-id: http://svn.opengroupware.org/SOPE/trunk@918 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 21edb7f4..70f970dc 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,7 +1,10 @@ 2005-07-19 Helge Hess + * WOContext.m: properly generate multivalue query parameters (value is + an NSArray) (v4.5.176) + * NGObjWeb/WOApplication.h: added +isDirectConnectEnabled, - +setCGIAdaptorURL:, +cgiAdaptorURL prototypes (v4.5.174) + +setCGIAdaptorURL:, +cgiAdaptorURL prototypes (v4.5.175) * v4.5.174 diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 9c4998b7..a5950904 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=175 +SUBMINOR_VERSION:=176 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WOContext.m b/sope-appserver/NGObjWeb/WOContext.m index cfe90458..6cf29a2b 100644 --- a/sope-appserver/NGObjWeb/WOContext.m +++ b/sope-appserver/NGObjWeb/WOContext.m @@ -732,21 +732,43 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) { qs = [MutableStrClass stringWithCapacity:256]; keys = [_queryDict keyEnumerator]; - for (isFirst = YES; (key = [keys nextObject]); ) { - NSString *value; + for (isFirst = YES; (key = [keys nextObject]) != nil; ) { + id value; - if (isFirst) - isFirst = NO; - else - [qs appendString:self->qpJoin]; + if (isFirst) isFirst = NO; + else [qs appendString:self->qpJoin]; + + value = [_queryDict objectForKey:key]; + if ([value isKindOfClass:[NSArray class]]) { + NSArray *a = value; + unsigned i, count; + + for (i = 0, count = [a count]; i < count; i++) { + value = [a objectAtIndex:i]; + + if (isFirst) isFirst = NO; + else [qs appendString:self->qpJoin]; + + // TODO: code duplication ... + value = ![value isNotNull] ? nil : [value stringValue]; + key = [key stringByEscapingURL]; + value = [value stringByEscapingURL]; - value = [[_queryDict objectForKey:key] stringValue]; + [qs appendString:key]; + if (value != nil) { + [qs appendString:@"="]; + [qs appendString:value]; + } + } + continue; + } + value = ![value isNotNull] ? nil : [value stringValue]; key = [key stringByEscapingURL]; value = [value stringByEscapingURL]; [qs appendString:key]; - if (value) { + if (value != nil) { [qs appendString:@"="]; [qs appendString:value]; }