Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: sdk/lib/io/websocket_impl.dart

Issue 11889036: Enable WebSocket secure connection using "wss" in W3C interface. Add testing of secure WebSocket co… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_test.dart » ('j') | tests/standalone/io/web_socket_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 65c4ca48f26b9907d7d47b1b469d6e41e53fc815..20ea830fb09131a6bb5b0a123f68a763021a0fe7 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -767,7 +767,7 @@ class _WebSocketClientConnection
class _WebSocket implements WebSocket {
_WebSocket(String url, [protocols]) {
Uri uri = new Uri.fromString(url);
- if (uri.scheme != "ws") {
+ if (uri.scheme != "ws" && uri.scheme != "wss") {
throw new WebSocketException("Unsupported URL scheme ${uri.scheme}");
}
if (uri.userInfo != "") {
@@ -785,7 +785,12 @@ class _WebSocket implements WebSocket {
}
HttpClient client = new HttpClient();
- HttpClientConnection conn = client.open("GET", uri.domain, port, path);
+ bool secure = (uri.scheme == 'wss');
+ HttpClientConnection conn = client.openUrl("GET",
+ new Uri.fromComponents(scheme: secure ? "https" : "http",
+ domain: uri.domain,
+ port: port,
+ path: path));
if (protocols is String) protocols = [protocols];
_wsconn = new WebSocketClientConnection(conn, protocols);
_wsconn.onOpen = () {
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_test.dart » ('j') | tests/standalone/io/web_socket_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698