mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-04-22 23:27:15 +08:00
chore: check sc-max-each-post-bytes greater than zero if set
This commit is contained in:
@@ -136,9 +136,6 @@ func NewClient(cfg *Config, makeTransport TransportMaker, makeDownloadTransport
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if scMaxEachPostBytes.Max == 0 { // default to 1MB
|
||||
scMaxEachPostBytes.Max = 1000000
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
client := &Client{
|
||||
|
||||
@@ -114,6 +114,9 @@ func (c *Config) GetNormalizedScMaxEachPostBytes() (Range, error) {
|
||||
if err != nil {
|
||||
return Range{}, fmt.Errorf("invalid sc-max-each-post-bytes: %w", err)
|
||||
}
|
||||
if r.Max == 0 {
|
||||
return Range{}, fmt.Errorf("invalid sc-max-each-post-bytes: must be greater than zero")
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -110,9 +110,6 @@ func NewServerHandler(opt ServerOption) (http.Handler, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if scMaxEachPostBytes.Max == 0 { // default to 1MB
|
||||
scMaxEachPostBytes.Max = 1000000
|
||||
}
|
||||
scStreamUpServerSecs, err := opt.Config.GetNormalizedScStreamUpServerSecs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user