Skip to content

Commit

Permalink
SplitHTTP server: Only "ok" to older clients (#3671)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmray authored Aug 10, 2024
1 parent a3b306a commit 513182a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions transport/internet/splithttp/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,15 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
h.config.WriteResponseHeader(writer)

writer.WriteHeader(http.StatusOK)
// in earlier versions, this initial body data was used to immediately
// start a 200 OK on all CDN. but xray client since 1.8.16 does not
// actually require an immediate 200 OK, but now requires these
// additional bytes "ok". xray client 1.8.24+ doesn't require "ok"
// anymore, and so this line should be removed in later versions.
writer.Write([]byte("ok"))
if _, ok := request.URL.Query()["x_padding"]; !ok {
// in earlier versions, this initial body data was used to immediately
// start a 200 OK on all CDN. but xray client since 1.8.16 does not
// actually require an immediate 200 OK, but now requires these
// additional bytes "ok". xray client 1.8.24+ doesn't require "ok"
// anymore, and so this line should be removed in later versions.
writer.Write([]byte("ok"))
}

responseFlusher.Flush()

downloadDone := done.New()
Expand Down

0 comments on commit 513182a

Please sign in to comment.