| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 decoder.process(data, 0, data.length); | 574 decoder.process(data, 0, data.length); |
| 575 var result = []; | 575 var result = []; |
| 576 var out; | 576 var out; |
| 577 | 577 |
| 578 while ((out = decoder.processed()) != null) { | 578 while ((out = decoder.processed()) != null) { |
| 579 result.addAll(out); | 579 result.addAll(out); |
| 580 } | 580 } |
| 581 | 581 |
| 582 if ((serverSide && clientNoContextTakeover) || | 582 if ((serverSide && clientNoContextTakeover) || |
| 583 (!serverSide && serverNoContextTakeover)) { | 583 (!serverSide && serverNoContextTakeover)) { |
| 584 decoder.end(); | |
| 585 decoder = null; | 584 decoder = null; |
| 586 } | 585 } |
| 587 | 586 |
| 588 return new Uint8List.fromList(result); | 587 return new Uint8List.fromList(result); |
| 589 } | 588 } |
| 590 | 589 |
| 591 List<int> processOutgoingMessage(List<int> msg) { | 590 List<int> processOutgoingMessage(List<int> msg) { |
| 592 _ensureEncoder(); | 591 _ensureEncoder(); |
| 593 var result = []; | 592 var result = []; |
| 594 Uint8List buffer; | 593 Uint8List buffer; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 607 } | 606 } |
| 608 | 607 |
| 609 encoder.process(buffer, 0, buffer.length); | 608 encoder.process(buffer, 0, buffer.length); |
| 610 | 609 |
| 611 while ((out = encoder.processed()) != null) { | 610 while ((out = encoder.processed()) != null) { |
| 612 result.addAll(out); | 611 result.addAll(out); |
| 613 } | 612 } |
| 614 | 613 |
| 615 if ((!serverSide && clientNoContextTakeover) || | 614 if ((!serverSide && clientNoContextTakeover) || |
| 616 (serverSide && serverNoContextTakeover)) { | 615 (serverSide && serverNoContextTakeover)) { |
| 617 encoder.end(); | |
| 618 encoder = null; | 616 encoder = null; |
| 619 } | 617 } |
| 620 | 618 |
| 621 if (result.length > 4) { | 619 if (result.length > 4) { |
| 622 result = result.sublist(0, result.length - 4); | 620 result = result.sublist(0, result.length - 4); |
| 623 } | 621 } |
| 624 | 622 |
| 625 return result; | 623 return result; |
| 626 } | 624 } |
| 627 } | 625 } |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 return code != null && | 1241 return code != null && |
| 1244 (code < WebSocketStatus.NORMAL_CLOSURE || | 1242 (code < WebSocketStatus.NORMAL_CLOSURE || |
| 1245 code == WebSocketStatus.RESERVED_1004 || | 1243 code == WebSocketStatus.RESERVED_1004 || |
| 1246 code == WebSocketStatus.NO_STATUS_RECEIVED || | 1244 code == WebSocketStatus.NO_STATUS_RECEIVED || |
| 1247 code == WebSocketStatus.ABNORMAL_CLOSURE || | 1245 code == WebSocketStatus.ABNORMAL_CLOSURE || |
| 1248 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && | 1246 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && |
| 1249 code < WebSocketStatus.RESERVED_1015) || | 1247 code < WebSocketStatus.RESERVED_1015) || |
| 1250 (code >= WebSocketStatus.RESERVED_1015 && code < 3000)); | 1248 (code >= WebSocketStatus.RESERVED_1015 && code < 3000)); |
| 1251 } | 1249 } |
| 1252 } | 1250 } |
| OLD | NEW |