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

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

Issue 148323009: Go into UPGRADED state in http-parser, when socket is being detached. (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 // Global constants. 7 // Global constants.
8 class _Const { 8 class _Const {
9 // Bytes for "HTTP". 9 // Bytes for "HTTP".
10 static const HTTP = const [72, 84, 84, 80]; 10 static const HTTP = const [72, 84, 84, 80];
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 } 877 }
878 878
879 int get messageType => _messageType; 879 int get messageType => _messageType;
880 int get transferLength => _transferLength; 880 int get transferLength => _transferLength;
881 bool get upgrade => _connectionUpgrade && _state == _State.UPGRADED; 881 bool get upgrade => _connectionUpgrade && _state == _State.UPGRADED;
882 bool get persistentConnection => _persistentConnection; 882 bool get persistentConnection => _persistentConnection;
883 883
884 void set responseToMethod(String method) { _responseToMethod = method; } 884 void set responseToMethod(String method) { _responseToMethod = method; }
885 885
886 _HttpDetachedIncoming detachIncoming() { 886 _HttpDetachedIncoming detachIncoming() {
887 // Simulate detached by marking as upgraded.
888 _state = _State.UPGRADED;
887 return new _HttpDetachedIncoming(_socketSubscription, 889 return new _HttpDetachedIncoming(_socketSubscription,
888 readUnparsedData()); 890 readUnparsedData());
889 } 891 }
890 892
891 List<int> readUnparsedData() { 893 List<int> readUnparsedData() {
892 if (_buffer == null) return null; 894 if (_buffer == null) return null;
893 if (_index == _buffer.length) return null; 895 if (_index == _buffer.length) return null;
894 var result = _buffer.sublist(_index); 896 var result = _buffer.sublist(_index);
895 _releaseBuffer(); 897 _releaseBuffer();
896 return result; 898 return result;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 } 1038 }
1037 } 1039 }
1038 1040
1039 void _reportError(error, [stackTrace]) { 1041 void _reportError(error, [stackTrace]) {
1040 if (_socketSubscription != null) _socketSubscription.cancel(); 1042 if (_socketSubscription != null) _socketSubscription.cancel();
1041 _state = _State.FAILURE; 1043 _state = _State.FAILURE;
1042 _controller.addError(error, stackTrace); 1044 _controller.addError(error, stackTrace);
1043 _controller.close(); 1045 _controller.close();
1044 } 1046 }
1045 } 1047 }
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