Index: sdk/lib/io/http_impl.dart |
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart |
index 458333d3475d6d05bb43804d600e0bd42901e3ad..8793f2244de3b2361ffde75cd986e0c74051914b 100644 |
--- a/sdk/lib/io/http_impl.dart |
+++ b/sdk/lib/io/http_impl.dart |
@@ -1719,13 +1719,13 @@ class _HttpClient implements HttpClient { |
bool callback(X509Certificate certificate) => |
currentBadCertificateCallback == null ? false : |
currentBadCertificateCallback(certificate, uriHost, uriPort); |
- return (isSecure && proxy.isDirect |
- ? SecureSocket.connect(host, |
- port, |
- sendClientCertificate: true, |
- onBadCertificate: callback) |
- : Socket.connect(host, port)) |
- .then((socket) { |
+ Future socketFuture = (isSecure && proxy.isDirect |
+ ? SecureSocket.connect(host, |
+ port, |
+ sendClientCertificate: true, |
+ onBadCertificate: callback) |
+ : Socket.connect(host, port)); |
+ return socketFuture.then((socket) { |
socket.setOption(SocketOption.TCP_NODELAY, true); |
var connection = new _HttpClientConnection(key, socket, this); |
if (isSecure && !proxy.isDirect) { |