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 | 8 |
9 class _WebSocketMessageType { | 9 class _WebSocketMessageType { |
10 static const int NONE = 0; | 10 static const int NONE = 0; |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 Function _onRequest; | 759 Function _onRequest; |
760 Function _onOpen; | 760 Function _onOpen; |
761 Function _onNoUpgrade; | 761 Function _onNoUpgrade; |
762 HttpClientConnection _conn; | 762 HttpClientConnection _conn; |
763 String _nonce; | 763 String _nonce; |
764 } | 764 } |
765 | 765 |
766 | 766 |
767 class _WebSocket implements WebSocket { | 767 class _WebSocket implements WebSocket { |
768 _WebSocket(String url, [protocols]) { | 768 _WebSocket(String url, [protocols]) { |
769 Uri uri = new Uri.fromString(url); | 769 Uri uri = Uri.parse(url); |
770 if (uri.scheme != "ws" && uri.scheme != "wss") { | 770 if (uri.scheme != "ws" && uri.scheme != "wss") { |
771 throw new WebSocketException("Unsupported URL scheme ${uri.scheme}"); | 771 throw new WebSocketException("Unsupported URL scheme ${uri.scheme}"); |
772 } | 772 } |
773 if (uri.userInfo != "") { | 773 if (uri.userInfo != "") { |
774 throw new WebSocketException("Unsupported user info ${uri.userInfo}"); | 774 throw new WebSocketException("Unsupported user info ${uri.userInfo}"); |
775 } | 775 } |
776 int port = uri.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : uri.port; | 776 int port = uri.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : uri.port; |
777 String path = uri.path; | 777 String path = uri.path; |
778 if (path.length == 0) path = "/"; | 778 if (path.length == 0) path = "/"; |
779 if (uri.query != "") { | 779 if (uri.query != "") { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 867 |
868 class _WebSocketCloseEvent implements CloseEvent { | 868 class _WebSocketCloseEvent implements CloseEvent { |
869 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 869 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
870 bool get wasClean => _wasClean; | 870 bool get wasClean => _wasClean; |
871 int get code => _code; | 871 int get code => _code; |
872 String get reason => _reason; | 872 String get reason => _reason; |
873 bool _wasClean; | 873 bool _wasClean; |
874 int _code; | 874 int _code; |
875 String _reason; | 875 String _reason; |
876 } | 876 } |
OLD | NEW |