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

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

Issue 1077603002: Cleanup change in r44998 a bit (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 612 }
613 } 613 }
614 _state = _State.HEADER_START; 614 _state = _State.HEADER_START;
615 break; 615 break;
616 616
617 case _State.HEADER_START: 617 case _State.HEADER_START:
618 _headers = new _HttpHeaders(version); 618 _headers = new _HttpHeaders(version);
619 if (byte == _CharCode.CR) { 619 if (byte == _CharCode.CR) {
620 _state = _State.HEADER_ENDING; 620 _state = _State.HEADER_ENDING;
621 } else if (byte == _CharCode.LF) { 621 } else if (byte == _CharCode.LF) {
622 if (_headersEnd()) { 622 _state = _State.HEADER_ENDING;
623 return; 623 _index--; // Make the new state see the LF again.
624 } else {
625 break;
626 }
627 } else { 624 } else {
628 // Start of new header field. 625 // Start of new header field.
629 _headerField.add(_toLowerCaseByte(byte)); 626 _headerField.add(_toLowerCaseByte(byte));
630 _state = _State.HEADER_FIELD; 627 _state = _State.HEADER_FIELD;
631 } 628 }
632 break; 629 break;
633 630
634 case _State.HEADER_FIELD: 631 case _State.HEADER_FIELD:
635 if (byte == _CharCode.COLON) { 632 if (byte == _CharCode.COLON) {
636 _state = _State.HEADER_VALUE_START; 633 _state = _State.HEADER_VALUE_START;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 687 }
691 } else { 688 } else {
692 _headers._add(headerField, headerValue); 689 _headers._add(headerField, headerValue);
693 } 690 }
694 _headerField.clear(); 691 _headerField.clear();
695 _headerValue.clear(); 692 _headerValue.clear();
696 693
697 if (byte == _CharCode.CR) { 694 if (byte == _CharCode.CR) {
698 _state = _State.HEADER_ENDING; 695 _state = _State.HEADER_ENDING;
699 } else if (byte == _CharCode.LF) { 696 } else if (byte == _CharCode.LF) {
700 if (_headersEnd()) { 697 _state = _State.HEADER_ENDING;
701 return; 698 _index--; // Make the new state see the LF again.
702 } else {
703 break;
704 }
705 } else { 699 } else {
706 // Start of new header field. 700 // Start of new header field.
707 _headerField.add(_toLowerCaseByte(byte)); 701 _headerField.add(_toLowerCaseByte(byte));
708 _state = _State.HEADER_FIELD; 702 _state = _State.HEADER_FIELD;
709 } 703 }
710 } 704 }
711 break; 705 break;
712 706
713 case _State.HEADER_ENDING: 707 case _State.HEADER_ENDING:
714 _expect(byte, _CharCode.LF); 708 _expect(byte, _CharCode.LF);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 } 1062 }
1069 } 1063 }
1070 1064
1071 void _reportError(error, [stackTrace]) { 1065 void _reportError(error, [stackTrace]) {
1072 if (_socketSubscription != null) _socketSubscription.cancel(); 1066 if (_socketSubscription != null) _socketSubscription.cancel();
1073 _state = _State.FAILURE; 1067 _state = _State.FAILURE;
1074 _controller.addError(error, stackTrace); 1068 _controller.addError(error, stackTrace);
1075 _controller.close(); 1069 _controller.close();
1076 } 1070 }
1077 } 1071 }
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