@@ -230,13 +230,14 @@ type SplitHTTPConfig struct {
230230 SeqKey string `json:"seqKey"`
231231 UplinkDataPlacement string `json:"uplinkDataPlacement"`
232232 UplinkDataKey string `json:"uplinkDataKey"`
233- UplinkChunkSize uint32 `json:"uplinkChunkSize"`
233+ UplinkChunkSize Int32Range `json:"uplinkChunkSize"`
234234 NoGRPCHeader bool `json:"noGRPCHeader"`
235235 NoSSEHeader bool `json:"noSSEHeader"`
236236 ScMaxEachPostBytes Int32Range `json:"scMaxEachPostBytes"`
237237 ScMinPostsIntervalMs Int32Range `json:"scMinPostsIntervalMs"`
238238 ScMaxBufferedPosts int64 `json:"scMaxBufferedPosts"`
239239 ScStreamUpServerSecs Int32Range `json:"scStreamUpServerSecs"`
240+ ServerMaxHeaderBytes int32 `json:"serverMaxHeaderBytes"`
240241 Xmux XmuxConfig `json:"xmux"`
241242 DownloadSettings * StreamConfig `json:"downloadSettings"`
242243 Extra json.RawMessage `json:"extra"`
@@ -316,9 +317,9 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
316317
317318 switch c .UplinkDataPlacement {
318319 case "" :
319- c .UplinkDataPlacement = "body"
320- case "body" :
321- case "cookie" , "header" :
320+ c .UplinkDataPlacement = splithttp . PlacementAuto
321+ case splithttp . PlacementAuto , splithttp . PlacementBody :
322+ case splithttp . PlacementCookie , splithttp . PlacementHeader :
322323 if c .Mode != "packet-up" {
323324 return nil , errors .New ("UplinkDataPlacement can be " + c .UplinkDataPlacement + " only in packet-up mode" )
324325 }
@@ -347,9 +348,6 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
347348 case "" :
348349 c .SeqPlacement = "path"
349350 case "path" , "cookie" , "header" , "query" :
350- if c .SessionPlacement == "path" {
351- return nil , errors .New ("SeqPlacement must be path when SessionPlacement is path" )
352- }
353351 default :
354352 return nil , errors .New ("unsupported seq placement: " + c .SeqPlacement )
355353 }
@@ -372,24 +370,17 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
372370 }
373371 }
374372
375- if c .UplinkDataPlacement != "body" && c .UplinkDataKey == "" {
373+ if c .UplinkDataPlacement != splithttp . PlacementBody && c .UplinkDataKey == "" {
376374 switch c .UplinkDataPlacement {
377- case "cookie" :
375+ case splithttp . PlacementCookie :
378376 c .UplinkDataKey = "x_data"
379- case "header" :
377+ case splithttp . PlacementAuto , splithttp . PlacementHeader :
380378 c .UplinkDataKey = "X-Data"
381379 }
382380 }
383381
384- if c .UplinkChunkSize == 0 {
385- switch c .UplinkDataPlacement {
386- case "cookie" :
387- c .UplinkChunkSize = 3 * 1024 // 3KB
388- case "header" :
389- c .UplinkChunkSize = 4 * 1024 // 4KB
390- }
391- } else if c .UplinkChunkSize < 64 {
392- c .UplinkChunkSize = 64
382+ if c .ServerMaxHeaderBytes < 0 {
383+ return nil , errors .New ("invalid negative value of maxHeaderBytes" )
393384 }
394385
395386 if c .Xmux .MaxConnections .To > 0 && c .Xmux .MaxConcurrency .To > 0 {
@@ -422,13 +413,14 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
422413 SeqKey : c .SeqKey ,
423414 UplinkDataPlacement : c .UplinkDataPlacement ,
424415 UplinkDataKey : c .UplinkDataKey ,
425- UplinkChunkSize : c .UplinkChunkSize ,
416+ UplinkChunkSize : newRangeConfig ( c .UplinkChunkSize ) ,
426417 NoGRPCHeader : c .NoGRPCHeader ,
427418 NoSSEHeader : c .NoSSEHeader ,
428419 ScMaxEachPostBytes : newRangeConfig (c .ScMaxEachPostBytes ),
429420 ScMinPostsIntervalMs : newRangeConfig (c .ScMinPostsIntervalMs ),
430421 ScMaxBufferedPosts : c .ScMaxBufferedPosts ,
431422 ScStreamUpServerSecs : newRangeConfig (c .ScStreamUpServerSecs ),
423+ ServerMaxHeaderBytes : c .ServerMaxHeaderBytes ,
432424 Xmux : & splithttp.XmuxConfig {
433425 MaxConcurrency : newRangeConfig (c .Xmux .MaxConcurrency ),
434426 MaxConnections : newRangeConfig (c .Xmux .MaxConnections ),
0 commit comments