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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 1319703002: Breaking Change: merge BoringSSL branch into master (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « sdk/lib/io/http.dart ('k') | sdk/lib/io/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 49b6c7b46fc8f947dbb8b7ea43588e86c1d33f0b..880d771a6af82c11f95d3160ce67e8236d8d43ed 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -1256,6 +1256,7 @@ class _HttpClientConnection {
final String key;
final Socket _socket;
final bool _proxyTunnel;
+ final SecurityContext _context;
final _HttpParser _httpParser;
StreamSubscription _subscription;
final _HttpClient _httpClient;
@@ -1268,7 +1269,7 @@ class _HttpClientConnection {
Future _streamFuture;
_HttpClientConnection(this.key, this._socket, this._httpClient,
- [this._proxyTunnel = false])
+ [this._proxyTunnel = false, this._context])
: _httpParser = new _HttpParser.responseParser() {
_httpParser.listenToStream(_socket);
@@ -1496,7 +1497,10 @@ class _HttpClientConnection {
}
var socket = response._httpRequest._httpClientConnection._socket;
return SecureSocket.secure(
- socket, host: host, onBadCertificate: callback);
+ socket,
+ host: host,
+ context: _context,
+ onBadCertificate: callback);
})
.then((secureSocket) {
String key = _HttpClientConnection.makeKey(true, host, port);
@@ -1543,12 +1547,17 @@ class _ConnectionTarget {
final String host;
final int port;
final bool isSecure;
+ final SecurityContext context;
final Set<_HttpClientConnection> _idle = new HashSet();
final Set<_HttpClientConnection> _active = new HashSet();
final Queue _pending = new ListQueue();
int _connecting = 0;
- _ConnectionTarget(this.key, this.host, this.port, this.isSecure);
+ _ConnectionTarget(this.key,
+ this.host,
+ this.port,
+ this.isSecure,
+ this.context);
bool get isEmpty => _idle.isEmpty && _active.isEmpty && _connecting == 0;
@@ -1620,12 +1629,13 @@ class _ConnectionTarget {
return completer.future;
}
var currentBadCertificateCallback = client._badCertificateCallback;
- bool callback(X509Certificate certificate) =>
+ callback(X509Certificate certificate) =>
currentBadCertificateCallback == null ? false :
currentBadCertificateCallback(certificate, uriHost, uriPort);
Future socketFuture = (isSecure && proxy.isDirect
? SecureSocket.connect(host,
port,
+ context: context,
sendClientCertificate: true,
onBadCertificate: callback)
: Socket.connect(host, port));
@@ -1633,7 +1643,8 @@ class _ConnectionTarget {
return socketFuture.then((socket) {
_connecting--;
socket.setOption(SocketOption.TCP_NODELAY, true);
- var connection = new _HttpClientConnection(key, socket, client);
+ var connection =
+ new _HttpClientConnection(key, socket, client, false, context);
if (isSecure && !proxy.isDirect) {
connection._dispose = true;
return connection.createProxyTunnel(uriHost, uriPort, proxy, callback)
@@ -1662,6 +1673,7 @@ class _HttpClient implements HttpClient {
= new HashMap<String, _ConnectionTarget>();
final List<_Credentials> _credentials = [];
final List<_ProxyCredentials> _proxyCredentials = [];
+ final SecurityContext _context;
Function _authenticate;
Function _authenticateProxy;
Function _findProxy = HttpClient.findProxyFromEnvironment;
@@ -1676,6 +1688,8 @@ class _HttpClient implements HttpClient {
String userAgent = _getHttpVersion();
+ _HttpClient(SecurityContext this._context);
+
void set idleTimeout(Duration timeout) {
_idleTimeout = timeout;
for (var c in _connectionTargets.values) {
@@ -1894,8 +1908,9 @@ class _HttpClient implements HttpClient {
_ConnectionTarget _getConnectionTarget(String host, int port, bool isSecure) {
String key = _HttpClientConnection.makeKey(isSecure, host, port);
- return _connectionTargets.putIfAbsent(
- key, () => new _ConnectionTarget(key, host, port, isSecure));
+ return _connectionTargets.putIfAbsent(key, () {
+ return new _ConnectionTarget(key, host, port, isSecure, _context);
+ });
}
// Get a new _HttpClientConnection, from the matching _ConnectionTarget.
@@ -2207,6 +2222,7 @@ class _HttpServer
static Future<HttpServer> bindSecure(address,
int port,
+ SecurityContext context,
int backlog,
bool v6Only,
String certificate_name,
@@ -2215,7 +2231,7 @@ class _HttpServer
return SecureServerSocket.bind(
address,
port,
- certificate_name,
+ context,
backlog: backlog,
v6Only: v6Only,
requestClientCertificate: requestClientCertificate,
« no previous file with comments | « sdk/lib/io/http.dart ('k') | sdk/lib/io/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698