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 12595004: Fix handling to responses to HEAD requests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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 | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_head_test.dart » ('j') | 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 _incoming.reasonPhrase = 559 _incoming.reasonPhrase =
560 new String.fromCharCodes(_uri_or_reason_phrase); 560 new String.fromCharCodes(_uri_or_reason_phrase);
561 } 561 }
562 _method_or_status_code.clear(); 562 _method_or_status_code.clear();
563 _uri_or_reason_phrase.clear(); 563 _uri_or_reason_phrase.clear();
564 if (_connectionUpgrade) { 564 if (_connectionUpgrade) {
565 _incoming.upgraded = true; 565 _incoming.upgraded = true;
566 _controller.add(_incoming); 566 _controller.add(_incoming);
567 break; 567 break;
568 } 568 }
569 if (_chunked) { 569 if (_transferLength == 0 ||
570 _state = _State.CHUNK_SIZE; 570 (_messageType == _MessageType.RESPONSE &&
571 _remainingContent = 0; 571 (_noMessageBody || _responseToMethod == "HEAD"))) {
572 } else if (_transferLength == 0 ||
573 (_messageType == _MessageType.RESPONSE &&
574 (_noMessageBody || _responseToMethod == "HEAD"))) {
575 _reset(); 572 _reset();
576 var tmp = _incoming; 573 var tmp = _incoming;
577 _closeIncoming(); 574 _closeIncoming();
578 _controller.add(tmp); 575 _controller.add(tmp);
579 break; 576 break;
577 } else if (_chunked) {
578 _state = _State.CHUNK_SIZE;
579 _remainingContent = 0;
580 } else if (_transferLength > 0) { 580 } else if (_transferLength > 0) {
581 _remainingContent = _transferLength; 581 _remainingContent = _transferLength;
582 _state = _State.BODY; 582 _state = _State.BODY;
583 } else { 583 } else {
584 // Neither chunked nor content length. End of body 584 // Neither chunked nor content length. End of body
585 // indicated by close. 585 // indicated by close.
586 _state = _State.BODY; 586 _state = _State.BODY;
587 } 587 }
588 _controller.add(_incoming); 588 _controller.add(_incoming);
589 break; 589 break;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 StreamController<_HttpIncoming> _controller; 970 StreamController<_HttpIncoming> _controller;
971 StreamController<List<int>> _bodyController; 971 StreamController<List<int>> _bodyController;
972 } 972 }
973 973
974 974
975 class HttpParserException implements Exception { 975 class HttpParserException implements Exception {
976 const HttpParserException([String this.message = ""]); 976 const HttpParserException([String this.message = ""]);
977 String toString() => "HttpParserException: $message"; 977 String toString() => "HttpParserException: $message";
978 final String message; 978 final String message;
979 } 979 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_head_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698