| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 5 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 6 | 6 |
| 7 class _WebSocketMessageType { | 7 class _WebSocketMessageType { |
| 8 static const int NONE = 0; | 8 static const int NONE = 0; |
| 9 static const int BINARY = 1; | 9 static const int BINARY = 1; |
| 10 static const int TEXT = 2; | 10 static const int TEXT = 2; |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 } else { | 693 } else { |
| 694 _conn.detachSocket().socket.close(); | 694 _conn.detachSocket().socket.close(); |
| 695 throw new WebSocketException("Protocol upgrade refused"); | 695 throw new WebSocketException("Protocol upgrade refused"); |
| 696 } | 696 } |
| 697 return; | 697 return; |
| 698 } | 698 } |
| 699 | 699 |
| 700 if (!_isWebSocketUpgrade(response)) { | 700 if (!_isWebSocketUpgrade(response)) { |
| 701 _conn.detachSocket().socket.close(); | 701 _conn.detachSocket().socket.close(); |
| 702 throw new WebSocketException("Protocol upgrade failed"); | 702 throw new WebSocketException("Protocol upgrade failed"); |
| 703 return; | |
| 704 } | 703 } |
| 705 | 704 |
| 706 // Connection upgrade successful. | 705 // Connection upgrade successful. |
| 707 DetachedSocket detached = _conn.detachSocket(); | 706 DetachedSocket detached = _conn.detachSocket(); |
| 708 _socketConnected(detached.socket); | 707 _socketConnected(detached.socket); |
| 709 if (_onOpen != null) _onOpen(); | 708 if (_onOpen != null) _onOpen(); |
| 710 _startProcessing(detached.unparsedData); | 709 _startProcessing(detached.unparsedData); |
| 711 } | 710 } |
| 712 | 711 |
| 713 void _generateNonceAndHash() { | 712 void _generateNonceAndHash() { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 | 863 |
| 865 class _WebSocketCloseEvent implements CloseEvent { | 864 class _WebSocketCloseEvent implements CloseEvent { |
| 866 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 865 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
| 867 bool get wasClean => _wasClean; | 866 bool get wasClean => _wasClean; |
| 868 int get code => _code; | 867 int get code => _code; |
| 869 String get reason => _reason; | 868 String get reason => _reason; |
| 870 bool _wasClean; | 869 bool _wasClean; |
| 871 int _code; | 870 int _code; |
| 872 String _reason; | 871 String _reason; |
| 873 } | 872 } |
| OLD | NEW |