Fix NSURLSession header fields not always being matched case insensitive.

This commit is contained in:
Frederik Seiffert 2023-01-13 12:56:42 +01:00 committed by Frederik Seiffert
parent 18f81f9ccc
commit cb6c53b84d
5 changed files with 24 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2023-01-13 Frederik Seiffert <frederik@algoriddim.com>
* 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 <frederik@algoriddim.com>
* Source/GSEasyHandle.m:

View file

@ -378,6 +378,13 @@ static SEL objSel;
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];

View file

@ -3345,7 +3345,6 @@ unfold(const unsigned char *src, const unsigned char *end, BOOL *folded)
@end
@interface _GSMutableInsensitiveDictionary : NSMutableDictionary
@end

View file

@ -118,7 +118,7 @@ typedef struct {
inst->shouldHandleCookies = this->shouldHandleCookies;
inst->debug = this->debug;
inst->ioDelegate = this->ioDelegate;
inst->headers = [this->headers mutableCopy];
inst->headers = [this->headers mutableCopy];
}
}
return o;

View file

@ -284,8 +284,15 @@ typedef struct {
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;