Closed AndreiArdelean1 closed 8 years ago
Aparently "Sec-WebSocket-Extensions" "permessage-deflate", PocketSocket and Firefox do not work well together. I ended up disabling it in the server implementation.
For anyone that may be encountering this problem, here's a clarification of @AndreiArdelean1's method:
PSWebSocketDriver.m:87
Replace
[[headers[@"Connection"] lowercaseString] isEqualToString:@"upgrade"]
with
[[headers[@"Connection"] lowercaseString] containsString:@"upgrade"]
PSWebSocketDriver.m:113
Replace
_pmdEnabled = YES;
with
_pmdEnabled = NO;
To be fair Firefox is against spec here, there should be nothing but 'upgrade' in that header. However, I've pushed a fix to develop though I'm still working on getting the test suite back up and running so not 100% sure it's good to go yet.
Firefox sends the a header with the "Connection" "keep-alive, Upgrade", which does not pass:
+ (BOOL)isWebSocketRequest:(NSURLRequest *)request
from PSWebSocketDriver.m The problem is at line (line 87):
[[headers[@"Connection"] lowercaseString] isEqualToString:@"upgrade"]
After replacing it with
[[headers[@"Connection"] lowercaseString] containsString:@"upgrade"]
or[[[[headers[@"Connection"] lowercaseString] stringByReplacingOccurrencesOfString:@" " withString:@""] componentsSeparatedByString:@","] containsObject:@"upgrade"]
the WebSocket opens and then fails with error :
but the stream is actually of class NSInputStream.
Can anyone provide some suggestions?