diff --git a/ChangeLog b/ChangeLog index aa937460d4..8c481a0b6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-01-13 Frederik Seiffert + + * Source/Additions/GSInsensitiveDictionary.m: + * Source/NSURLRequest.m: + * Source/NSURLResponse.m: + Fix NSURLSession header fields not always being matched case + insensitive. + 2023-01-13 Frederik Seiffert * Source/GSEasyHandle.m: diff --git a/Source/Additions/GSInsensitiveDictionary.m b/Source/Additions/GSInsensitiveDictionary.m index 6400bb57b1..b383ed0009 100644 --- a/Source/Additions/GSInsensitiveDictionary.m +++ b/Source/Additions/GSInsensitiveDictionary.m @@ -378,6 +378,13 @@ - (id) copyWithZone: (NSZone*)zone return [copy initWithDictionary: self copyItems: NO]; } +- (id) mutableCopyWithZone: (NSZone*)z +{ + NSMutableDictionary *copy = [_GSMutableInsensitiveDictionary allocWithZone: z]; + + return [copy initWithDictionary: self copyItems: NO]; +} + - (id) init { return [self initWithCapacity: 0]; diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index aa4d5e369c..7478ded754 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -3345,7 +3345,6 @@ - (BOOL) _scanHeaderParameters: (NSScanner*)scanner into: (GSMimeHeader*)info @end - @interface _GSMutableInsensitiveDictionary : NSMutableDictionary @end diff --git a/Source/NSURLRequest.m b/Source/NSURLRequest.m index beed313a78..b079df8f6b 100644 --- a/Source/NSURLRequest.m +++ b/Source/NSURLRequest.m @@ -118,7 +118,7 @@ - (id) copyWithZone: (NSZone*)z inst->shouldHandleCookies = this->shouldHandleCookies; inst->debug = this->debug; inst->ioDelegate = this->ioDelegate; - inst->headers = [this->headers mutableCopy]; + inst->headers = [this->headers mutableCopy]; } } return o; diff --git a/Source/NSURLResponse.m b/Source/NSURLResponse.m index c68fc2fa17..3e013b39d0 100644 --- a/Source/NSURLResponse.m +++ b/Source/NSURLResponse.m @@ -284,8 +284,15 @@ - (id) initWithURL: (NSURL*)URL textEncodingName: nil]; if (nil != self) { + NSString *k; + NSEnumerator *e = [headerFields keyEnumerator]; + while (nil != (k = [e nextObject])) + { + NSString *v = [headerFields objectForKey: k]; + [self _setValue: v forHTTPHeaderField: k]; + } + this->statusCode = statusCode; - this->headers = [headerFields copy]; [self _checkHeaders]; } return self;