Skip to content

Commit

Permalink
SplitHTTP: Remove ok compatibility logic (#3753)
Browse files Browse the repository at this point in the history
Remove some code that was added to maintain compatibility with older
Xray versions. This breaks compatibility with Xray-core v1.8.23 or older.
  • Loading branch information
mmmray authored Sep 3, 2024
1 parent f1c439c commit ab3c00e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 59 deletions.
4 changes: 1 addition & 3 deletions transport/internet/splithttp/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,11 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
}
}()

lazyRawDownload, remoteAddr, localAddr, err := httpClient.OpenDownload(context.WithoutCancel(ctx), requestURL.String())
reader, remoteAddr, localAddr, err := httpClient.OpenDownload(context.WithoutCancel(ctx), requestURL.String())
if err != nil {
return nil, err
}

reader := &stripOkReader{ReadCloser: lazyRawDownload}

writer := uploadWriter{
uploadPipeWriter,
maxUploadSize,
Expand Down
8 changes: 0 additions & 8 deletions transport/internet/splithttp/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,6 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
h.config.WriteResponseHeader(writer)

writer.WriteHeader(http.StatusOK)
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()

Expand Down
48 changes: 0 additions & 48 deletions transport/internet/splithttp/strip_ok_reader.go

This file was deleted.

0 comments on commit ab3c00e

Please sign in to comment.