Skip to content

Commit 2eb5da5

Browse files
fix: refine mode and header type handling in subscription inbound data preparation
1 parent 098e784 commit 2eb5da5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/core/hosts.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ async def _prepare_subscription_inbound_data(
118118
# Always create the config, merge host settings with inbound defaults (host overrides inbound)
119119
if network in ("xhttp", "splithttp"):
120120
xs = ts.xhttp_settings if ts else None
121-
mode = inbound_config.get("mode", "") or (xs.mode.value if xs and xs.mode else "auto")
121+
mode = inbound_config.get("mode", "")
122+
if xs:
123+
if xs.mode is None:
124+
mode = inbound_config.get("mode", "")
125+
else:
126+
mode = xs.mode.value
122127
transport_config = XHTTPTransportConfig(
123128
path=path,
124129
host=host_list,
@@ -178,7 +183,13 @@ async def _prepare_subscription_inbound_data(
178183
elif network in ("tcp", "raw", "http", "h2"):
179184
# TCP/HTTP/H2 all use TCP transport
180185
tcps = ts.tcp_settings if ts else None
181-
header_type = inbound_header_type or tcps.header if tcps else inbound_header_type
186+
header_type = inbound_header_type
187+
if tcps:
188+
if tcps.header == "":
189+
header_type = inbound_header_type
190+
else:
191+
header_type = tcps.header
192+
182193
transport_config = TCPTransportConfig(
183194
path=path,
184195
host=host_list,

0 commit comments

Comments
 (0)