1111import tianxiu2b2t .anyio .streams .proxy as streams_proxy
1212from tianxiu2b2t .anyio import concurrency
1313from tianxiu2b2t .utils import runtime
14+ from tianxiu2b2t .http .asgi import ASGIApplicationBridge
1415
1516from . import utils , abc
1617from .logger import logger
@@ -118,7 +119,7 @@ async def pub_listener(
118119 )
119120
120121 tls_listener = streams .AutoTLSListener (
121- streams_proxy .ProxyProtocolV2Listener (
122+ streams_proxy .ProxyProtocolMixedListener (
122123 streams .FixedSocketListener (
123124 listener
124125 ),
@@ -131,7 +132,13 @@ async def serve(
131132):
132133 async with listener :
133134 logger .tinfo ("web.forward.pub_port" , port = pub_port )
134- await listener .serve (pub_handler )
135+ if not cfg .bridge_web_application :
136+ await listener .serve (pub_handler )
137+ return
138+ await ASGIApplicationBridge (
139+ app ,
140+ listener ,
141+ ).serve ()
135142
136143async def pub_handler (
137144 sock : streams .BufferedByteStream ,
@@ -253,6 +260,8 @@ async def setup(
253260 context .check_hostname = False
254261 context .hostname_checks_common_name = False
255262 context .verify_mode = ssl .CERT_NONE
263+ if cfg .bridge_web_application :
264+ context .set_alpn_protocols (["h2" , "http/1.1" ])
256265
257266 for domain in cert .domains :
258267 tls_listener .add_context (
0 commit comments