mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
SplitHTTP: More range options, change defaults, enforce maxUploadSize, fix querystring behavior (#3603)
* maxUploadSize and maxConcurrentUploads can now be ranges on the client * maxUploadSize is now enforced on the server * the default of maxUploadSize is 2MB on the server, and 1MB on the client * the default of maxConcurrentUploads is 200 on the server, and 100 on the client * ranges on the server are treated as a single number. if server is configured as `"1-2"`, server will enforce `2` * querystrings in `path` are now handled correctly
This commit is contained in:
parent
4cb2a128db
commit
59f6685774
8 changed files with 223 additions and 82 deletions
|
@ -181,8 +181,8 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
transportConfiguration := streamSettings.ProtocolSettings.(*Config)
|
||||
tlsConfig := tls.ConfigFromStreamSettings(streamSettings)
|
||||
|
||||
maxConcurrentUploads := transportConfiguration.GetNormalizedMaxConcurrentUploads()
|
||||
maxUploadSize := transportConfiguration.GetNormalizedMaxUploadSize()
|
||||
maxConcurrentUploads := transportConfiguration.GetNormalizedMaxConcurrentUploads(false)
|
||||
maxUploadSize := transportConfiguration.GetNormalizedMaxUploadSize(false)
|
||||
minUploadInterval := transportConfiguration.GetNormalizedMinUploadInterval()
|
||||
|
||||
if tlsConfig != nil {
|
||||
|
@ -194,18 +194,17 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
if requestURL.Host == "" {
|
||||
requestURL.Host = dest.NetAddr()
|
||||
}
|
||||
requestURL.Path = transportConfiguration.GetNormalizedPath()
|
||||
|
||||
sessionIdUuid := uuid.New()
|
||||
requestURL.Path = transportConfiguration.GetNormalizedPath(sessionIdUuid.String(), true)
|
||||
baseURL := requestURL.String()
|
||||
|
||||
httpClient := getHTTPClient(ctx, dest, streamSettings)
|
||||
|
||||
sessionIdUuid := uuid.New()
|
||||
sessionId := sessionIdUuid.String()
|
||||
baseURL := requestURL.String() + sessionId
|
||||
|
||||
uploadPipeReader, uploadPipeWriter := pipe.New(pipe.WithSizeLimit(maxUploadSize))
|
||||
uploadPipeReader, uploadPipeWriter := pipe.New(pipe.WithSizeLimit(maxUploadSize.roll()))
|
||||
|
||||
go func() {
|
||||
requestsLimiter := semaphore.New(int(maxConcurrentUploads))
|
||||
requestsLimiter := semaphore.New(int(maxConcurrentUploads.roll()))
|
||||
var requestCounter int64
|
||||
|
||||
lastWrite := time.Now()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue