Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion PocketSocket/PSWebSocketInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ static inline BOOL PSWebSocketCloseCodeIsValid(NSInteger closeCode) {

static inline NSOrderedSet* PSHTTPHeaderFieldValues(NSString *header) {
NSMutableOrderedSet *components = [NSMutableOrderedSet orderedSet];
[[header componentsSeparatedByString:@";"] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {

//Firefox sends headers separated by ','
NSArray *componentValues = [header componentsSeparatedByString:@";"];
if (componentValues.count == 1 && [header componentsSeparatedByString:@","].count > 1) {
componentValues = [header componentsSeparatedByString:@","];
}

[componentValues enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSString *str = obj;
while ([str hasPrefix:@" "] && str.length > 1) {
str = [str substringWithRange:NSMakeRange(1, str.length - 1)];
Expand Down