mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-14 23:38:40 +00:00
SplitHTTP: Rename three options & Reduce server defaults (#3611)
* maxUploadSize -> scMaxEachPostBytes, default is 1MB on both sides (was 2MB on the server) * minUploadIntervalMs -> scMinPostsIntervalMs, default is 30ms on the client (no server support for now) * maxConcurrentUploads -> scMaxConcurrentPosts, default is 100 on both sides (was 200 on the server)
This commit is contained in:
parent
33daa0c94b
commit
30af792777
6 changed files with 85 additions and 99 deletions
|
@ -76,7 +76,7 @@ func (h *requestHandler) upsertSession(sessionId string) *httpSession {
|
|||
}
|
||||
|
||||
s := &httpSession{
|
||||
uploadQueue: NewUploadQueue(int(h.ln.config.GetNormalizedMaxConcurrentUploads(true).To)),
|
||||
uploadQueue: NewUploadQueue(int(h.ln.config.GetNormalizedScMaxConcurrentPosts().To)),
|
||||
isFullyConnected: done.New(),
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
|||
}
|
||||
|
||||
currentSession := h.upsertSession(sessionId)
|
||||
maxUploadSize := int(h.ln.config.GetNormalizedMaxUploadSize(true).To)
|
||||
scMaxEachPostBytes := int(h.ln.config.GetNormalizedScMaxEachPostBytes().To)
|
||||
|
||||
if request.Method == "POST" {
|
||||
seq := ""
|
||||
|
@ -139,8 +139,8 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
|||
|
||||
payload, err := io.ReadAll(request.Body)
|
||||
|
||||
if len(payload) > maxUploadSize {
|
||||
errors.LogInfo(context.Background(), "Too large upload. maxUploadSize is set to", maxUploadSize, "but request had size", len(payload), ". Adjust maxUploadSize on the server to be at least as large as client.")
|
||||
if len(payload) > scMaxEachPostBytes {
|
||||
errors.LogInfo(context.Background(), "Too large upload. scMaxEachPostBytes is set to ", scMaxEachPostBytes, "but request had size ", len(payload), ". Adjust scMaxEachPostBytes on the server to be at least as large as client.")
|
||||
writer.WriteHeader(http.StatusRequestEntityTooLarge)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue