Index: sdk/lib/io/http_parser.dart |
diff --git a/sdk/lib/io/http_parser.dart b/sdk/lib/io/http_parser.dart |
index dc397c3c1782daadd86fc3219b86b5a488aaaff8..98c19d1f56996be48642e56d4c5e4b3820c7c252 100644 |
--- a/sdk/lib/io/http_parser.dart |
+++ b/sdk/lib/io/http_parser.dart |
@@ -664,9 +664,15 @@ class _HttpParser extends Stream<_HttpIncoming> { |
} |
if (headerField == "connection") { |
List<String> tokens = _tokenizeFieldValue(headerValue); |
+ final bool isResponse = _messageType == _MessageType.RESPONSE; |
+ final bool isUpgradeCode = |
+ _statusCode == HttpStatus.UPGRADE_REQUIRED || |
+ _statusCode == HttpStatus.SWITCHING_PROTOCOLS; |
siva
2017/08/07 21:30:19
Not sure about Dart coding standards but would mak
zra
2017/08/07 22:09:04
Couldn't find any guidance in the style guide, but
|
for (int i = 0; i < tokens.length; i++) { |
- if (_caseInsensitiveCompare( |
- "upgrade".codeUnits, tokens[i].codeUnits)) { |
+ final bool isUpgrade = _caseInsensitiveCompare( |
+ "upgrade".codeUnits, tokens[i].codeUnits); |
+ if ((isUpgrade && !isResponse) || |
+ (isUpgrade && isResponse && isUpgradeCode)) { |
_connectionUpgrade = true; |
} |
_headers._add(headerField, tokens[i]); |