File tree Expand file tree Collapse file tree 3 files changed +13
-21
lines changed Expand file tree Collapse file tree 3 files changed +13
-21
lines changed Original file line number Diff line number Diff line change 1
1
import HTTP
2
2
import NIOCore
3
3
import NIOPosix
4
- import NIOHTTP1
4
+ import NIOHTTP2
5
5
import NIOSSL
6
6
7
7
public
@@ -30,19 +30,14 @@ extension HTTPServerDelegate
30
30
{
31
31
( channel: any Channel ) -> EventLoopFuture < Void > in
32
32
33
- let endpoint : ServerInterfaceHandler < Authority , Self > = . init(
34
- address: channel. remoteAddress,
35
- server: self )
36
-
37
-
38
- return channel. pipeline. addHandler ( NIOSSLServerHandler . init (
39
- context: authority. tls) )
40
- . flatMap
33
+ channel. pipeline. addHandler ( NIOSSLServerHandler . init ( context: authority. tls) )
34
+ . flatMap
41
35
{
42
- channel. pipeline. configureHTTPServerPipeline ( withErrorHandling: true )
43
- . flatMap
36
+ channel. configureCommonHTTPServerPipeline
44
37
{
45
- channel. pipeline. addHandler ( endpoint)
38
+ $0. pipeline. addHandler ( ServerInterfaceHandler < Authority , Self > . init (
39
+ address: channel. remoteAddress,
40
+ server: self ) )
46
41
}
47
42
}
48
43
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -29,9 +29,13 @@ extension Server.Options.Authority
29
29
let privateKey : NIOSSLPrivateKey =
30
30
try . init( file: " \( directory) /privkey.pem " , format: . pem)
31
31
32
- let niossl : NIOSSLContext = try . init ( configuration : . makeServerConfiguration(
32
+ var configuration : TLSConfiguration = . makeServerConfiguration(
33
33
certificateChain: certificates. map ( NIOSSLCertificateSource . certificate ( _: ) ) ,
34
- privateKey: . privateKey( privateKey) ) )
34
+ privateKey: . privateKey( privateKey) )
35
+
36
+ configuration. applicationProtocols = [ " h2 " , " http/1.1 " ]
37
+
38
+ let niossl : NIOSSLContext = try . init( configuration: configuration)
35
39
36
40
switch self
37
41
{
You can’t perform that action at this time.
0 commit comments