Chromium Code Reviews| 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..ae6d4fc8b5cb843016000ce166a3073e133bafb5 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 { |
| + // Immidate we wrote the headers. |
|
nweiz
2014/04/29 19:59:09
"Imitate having written the headers."
Anders Johnsen
2014/04/30 12:35:49
Done.
|
| + _outgoing.headersWritten = true; |
| + } |
| // Close connection so the socket is 'free'. |
| close(); |
| done.catchError((_) { |