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

Unified Diff: utils/pub/hosted_source.dart

Issue 10928041: Add a 30s timeout for all HTTP requests in Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 8 years, 3 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 | « no previous file | utils/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/hosted_source.dart
diff --git a/utils/pub/hosted_source.dart b/utils/pub/hosted_source.dart
index 5e48153260e195d4206ea1c48b11a65d650c5729..5a62882a4399b317ab58a59ff63c4db76d8815f5 100644
--- a/utils/pub/hosted_source.dart
+++ b/utils/pub/hosted_source.dart
@@ -56,9 +56,8 @@ class HostedSource extends Source {
var parsed = _parseDescription(id.description);
var fullUrl = "${parsed.last}/packages/${parsed.first}/versions/"
"${id.version}.yaml";
- return consumeInputStream(httpGet(fullUrl)).transform((data) {
- return new Pubspec.parse(
- new String.fromCharCodes(data), systemCache.sources);
+ return httpGetString(fullUrl).transform((yaml) {
+ return new Pubspec.parse(yaml, systemCache.sources);
});
}
@@ -70,9 +69,10 @@ class HostedSource extends Source {
var name = parsedDescription.first;
var url = parsedDescription.last;
- return ensureDir(destPath).chain((destDir) {
- var fullUrl = "$url/packages/$name/versions/${id.version}.tar.gz";
- return extractTarGz(httpGet(fullUrl), destDir);
+ var fullUrl = "$url/packages/$name/versions/${id.version}.tar.gz";
+ return Futures.wait([httpGet(fullUrl), ensureDir(destPath)]).chain((args) {
+ return future(extractTarGz(args[0], args[1]), HTTP_TIMEOUT,
+ 'Timed out while fetching URL "$fullUrl".');
});
}
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698