mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 06:36:05 +03:00
SplitHTTP: Fix wrong config deserialization (#3610)
Testing was conducted only using explicit parameters, and using testsuite. However, when the parameters are not explicitly set in JSON config, it seems that `c.MaxUploadSize` will contain `RandRangeConfig { From: 0, To: 0 }` instead of `nil`, which breaks upload entirely.
This commit is contained in:
parent
70383c50cc
commit
33daa0c94b
@ -37,7 +37,7 @@ func (c *Config) GetRequestHeader() http.Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) GetNormalizedMaxConcurrentUploads(isServer bool) RandRangeConfig {
|
func (c *Config) GetNormalizedMaxConcurrentUploads(isServer bool) RandRangeConfig {
|
||||||
if c.MaxConcurrentUploads == nil {
|
if c.MaxConcurrentUploads == nil || c.MaxConcurrentUploads.To == 0 {
|
||||||
if isServer {
|
if isServer {
|
||||||
return RandRangeConfig{
|
return RandRangeConfig{
|
||||||
From: 200,
|
From: 200,
|
||||||
@ -55,7 +55,7 @@ func (c *Config) GetNormalizedMaxConcurrentUploads(isServer bool) RandRangeConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) GetNormalizedMaxUploadSize(isServer bool) RandRangeConfig {
|
func (c *Config) GetNormalizedMaxUploadSize(isServer bool) RandRangeConfig {
|
||||||
if c.MaxUploadSize == nil {
|
if c.MaxUploadSize == nil || c.MaxUploadSize.To == 0 {
|
||||||
if isServer {
|
if isServer {
|
||||||
return RandRangeConfig{
|
return RandRangeConfig{
|
||||||
From: 2000000,
|
From: 2000000,
|
||||||
@ -73,7 +73,7 @@ func (c *Config) GetNormalizedMaxUploadSize(isServer bool) RandRangeConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) GetNormalizedMinUploadInterval() RandRangeConfig {
|
func (c *Config) GetNormalizedMinUploadInterval() RandRangeConfig {
|
||||||
if c.MinUploadIntervalMs == nil {
|
if c.MinUploadIntervalMs == nil || c.MinUploadIntervalMs.To == 0 {
|
||||||
return RandRangeConfig{
|
return RandRangeConfig{
|
||||||
From: 30,
|
From: 30,
|
||||||
To: 30,
|
To: 30,
|
||||||
|
Loading…
Reference in New Issue
Block a user