| Index: sdk/lib/io/http_impl.dart
|
| diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
|
| index c78348120f47f71707b21bc1294a9265091b81a1..a5a830885fae8c3eaba31d4166d27c5dd3ada7b4 100644
|
| --- a/sdk/lib/io/http_impl.dart
|
| +++ b/sdk/lib/io/http_impl.dart
|
| @@ -925,13 +925,29 @@ class _RequestHandlerRegistration {
|
|
|
| // HTTP server waiting for socket connections. The connections are
|
| // managed by the server and as requests are received the request.
|
| -class _HttpServer implements HttpServer {
|
| - _HttpServer() : _connections = new Set<_HttpConnection>(),
|
| - _handlers = new List<_RequestHandlerRegistration>(),
|
| - _closeQueue = new _CloseQueue();
|
| -
|
| - void listen(String host, int port, {int backlog: 128}) {
|
| - listenOn(new ServerSocket(host, port, backlog));
|
| +// HTTPS connections are also supported, if the _HttpServer.httpsServer
|
| +// constructor is used and a certificate name is provided in listen,
|
| +// or a SecureServerSocket is provided to listenOn.
|
| +class _HttpServer implements HttpServer, HttpsServer {
|
| + _HttpServer() : this._internal(isSecure: false);
|
| +
|
| + _HttpServer.httpsServer() : this._internal(isSecure: true);
|
| +
|
| + _HttpServer._internal({ bool isSecure: false })
|
| + : _secure = isSecure,
|
| + _connections = new Set<_HttpConnection>(),
|
| + _handlers = new List<_RequestHandlerRegistration>(),
|
| + _closeQueue = new _CloseQueue();
|
| +
|
| + void listen(String host,
|
| + int port,
|
| + {int backlog: 128,
|
| + String certificate_name}) {
|
| + if (_secure) {
|
| + listenOn(new SecureServerSocket(host, port, backlog, certificate_name));
|
| + } else {
|
| + listenOn(new ServerSocket(host, port, backlog));
|
| + }
|
| _closeServer = true;
|
| }
|
|
|
| @@ -1051,6 +1067,7 @@ class _HttpServer implements HttpServer {
|
|
|
| ServerSocket _server; // The server listen socket.
|
| bool _closeServer = false;
|
| + bool _secure;
|
| Set<_HttpConnection> _connections; // Set of currently connected clients.
|
| List<_RequestHandlerRegistration> _handlers;
|
| Object _defaultHandler;
|
|
|