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

Unified Diff: runtime/bin/http_parser.dart

Issue 11348005: Change the handling og the HTTP content length (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | tests/standalone/io/http_content_length_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http_parser.dart
diff --git a/runtime/bin/http_parser.dart b/runtime/bin/http_parser.dart
index 571ce702496d493f2e83a5491d0470bb0a4311d6..a5549c5d3a519fceace71023d934c2330baab503 100644
--- a/runtime/bin/http_parser.dart
+++ b/runtime/bin/http_parser.dart
@@ -428,6 +428,14 @@ class _HttpParser {
case _State.HEADER_ENDING:
_expect(byte, _CharCode.LF);
+ // If a request message has neither Content-Length nor
+ // Transfer-Encoding the message must not have a body (RFC
+ // 2616 section 4.3).
+ if (_messageType == _MessageType.REQUEST &&
+ _contentLength < 0 &&
+ _chunked == false) {
+ _contentLength = 0;
+ }
if (_connectionUpgrade) {
_state = _State.UPGRADED;
_unparsedData =
@@ -439,8 +447,6 @@ class _HttpParser {
_state = _State.CHUNK_SIZE;
_remainingContent = 0;
} else if (_contentLength == 0 ||
- (_messageType == _MessageType.REQUEST &&
- _contentLength == -1) ||
(_messageType == _MessageType.RESPONSE &&
(_noMessageBody || _responseToMethod == "HEAD"))) {
// If there is no message body get ready to process the
« no previous file with comments | « runtime/bin/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