Skip to content

Commit d5e518c

Browse files
committed
feat: 支持桥接 ASGIApplication 应用(实验性内容)
1 parent c326112 commit d5e518c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

core/web.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import tianxiu2b2t.anyio.streams.proxy as streams_proxy
1212
from tianxiu2b2t.anyio import concurrency
1313
from tianxiu2b2t.utils import runtime
14+
from tianxiu2b2t.http.asgi import ASGIApplicationBridge, ASGIConfig
1415

1516
from . import utils, abc
1617
from .logger import logger
@@ -131,9 +132,14 @@ async def serve(
131132
):
132133
async with listener:
133134
logger.tinfo("web.forward.pub_port", port=pub_port)
134-
#if not cfg.bridge_web_application:
135-
await listener.serve(pub_handler)
136-
#return
135+
if not cfg.bridge_web_application:
136+
await listener.serve(pub_handler)
137+
async with ASGIApplicationBridge(
138+
ASGIConfig(
139+
app,
140+
)
141+
) as bridge:
142+
await bridge.serve(listener)
137143

138144
async def pub_handler(
139145
sock: streams.BufferedByteStream,

requirements.txt

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)