diff --git a/ChangeLog b/ChangeLog index a2ca726..1108443 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +2014-04-11 Manuel Guesdon + * GSWDatabase/WODisplayGroup.m + remove -objectsAtIndexes: (implemented in core/NSArray) + * GSWeb/GSWComponent.m + implement -baseURL + * GSWeb/GSWComponentDefinition.m + comment unused defaultFileManager + * GSWeb/GSWUtils.m + * GSWeb/GSWMessage.m + fix encoding output in logs/messages + * GSWeb/GSWString.[hm] + fix -initWithName:associations:template: definition + * GSWeb/GSWRequest.m + fix misnaming (s/WODynamicURLString/GSWDynamicURLString/) + fix encoding output in logs/messages + * GSWeb/GSWRadioButton.m + remove [_value isValueSettable] test: this value is not set + * GSWeb/GSWImage.m + fix framework name computing + * GSWeb/GSWHTTPIO.m + allow custom request class + fix warning + * GSWeb/GSWApplication.m + fix GSWFPutSL (there was no \0 at end of string) + fix -sessionIdKey + fix -instanceIdKey + remove unused -createRequestWithMethod:... + * GSWeb/GSWApplication.h + remove unused -createRequestWithMethod:... + * config.mak.in + define EOCONTROL_LIBRARY_NAME and EOACCESS_LIBRARY_NAME + * GSWeb/GSWConstants.[hm] + add GSWKey_QuestionMarkSessionID + add border__Key + * GSWeb/GSWActiveImage.h + add _border association + * GSWeb/GSWActiveImage.m + fix SessionID stuff in initWithName:... + add _border association + fix associations tests + respect GNUstep coding standard (curly brackets placement) + * GSWeb/GSWContext.m + fix -sessionID + * GSWeb/GSWForm.m + fix _appendHiddenFieldsToResponse:inContext: (convert value to string) + * GSWeb/GSWHTMLDynamicElement.m + fix _frameworkNameForAssociation:inComponent: + fix computeQueryDictionaryWithActionClassAssociation: (wosid hadcoding and + other values tests) + respect GNUstep coding standard (curly brackets placement) + rename variables to make code easier to understand + fix _appendAttributesFromAssociationsToResponse: + * GSWeb/GSWHTMLRawParser.m + fix warning + * GSWExtensions/GNUmakefile + fix FRAMEWORK_NAME for gswnames=gsw + * GSWExtensionsGSW/GSWFileUploadComponent.m + removed uneeded method + * GSWExtensionsGSW/GSWFileUploadComponent.gswc/GSWFileUploadComponent.gswd + quick fix FileLinkWithPath (investigate this later) + * config.mak.in + fix gswnames problem for ./configure --with-gswnames=gsw + * README + add original developper name + 2013-12-21: Sebastian Reitenbach * GSWeb/GSWSession.m do not include linux/sys.h diff --git a/GSWDatabase/WODisplayGroup.m b/GSWDatabase/WODisplayGroup.m index a52316c..51e9573 100644 --- a/GSWDatabase/WODisplayGroup.m +++ b/GSWDatabase/WODisplayGroup.m @@ -69,7 +69,6 @@ static BOOL globalDefaultForValidatesChangesImmediately = NO; @interface NSArray (Indexes) -(NSArray*)indexesOfObjectsIdenticalTo:(NSArray*)objects; --(NSArray*)objectsAtIndexes:(NSArray*)indexes; @end //==================================================================== @@ -2512,40 +2511,5 @@ createObjectFailedForDataSource:_dataSource]; return indexes; } --(NSArray*)objectsAtIndexes:(NSArray*)indexes -{ - NSArray* objects=nil; - int selfCount=0; - - selfCount=[self count]; - if ([self count]>0) - { - int indexesCount=[indexes count]; - if (indexesCount>0) - { - NSMutableArray* tmpObjects=nil; - int i=0; - for(i=0;i\n"); } diff --git a/GSWeb/GSWHTMLDynamicElement.m b/GSWeb/GSWHTMLDynamicElement.m index 4946da7..2c98056 100644 --- a/GSWeb/GSWHTMLDynamicElement.m +++ b/GSWeb/GSWHTMLDynamicElement.m @@ -319,7 +319,7 @@ static inline BOOL _needQuote(NSString* str_needQuote) name = [association valueInComponent:component]; if (name) { - if ([@"app" caseInsensitiveCompare: name]) + if ([@"app" caseInsensitiveCompare: name] == NSOrderedSame) { name = nil; } @@ -470,49 +470,70 @@ static inline BOOL _needQuote(NSString* str_needQuote) { GSWComponent * component = GSWContext_component(context); GSWSession * session = [context _session]; - NSString * s = nil; - NSMutableDictionary *nsmutabledictionary = nil; - NSEnumerator * keyEnumerator = nil; - NSString * key = nil; - GSWAssociation *otherAssociations = nil; - id otherValue = nil; + NSString * sessionID = nil; + NSMutableDictionary *newQueryDictionary = nil; - if (queryDictionary != nil) { - NSDictionary * nsdictionary1 = [queryDictionary valueInComponent:component]; - if ([nsdictionary1 isKindOfClass:NSMutableDictionaryClass]) { - nsmutabledictionary = (NSMutableDictionary*) nsdictionary1; - } else { - nsmutabledictionary = (NSMutableDictionary*) AUTORELEASE([nsdictionary1 mutableCopyWithZone:[self zone]]); - } - } - if (nsmutabledictionary == nil) { - nsmutabledictionary = [NSMutableDictionary dictionary]; - } - if (session != nil) { - s = [session sessionID]; - } else { - if ([context request] != nil) { - s = [[context request] stringFormValueForKey:@"wosid"]; - } - } - if ((s != nil) && ((directActionName != nil) || (actionClass != nil)) && ((session == nil) || (![session storesIDsInCookies]) || ([session storesIDsInURLs]))) { - [nsmutabledictionary setObject:s forKey:@"wosid"]; - } - if (otherQueryAssociations != nil) { - keyEnumerator = [otherQueryAssociations keyEnumerator]; - - while ((key = [keyEnumerator nextObject])) { - otherAssociations = [otherQueryAssociations objectForKey:key]; - otherValue = [otherAssociations valueInComponent:component]; - if (otherValue != nil && ([key isEqual:@"wosid"] || ([otherValue boolValue] == YES))) { - [nsmutabledictionary setObject: otherValue forKey:key]; - } else { - [nsmutabledictionary removeObjectForKey:key]; - } + if (queryDictionary != nil) + { + NSDictionary * nsdictionary1 = [queryDictionary valueInComponent:component]; + if ([nsdictionary1 isKindOfClass:NSMutableDictionaryClass]) + newQueryDictionary = (NSMutableDictionary*) nsdictionary1; + else + newQueryDictionary = (NSMutableDictionary*) AUTORELEASE([nsdictionary1 mutableCopyWithZone:[self zone]]); } - } - return nsmutabledictionary; + if (newQueryDictionary == nil) + newQueryDictionary = [NSMutableDictionary dictionary]; + + if (session != nil) + sessionID = [session sessionID]; + else + { + if ([context request] != nil) + sessionID = [[context request] stringFormValueForKey:GSWKey_SessionID[GSWebNamingConv]]; + } + + if (sessionID != nil + && (directActionName != nil || actionClass != nil) + && (session == nil || ![session storesIDsInCookies] || [session storesIDsInURLs])) + { + [newQueryDictionary setObject:sessionID + forKey:GSWKey_SessionID[GSWebNamingConv]]; + } + + if (otherQueryAssociations != nil) + { + GSWAssociation *otherAssociations = nil; + NSString * key = nil; + id otherValue = nil; + NSEnumerator* keyEnumerator = [otherQueryAssociations keyEnumerator]; + + while ((key = [keyEnumerator nextObject])) + { + otherAssociations = [otherQueryAssociations objectForKey:key]; + otherValue = [otherAssociations valueInComponent:component]; + if (otherValue != nil) + { + if ([key isEqual:GSWKey_SessionID[GSWebNamingConv]] + || [key isEqual:[GSWApp sessionIdKey]]) + { + if ([otherValue isKindOfClass:[NSNumber class]] + && [otherValue boolValue] == NO) + [newQueryDictionary removeObjectForKey:key]; + } + else + { + [newQueryDictionary setObject: otherValue + forKey:key]; + } + } + else + { + [newQueryDictionary removeObjectForKey:key]; + } + } + } + return newQueryDictionary; } -(void) appendConstantAttributesToResponse:(GSWResponse*) response @@ -529,38 +550,37 @@ static inline BOOL _needQuote(NSString* str_needQuote) associations:(NSDictionary*) associations { - if ((associations != nil) && ([associations count] > 0)) { - NSString * s1 = nil; - NSEnumerator * enumer = [associations keyEnumerator]; - GSWComponent * component = GSWContext_component(context); - NSString * key = nil; - GSWAssociation * currentAssociation = nil; - id obj = nil; + if (associations != nil + && [associations count] > 0) + { + NSString * s1 = nil; + NSEnumerator * enumer = [associations keyEnumerator]; + GSWComponent * component = GSWContext_component(context); + NSString * key = nil; + GSWAssociation * currentAssociation = nil; + id obj = nil; - while ((key = [enumer nextObject])) { - currentAssociation = [associations objectForKey:key]; - obj = [currentAssociation valueInComponent:component]; - if (obj != nil) { -// s1 = [(NSNumber*) obj description]; -// mr. ayers says that is not good.. - if ([obj isKindOfClass:NSNumberClass] == YES) { - s1 = [(NSNumber*) obj stringValue]; - } else { - // we have to set the value! - s1 = obj; - } - //NSLog(@"%s:class %@ '%@'", __PRETTY_FUNCTION__, [obj class] , obj); - if ([key isEqual:@"otherTagString"]) { - GSWResponse_appendContentCharacter(response,' '); - GSWResponse_appendContentString(response, s1); - } else { - [response _appendTagAttribute: key - value: s1 - escapingHTMLAttributeValue: NO]; - } - } - } // while - } + while ((key = [enumer nextObject])) + { + currentAssociation = [associations objectForKey:key]; + obj = [currentAssociation valueInComponent:component]; + if (obj != nil) + { + s1=NSStringWithObject(obj); + if ([key isEqual:@"otherTagString"]) + { + GSWResponse_appendContentCharacter(response,' '); + GSWResponse_appendContentString(response, s1); + } + else + { + [response _appendTagAttribute: key + value: s1 + escapingHTMLAttributeValue: NO]; + } + } + } + } } -(void) appendNonURLAttributesToResponse:(GSWResponse*) response diff --git a/GSWeb/GSWHTMLRawParser.m b/GSWeb/GSWHTMLRawParser.m index 1c5e7ed..c18b32f 100644 --- a/GSWeb/GSWHTMLRawParser.m +++ b/GSWeb/GSWHTMLRawParser.m @@ -232,15 +232,11 @@ An exception is raised if the end quote is not found,... index:(int*)indexPtr stopIndex:(int)stopIndex { - int startIndex=0; - NSAssert2(_uniBuf[*indexPtr]==quote,@"First character is not a '%c' but a '%c'", (char)quote,(char)_uniBuf[*indexPtr]); (*indexPtr)++; //skip quote - startIndex=*indexPtr; - while(*indexPtr<=stopIndex && _uniBuf[*indexPtr]!=quote) { @@ -557,7 +553,6 @@ May raise exception. } else { - NSString* tagPropertiesString=nil; NSDictionary* tagProperties; if (_uniBuf[_index-1]=='/') @@ -565,9 +560,6 @@ May raise exception. stopTag=YES; tagPropertiesStopIndex--; }; - tagPropertiesString=[NSString stringWithCharacters:_uniBuf+tagPropertiesStartIndex - length:tagPropertiesStopIndex-tagPropertiesStartIndex]; - tagProperties=[self tagPropertiesForType:tagType betweenIndex:tagPropertiesStartIndex andIndex:tagPropertiesStopIndex-1]; diff --git a/GSWeb/GSWHTTPIO.m b/GSWeb/GSWHTTPIO.m index bf97f0d..1ed9264 100644 --- a/GSWeb/GSWHTTPIO.m +++ b/GSWeb/GSWHTTPIO.m @@ -40,6 +40,7 @@ #include "GSWMessage.h" #include "GSWResponse.h" #include "GSWRequest.h" +#include "GSWApplication.h" #include #include @@ -212,7 +213,7 @@ void _appendMessageHeaders(GSWResponse * message,NSMutableString * headers) void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersion, GSWRequest * request, NSMutableString * headers) { int contentLength = 0; - BOOL keepAlive = NO; + //BOOL keepAlive = NO; BOOL requestIsHead = NO; if (message) { @@ -222,7 +223,7 @@ void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersio if (request) { NSString * connectionValue = [request headerForKey:CONNECTION]; if (connectionValue) { - keepAlive = [connectionValue isEqualToString:KEEP_ALIVE]; + //keepAlive = [connectionValue isEqualToString:KEEP_ALIVE]; } requestIsHead = [[request method] isEqualToString:HEAD]; } @@ -406,12 +407,13 @@ void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersio length: contentLength]; } - request = [[GSWRequest alloc] initWithMethod:method - uri:[requestArray objectAtIndex:1] - httpVersion:[requestArray objectAtIndex:2] - headers:headers - content:contentData - userInfo:nil]; + request = [[[[GSWApplication application]requestClass] + alloc] initWithMethod:method + uri:[requestArray objectAtIndex:1] + httpVersion:[requestArray objectAtIndex:2] + headers:headers + content:contentData + userInfo:nil]; if (request != nil) { diff --git a/GSWeb/GSWImage.m b/GSWeb/GSWImage.m index 4023793..1c48342 100644 --- a/GSWeb/GSWImage.m +++ b/GSWeb/GSWImage.m @@ -114,7 +114,8 @@ RCS_ID("$Id$") resourcemanager = [GSWApp resourceManager]; component = GSWContext_component(context); fileNameValue = [filename valueInComponent:component]; - frameworkName = [framework valueInComponent:component]; + frameworkName = [GSWHTMLDynamicElement _frameworkNameForAssociation:framework + inComponent:component]; resourceURL = [context _urlForResourceNamed: fileNameValue inFramework: frameworkName]; diff --git a/GSWeb/GSWMessage.m b/GSWeb/GSWMessage.m index 4378859..db9ff60 100644 --- a/GSWeb/GSWMessage.m +++ b/GSWeb/GSWMessage.m @@ -825,7 +825,7 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) { [NSException raise:NSInvalidArgumentException format:@"%s: could not convert '%s' non-lossy to encoding %"PRIuPTR, - __PRETTY_FUNCTION__, [lossyData bytes], _contentEncoding]; + __PRETTY_FUNCTION__, [lossyData bytes], (NSUInteger)_contentEncoding]; } _checkBody(self); diff --git a/GSWeb/GSWRadioButton.m b/GSWeb/GSWRadioButton.m index 6cc2314..65fb179 100644 --- a/GSWeb/GSWRadioButton.m +++ b/GSWeb/GSWRadioButton.m @@ -76,12 +76,6 @@ static Class standardClass = Nil; return nil; } - if ((_value != nil) && (![_value isValueSettable])) { - [NSException raise:NSInvalidArgumentException - format:@"%s: 'value' attribute is a constant", - __PRETTY_FUNCTION__]; - } - ASSIGN(_selection, [_associations objectForKey: selection__Key]); if (_selection != nil) { diff --git a/GSWeb/GSWRequest.m b/GSWeb/GSWRequest.m index a33603d..a655350 100644 --- a/GSWeb/GSWRequest.m +++ b/GSWeb/GSWRequest.m @@ -319,9 +319,9 @@ RCS_ID("$Id$") //-------------------------------------------------------------------- // uri --(WODynamicURLString *)uri +-(GSWDynamicURLString *)uri { - return (WODynamicURLString *)_uri; + return (GSWDynamicURLString *)_uri; }; //-------------------------------------------------------------------- @@ -617,8 +617,8 @@ RCS_ID("$Id$") _headers, _contentData, _userInfo, - _defaultFormValueEncoding, - _formValueEncoding, + (NSUInteger)_defaultFormValueEncoding, + (NSUInteger)_formValueEncoding, _formValues, _uriElements, _cookie, diff --git a/GSWeb/GSWString.h b/GSWeb/GSWString.h index f3f8272..302f503 100644 --- a/GSWeb/GSWString.h +++ b/GSWeb/GSWString.h @@ -45,7 +45,7 @@ }; -(id)initWithName:(NSString*)name - associations:(NSMutableDictionary*)associations + associations:(NSDictionary*)associations template:(GSWElement*)template; -(void)appendToResponse:(GSWResponse*)response diff --git a/GSWeb/GSWString.m b/GSWeb/GSWString.m index 9047477..1898286 100644 --- a/GSWeb/GSWString.m +++ b/GSWeb/GSWString.m @@ -50,7 +50,7 @@ static Class standardClass = Nil; //-------------------------------------------------------------------- -(id)initWithName:(NSString*)aName - associations:(NSMutableDictionary*)associations + associations:(NSDictionary*)associations template:(GSWElement*)template { self = [super initWithName:nil associations:nil template:nil]; diff --git a/GSWeb/GSWUtils.m b/GSWeb/GSWUtils.m index 3612d69..5e06949 100644 --- a/GSWeb/GSWUtils.m +++ b/GSWeb/GSWUtils.m @@ -1968,11 +1968,11 @@ NSString* GSWGetDefaultDocRoot() tmpString = [tmpString initWithData:tmpData encoding:encoding]; if (!tmpString) { - NSLog(@"%s NO STRING for path '%@' encoding:%"PRIuPTR, __PRETTY_FUNCTION__, path, encoding); + NSLog(@"%s NO STRING for path '%@' encoding:%"PRIuPTR, __PRETTY_FUNCTION__, path, (NSUInteger)encoding); [NSException raise:NSInvalidArgumentException format:@"%s: could not open convert file contents '%@' non-lossy to encoding %"PRIuPTR, - __PRETTY_FUNCTION__, path, encoding]; + __PRETTY_FUNCTION__, path, (NSUInteger)encoding]; } AUTORELEASE(tmpString); diff --git a/README b/README index 73328e3..bae0027 100644 --- a/README +++ b/README @@ -61,6 +61,9 @@ Special Thanks * Catherine Biscourp for the GNUstepWeb logos and some other things... +* Manuel Guesdon from Turbocat's Development * David Ayers diff --git a/config.mak.in b/config.mak.in index fcb423d..274125c 100644 --- a/config.mak.in +++ b/config.mak.in @@ -32,11 +32,13 @@ GSWDEBUG_DEEP=no #Debug elmentIDs logs and asserts GSWDEBUG_ELEMENTSIDS=no -# use WO Names. Others are depricated. -- dw -gswnames=wo +gswnames=@GSWNAMES@ # Default (generated by configure) ifeq ($(gswnames),) -gswnames=@GSWNAMES@ +# use WO Names if none specified +gswnames=wo endif +EOCONTROL_LIBRARY_NAME=EOControl +EOACCESS_LIBRARY_NAME=EOAccess