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

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

Issue 262433003: Add writeHeaders argument to HttpResponse::detachSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix comment. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/http.dart ('k') | tests/standalone/io/http_detach_socket_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 d3325229cc1bcaa3ae32c3f5efe6b43cb0635d12..2bd28a955c803af3ed80762113268278caed12da 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -526,13 +526,18 @@ class _HttpResponse extends _HttpOutboundMessage<HttpResponse>
return close();
}
- Future<Socket> detachSocket() {
+ Future<Socket> detachSocket({bool writeHeaders: true}) {
if (_outgoing.headersWritten) throw new StateError("Headers already sent");
deadline = null; // Be sure to stop any deadline.
var future = _httpRequest._httpConnection.detachSocket();
- var headersFuture = _outgoing.writeHeaders(drainRequest: false,
- setOutgoing: false);
- assert(headersFuture == null);
+ if (writeHeaders) {
+ var headersFuture = _outgoing.writeHeaders(drainRequest: false,
+ setOutgoing: false);
+ assert(headersFuture == null);
+ } else {
+ // Imitate having written the headers.
+ _outgoing.headersWritten = true;
+ }
// Close connection so the socket is 'free'.
close();
done.catchError((_) {
« no previous file with comments | « sdk/lib/io/http.dart ('k') | tests/standalone/io/http_detach_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698