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

Unified Diff: sdk/lib/_internal/pub/lib/src/http.dart

Issue 13947047: Properly initialize HTTPS certificates in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/http.dart
diff --git a/sdk/lib/_internal/pub/lib/src/http.dart b/sdk/lib/_internal/pub/lib/src/http.dart
index 8a98313723470ca52668c546223fd4efae25924c..123c20601cae3dd61dfce2ab03c16362308d7e5a 100644
--- a/sdk/lib/_internal/pub/lib/src/http.dart
+++ b/sdk/lib/_internal/pub/lib/src/http.dart
@@ -24,13 +24,21 @@ final HTTP_TIMEOUT = 30 * 1000;
/// Headers and field names that should be censored in the log output.
final _CENSORED_FIELDS = const ['refresh_token', 'authorization'];
+/// Whether dart:io's SecureSocket has been initialized with pub's resources
+/// yet.
+bool _initializedSecureSocket = false;
+
/// An HTTP client that transforms 40* errors and socket exceptions into more
/// user-friendly error messages.
class PubHttpClient extends http.BaseClient {
http.Client inner;
PubHttpClient([http.Client inner])
- : this.inner = inner == null ? new http.Client() : inner;
+ : this.inner = inner == null ? new http.Client() : inner {
+ if (!_initializedSecureSocket) {
+ SecureSocket.initialize(database: resourcePath('certs'));
+ }
+ }
Future<http.StreamedResponse> send(http.BaseRequest request) {
_logRequest(request);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698