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

Side by Side Diff: sdk/lib/io/websocket_impl.dart

Issue 141293008: Fix websocket_impl.dart to work with websockets created by Chrome devtools. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Matches _WebSocketOpcode. 9 // Matches _WebSocketOpcode.
10 class _WebSocketMessageType { 10 class _WebSocketMessageType {
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 userInfo: uri.userInfo, 805 userInfo: uri.userInfo,
806 host: uri.host, 806 host: uri.host,
807 port: uri.port, 807 port: uri.port,
808 path: uri.path, 808 path: uri.path,
809 query: uri.query, 809 query: uri.query,
810 fragment: uri.fragment); 810 fragment: uri.fragment);
811 return _httpClient.openUrl("GET", uri) 811 return _httpClient.openUrl("GET", uri)
812 .then((request) { 812 .then((request) {
813 // Setup the initial handshake. 813 // Setup the initial handshake.
814 request.headers 814 request.headers
815 ..add(HttpHeaders.CONNECTION, "upgrade") 815 ..add(HttpHeaders.CONNECTION, "Upgrade")
816 ..set(HttpHeaders.UPGRADE, "websocket") 816 ..set(HttpHeaders.UPGRADE, "websocket")
817 ..set("Sec-WebSocket-Key", nonce) 817 ..set("Sec-WebSocket-Key", nonce)
818 ..set("Cache-Control", "no-cache")
818 ..set("Sec-WebSocket-Version", "13"); 819 ..set("Sec-WebSocket-Version", "13");
819 if (protocols.isNotEmpty) { 820 if (protocols.isNotEmpty) {
820 request.headers.add("Sec-WebSocket-Protocol", protocols); 821 request.headers.add("Sec-WebSocket-Protocol", protocols);
821 } 822 }
822 return request.close(); 823 return request.close();
823 }) 824 })
824 .then((response) { 825 .then((response) {
825 void error(String message) { 826 void error(String message) {
826 // Flush data. 827 // Flush data.
827 response.detachSocket().then((socket) { 828 response.detachSocket().then((socket) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 (code < WebSocketStatus.NORMAL_CLOSURE || 975 (code < WebSocketStatus.NORMAL_CLOSURE ||
975 code == WebSocketStatus.RESERVED_1004 || 976 code == WebSocketStatus.RESERVED_1004 ||
976 code == WebSocketStatus.NO_STATUS_RECEIVED || 977 code == WebSocketStatus.NO_STATUS_RECEIVED ||
977 code == WebSocketStatus.ABNORMAL_CLOSURE || 978 code == WebSocketStatus.ABNORMAL_CLOSURE ||
978 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && 979 (code > WebSocketStatus.INTERNAL_SERVER_ERROR &&
979 code < WebSocketStatus.RESERVED_1015) || 980 code < WebSocketStatus.RESERVED_1015) ||
980 (code >= WebSocketStatus.RESERVED_1015 && 981 (code >= WebSocketStatus.RESERVED_1015 &&
981 code < 3000)); 982 code < 3000));
982 } 983 }
983 } 984 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698