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

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

Issue 23507003: Fix piping to a WebSocket (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 3 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
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 class _WebSocketMessageType { 9 class _WebSocketMessageType {
10 static const int NONE = 0; 10 static const int NONE = 0;
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 859
860 Future close([int code, String reason]) { 860 Future close([int code, String reason]) {
861 if (!_writeClosed) { 861 if (!_writeClosed) {
862 if (_isReservedStatusCode(code)) { 862 if (_isReservedStatusCode(code)) {
863 throw new WebSocketException("Reserved status code $code"); 863 throw new WebSocketException("Reserved status code $code");
864 } 864 }
865 _outCloseCode = code; 865 _outCloseCode = code;
866 _outCloseReason = reason; 866 _outCloseReason = reason;
867 _writeClosed = true; 867 _writeClosed = true;
868 } 868 }
869 return _sink.close(); 869 if (!_sink._isBound) _sink.close();
870 return _sink.done;
870 } 871 }
871 872
872 static bool _isReservedStatusCode(int code) { 873 static bool _isReservedStatusCode(int code) {
873 return code != null && 874 return code != null &&
874 (code < WebSocketStatus.NORMAL_CLOSURE || 875 (code < WebSocketStatus.NORMAL_CLOSURE ||
875 code == WebSocketStatus.RESERVED_1004 || 876 code == WebSocketStatus.RESERVED_1004 ||
876 code == WebSocketStatus.NO_STATUS_RECEIVED || 877 code == WebSocketStatus.NO_STATUS_RECEIVED ||
877 code == WebSocketStatus.ABNORMAL_CLOSURE || 878 code == WebSocketStatus.ABNORMAL_CLOSURE ||
878 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && 879 (code > WebSocketStatus.INTERNAL_SERVER_ERROR &&
879 code < WebSocketStatus.RESERVED_1015) || 880 code < WebSocketStatus.RESERVED_1015) ||
880 (code >= WebSocketStatus.RESERVED_1015 && 881 (code >= WebSocketStatus.RESERVED_1015 &&
881 code < 3000)); 882 code < 3000));
882 } 883 }
883 } 884 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_pipe_test.dart » ('j') | tests/standalone/io/web_socket_pipe_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698