Skip to content
Snippets Groups Projects
Commit 0348f2fb authored by nweiz@google.com's avatar nweiz@google.com Committed by Natalie Weizenbaum
Browse files

Properly initialize HTTPS certificates in pub.

Review URL: https://codereview.chromium.org//13947047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@22052 260f80e4-7a28-3924-810f-c04153c831b5
parent aa24a47d
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment