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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 72663005: Clean up HttpHeaders to always have them in a consistent state. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup. Created 7 years, 1 month 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 | « sdk/lib/io/http_headers.dart ('k') | tests/standalone/io/http_10_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 80c560ad69e7dc657a07a8d438d27380488880de..3b942ac020aa5a5a23da9b741b5710fdb1c35fbf 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -95,7 +95,10 @@ class _HttpRequest extends _HttpInboundMessage implements HttpRequest {
_HttpServer this._httpServer,
_HttpConnection this._httpConnection)
: super(_incoming) {
- response.headers.persistentConnection = headers.persistentConnection;
+ if (headers.protocolVersion == "1.1") {
+ response.headers.chunkedTransferEncoding = true;
+ response.headers.persistentConnection = headers.persistentConnection;
+ }
if (_httpServer._sessionManagerInstance != null) {
// Map to session if exists.
@@ -492,7 +495,6 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
}
if (_headersWritten) return new Future.value();
_headersWritten = true;
- headers._synchronize(); // Be sure the 'chunked' option is updated.
_dataSink.encoding = encoding;
bool isServerSide = this is _HttpResponse;
if (isServerSide) {
@@ -543,8 +545,6 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
}
Future _close() {
- // TODO(ajohnsen): Currently, contentLength, chunkedTransferEncoding and
- // persistentConnection is not guaranteed to be in sync.
if (!_headersWritten) {
if (!_ignoreBody && headers.contentLength == -1) {
// If no body was written, _ignoreBody is false (it's not a HEAD
@@ -933,6 +933,8 @@ class _HttpClientRequest extends _HttpOutboundMessage<HttpClientResponse>
// GET and HEAD have 'content-length: 0' by default.
if (method == "GET" || method == "HEAD") {
contentLength = 0;
+ } else {
+ headers.chunkedTransferEncoding = true;
}
}
« no previous file with comments | « sdk/lib/io/http_headers.dart ('k') | tests/standalone/io/http_10_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698