Fix pub to close connection to dartlang.org when it's done downloading

See bug http://dartbug.com/4857
fixes: http://dartbug.com/4856

Review URL: https://chromiumcodereview.appspot.com//10913034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11714 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
jmesserly@google.com 2012-08-31 19:02:42 +00:00
parent 4987ff9cd9
commit 963d06882b

View file

@ -291,7 +291,8 @@ String getFullPath(entry) => new File(_getPath(entry)).fullPathSync();
*/
InputStream httpGet(uri) {
var resultStream = new ListInputStream();
var connection = new HttpClient().getUrl(_getUri(uri));
var client = new HttpClient();
var connection = client.getUrl(_getUri(uri));
// TODO(nweiz): propagate this error to the return value. See issue 3657.
connection.onError = (e) { throw e; };
@ -302,7 +303,7 @@ InputStream httpGet(uri) {
"HTTP request for $uri failed with status ${response.statusCode}");
}
pipeInputToInput(response.inputStream, resultStream);
pipeInputToInput(response.inputStream, resultStream, client.shutdown);
};
return resultStream;