OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 7 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
8 const String _clientNoContextTakeover = "client_no_context_takeover"; | 8 const String _clientNoContextTakeover = "client_no_context_takeover"; |
9 const String _serverNoContextTakeover = "server_no_context_takeover"; | 9 const String _serverNoContextTakeover = "server_no_context_takeover"; |
10 const String _clientMaxWindowBits = "client_max_window_bits"; | 10 const String _clientMaxWindowBits = "client_max_window_bits"; |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 } else { | 597 } else { |
598 buffer = msg; | 598 buffer = msg; |
599 } | 599 } |
600 | 600 |
601 encoder.process(buffer, 0, buffer.length); | 601 encoder.process(buffer, 0, buffer.length); |
602 | 602 |
603 while ((out = encoder.processed()) != null) { | 603 while ((out = encoder.processed()) != null) { |
604 result.addAll(out); | 604 result.addAll(out); |
605 } | 605 } |
606 | 606 |
607 if (!serverSide && clientNoContextTakeover) { | |
608 encoder.end(); | |
609 encoder = null; | |
Søren Gjesse
2016/01/15 08:08:38
Shouldn't there be similar logic in the other dire
| |
610 } | |
611 | |
607 if (result.length > 4) { | 612 if (result.length > 4) { |
608 result = result.sublist(0, result.length - 4); | 613 result = result.sublist(0, result.length - 4); |
609 } | 614 } |
610 | 615 |
611 return result; | 616 return result; |
612 } | 617 } |
613 } | 618 } |
614 | 619 |
615 // TODO(ajohnsen): Make this transformer reusable. | 620 // TODO(ajohnsen): Make this transformer reusable. |
616 class _WebSocketOutgoingTransformer implements StreamTransformer, EventSink { | 621 class _WebSocketOutgoingTransformer implements StreamTransformer, EventSink { |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1229 return code != null && | 1234 return code != null && |
1230 (code < WebSocketStatus.NORMAL_CLOSURE || | 1235 (code < WebSocketStatus.NORMAL_CLOSURE || |
1231 code == WebSocketStatus.RESERVED_1004 || | 1236 code == WebSocketStatus.RESERVED_1004 || |
1232 code == WebSocketStatus.NO_STATUS_RECEIVED || | 1237 code == WebSocketStatus.NO_STATUS_RECEIVED || |
1233 code == WebSocketStatus.ABNORMAL_CLOSURE || | 1238 code == WebSocketStatus.ABNORMAL_CLOSURE || |
1234 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && | 1239 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && |
1235 code < WebSocketStatus.RESERVED_1015) || | 1240 code < WebSocketStatus.RESERVED_1015) || |
1236 (code >= WebSocketStatus.RESERVED_1015 && code < 3000)); | 1241 (code >= WebSocketStatus.RESERVED_1015 && code < 3000)); |
1237 } | 1242 } |
1238 } | 1243 } |
OLD | NEW |