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

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

Issue 11645044: Refactor handling of Transfer-Encoding (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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_content_length_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } else { 417 } else {
418 // Start of new header field. 418 // Start of new header field.
419 _headerField.add(_toLowerCase(byte)); 419 _headerField.add(_toLowerCase(byte));
420 _state = _State.HEADER_FIELD; 420 _state = _State.HEADER_FIELD;
421 } 421 }
422 } 422 }
423 break; 423 break;
424 424
425 case _State.HEADER_ENDING: 425 case _State.HEADER_ENDING:
426 _expect(byte, _CharCode.LF); 426 _expect(byte, _CharCode.LF);
427 _headers._mutable = false;
427 428
428 _contentLength = _headers.contentLength; 429 _contentLength = _headers.contentLength;
429 // Ignore the Content-Length header if Transfer-Encoding 430 // Ignore the Content-Length header if Transfer-Encoding
430 // is chunked (RFC 2616 section 4.4) 431 // is chunked (RFC 2616 section 4.4)
431 if (_chunked) _contentLength = -1; 432 if (_chunked) _contentLength = -1;
432 433
433 // If a request message has neither Content-Length nor 434 // If a request message has neither Content-Length nor
434 // Transfer-Encoding the message must not have a body (RFC 435 // Transfer-Encoding the message must not have a body (RFC
435 // 2616 section 4.3). 436 // 2616 section 4.3).
436 if (_messageType == _MessageType.REQUEST && 437 if (_messageType == _MessageType.REQUEST &&
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 Function error; 785 Function error;
785 Function closed; 786 Function closed;
786 } 787 }
787 788
788 789
789 class HttpParserException implements Exception { 790 class HttpParserException implements Exception {
790 const HttpParserException([String this.message = ""]); 791 const HttpParserException([String this.message = ""]);
791 String toString() => "HttpParserException: $message"; 792 String toString() => "HttpParserException: $message";
792 final String message; 793 final String message;
793 } 794 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_content_length_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698