From 583bb4a63f726745199b596fb1fab86861731e16 Mon Sep 17 00:00:00 2001 From: Omoeba <38597972+Omoeba@users.noreply.github.com> Date: Mon, 22 Jun 2026 11:51:47 -0700 Subject: [PATCH] XHTTP server: Fix `scStreamUpServerSecs` when `xPaddingObfsMode` is true (#6343) https://github.com/XTLS/Xray-core/pull/6343#issuecomment-4771666966 --- transport/internet/splithttp/hub.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/transport/internet/splithttp/hub.go b/transport/internet/splithttp/hub.go index a28866cf9..8416591a2 100644 --- a/transport/internet/splithttp/hub.go +++ b/transport/internet/splithttp/hub.go @@ -146,6 +146,7 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req writer.WriteHeader(http.StatusBadRequest) return } + obfsPaddingAccepted := h.config.XPaddingObfsMode && paddingValue != "" sessionId, seqStr := h.config.ExtractMetaFromRequest(request, h.path) @@ -215,8 +216,8 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req writer.Header().Set("Cache-Control", "no-store") writer.WriteHeader(http.StatusOK) scStreamUpServerSecs := h.config.GetNormalizedScStreamUpServerSecs() - referrer := request.Header.Get("Referer") - if referrer != "" && scStreamUpServerSecs.To > 0 { + hasLegacyRefererCompatMarker := request.Header.Get("Referer") != "" + if (hasLegacyRefererCompatMarker || obfsPaddingAccepted) && scStreamUpServerSecs.To > 0 { go func() { for { _, err := httpSC.Write(bytes.Repeat([]byte{'X'}, int(h.config.GetNormalizedXPaddingBytes().rand())))