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

Side by Side Diff: lib/src/utils.dart

Issue 1790503005: Provide and respect HTTP cache headers in pub serve. (Closed) Base URL: https://github.com/dart-lang/pub.git@master
Patch Set: Revise! Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « lib/src/command/serve.dart ('k') | test/serve/caches_unchanged_assets.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Generic utility functions. Stuff that should possibly be in core. 5 /// Generic utility functions. Stuff that should possibly be in core.
6 import 'dart:async'; 6 import 'dart:async';
7 import "dart:convert"; 7 import "dart:convert";
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import "package:crypto/crypto.dart"; 10 import "package:crypto/crypto.dart";
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 }, onError: (error, [stackTrace]) { 514 }, onError: (error, [stackTrace]) {
515 // If the error came after values, it's OK. 515 // If the error came after values, it's OK.
516 if (completer.isCompleted) { 516 if (completer.isCompleted) {
517 controller.addError(error, stackTrace); 517 controller.addError(error, stackTrace);
518 return; 518 return;
519 } 519 }
520 520
521 // Otherwise, the error came first and the stream is invalid. 521 // Otherwise, the error came first and the stream is invalid.
522 completer.completeError(error, stackTrace); 522 completer.completeError(error, stackTrace);
523 523
524 // We don't be returning the stream at all in this case, so unsubscribe 524 // We won't be returning the stream at all in this case, so unsubscribe
525 // and swallow the error. 525 // and swallow the error.
526 subscription.cancel(); 526 subscription.cancel();
527 }, onDone: () { 527 }, onDone: () {
528 // It closed with no errors, so the stream is valid. 528 // It closed with no errors, so the stream is valid.
529 if (!completer.isCompleted) completer.complete(controller.stream); 529 if (!completer.isCompleted) completer.complete(controller.stream);
530 controller.close(); 530 controller.close();
531 }); 531 });
532 532
533 return completer.future; 533 return completer.future;
534 } 534 }
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } else { 940 } else {
941 throw new ApplicationException(message); 941 throw new ApplicationException(message);
942 } 942 }
943 } 943 }
944 944
945 /// Throw a [DataException] with [message] to indicate that the command has 945 /// Throw a [DataException] with [message] to indicate that the command has
946 /// failed because of invalid input data. 946 /// failed because of invalid input data.
947 /// 947 ///
948 /// This will report the error and cause pub to exit with [exit_codes.DATA]. 948 /// This will report the error and cause pub to exit with [exit_codes.DATA].
949 void dataError(String message) => throw new DataException(message); 949 void dataError(String message) => throw new DataException(message);
OLDNEW
« no previous file with comments | « lib/src/command/serve.dart ('k') | test/serve/caches_unchanged_assets.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698