@@ -141,26 +141,29 @@ private async Task handleClient(ExplicitProxyEndPoint endPoint, TcpClientConnect
141
141
142
142
bool http2Supported = false ;
143
143
144
- var alpn = clientHelloInfo . GetAlpn ( ) ;
145
- if ( alpn != null && alpn . Contains ( SslApplicationProtocol . Http2 ) )
144
+ if ( EnableHttp2 )
146
145
{
147
- // test server HTTP/2 support
148
- try
149
- {
150
- // todo: this is a hack, because Titanium does not support HTTP protocol changing currently
151
- var connection = await tcpConnectionFactory . GetServerConnection ( this , connectArgs ,
152
- true , SslExtensions . Http2ProtocolAsList ,
153
- true , cancellationToken ) ;
154
-
155
- http2Supported = connection . NegotiatedApplicationProtocol ==
156
- SslApplicationProtocol . Http2 ;
157
-
158
- // release connection back to pool instead of closing when connection pool is enabled.
159
- await tcpConnectionFactory . Release ( connection , true ) ;
160
- }
161
- catch ( Exception )
146
+ var alpn = clientHelloInfo . GetAlpn ( ) ;
147
+ if ( alpn != null && alpn . Contains ( SslApplicationProtocol . Http2 ) )
162
148
{
163
- // ignore
149
+ // test server HTTP/2 support
150
+ try
151
+ {
152
+ // todo: this is a hack, because Titanium does not support HTTP protocol changing currently
153
+ var connection = await tcpConnectionFactory . GetServerConnection ( this , connectArgs ,
154
+ true , SslExtensions . Http2ProtocolAsList ,
155
+ true , cancellationToken ) ;
156
+
157
+ http2Supported = connection . NegotiatedApplicationProtocol ==
158
+ SslApplicationProtocol . Http2 ;
159
+
160
+ // release connection back to pool instead of closing when connection pool is enabled.
161
+ await tcpConnectionFactory . Release ( connection , true ) ;
162
+ }
163
+ catch ( Exception )
164
+ {
165
+ // ignore
166
+ }
164
167
}
165
168
}
166
169
@@ -274,7 +277,7 @@ private async Task handleClient(ExplicitProxyEndPoint endPoint, TcpClientConnect
274
277
// If we detected that client tunnel CONNECTs without SSL by checking for empty client hello then
275
278
// this connection should not be HTTPS.
276
279
var connection = await tcpConnectionFactory . GetServerConnection ( this , connectArgs ,
277
- true , SslExtensions . Http2ProtocolAsList ,
280
+ true , null ,
278
281
true , cancellationToken ) ;
279
282
280
283
try
0 commit comments