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

Unified Diff: lib/multiprotocol_server.dart

Issue 1645993002: Allow users of MultiProtocolHttpServer to pass http.ServerSettings (Closed) Base URL: git@github.com:dart-lang/http2.git@master
Patch Set: Created 4 years, 11 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 | « CHANGELOG.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/multiprotocol_server.dart
diff --git a/lib/multiprotocol_server.dart b/lib/multiprotocol_server.dart
index 72d91a406aa7ca4a168de73cb301ee6e6a9ae649..2d16f965c88fe22143a0539054516be5293e35f7 100644
--- a/lib/multiprotocol_server.dart
+++ b/lib/multiprotocol_server.dart
@@ -21,6 +21,7 @@ import 'src/artificial_server_socket.dart';
/// * one handles HTTP/2 clients (called with a [http2.ServerTransportStream])
class MultiProtocolHttpServer {
final SecureServerSocket _serverSocket;
+ final http2.ServerSettings _settings;
_ServerSocketController _http11Controller;
HttpServer _http11Server;
@@ -29,7 +30,7 @@ class MultiProtocolHttpServer {
Stream<http2.ServerTransportStream> _http2Server;
Set<http2.ServerTransportConnection> _http2Connections = new Set();
- MultiProtocolHttpServer._(this._serverSocket) {
+ MultiProtocolHttpServer._(this._serverSocket, this._settings) {
_http11Controller = new _ServerSocketController(
_serverSocket.address, _serverSocket.port);
_http11Server = new HttpServer.listenOn(_http11Controller.stream);
@@ -42,13 +43,16 @@ class MultiProtocolHttpServer {
/// [address] (see [SecureServerSocket.bind] for a description of supported
/// types for [address]).
///
+ /// Optionally [settings] can be supplied which will be used for HTTP/2
+ /// clients.
+ ///
/// See also [startServing].
- static Future<MultiProtocolHttpServer> bind(address,
- int port,
- SecurityContext context) async {
+ static Future<MultiProtocolHttpServer> bind(
+ address, int port, SecurityContext context,
+ {http2.ServerSettings settings}) async {
context.setAlpnProtocols(['h2', 'http/1.1'], true);
var secureServer = await SecureServerSocket.bind(address, port, context);
- return new MultiProtocolHttpServer._(secureServer);
+ return new MultiProtocolHttpServer._(secureServer, settings);
}
/// The port this multi-protocol HTTP server runs on.
@@ -71,7 +75,8 @@ class MultiProtocolHttpServer {
if (protocol == null || protocol == 'http/1.1') {
_http11Controller.addHttp11Socket(socket);
} else if (protocol == 'h2') {
- var connection = new http2.ServerTransportConnection.viaSocket(socket);
+ var connection = new http2.ServerTransportConnection.viaSocket(
+ socket, settings: _settings);
_http2Connections.add(connection);
connection.incomingStreams.listen(
_http2Controller.add,
« no previous file with comments | « CHANGELOG.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698