mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
SplitHTTP server: add ok padding (#3614)
This commit is contained in:
parent
4c82ef8a1b
commit
4b7947cca9
5 changed files with 80 additions and 43 deletions
|
@ -124,6 +124,7 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
|||
|
||||
currentSession := h.upsertSession(sessionId)
|
||||
scMaxEachPostBytes := int(h.ln.config.GetNormalizedScMaxEachPostBytes().To)
|
||||
responseOkPadding := h.ln.config.GetNormalizedResponseOkPadding()
|
||||
|
||||
if request.Method == "POST" {
|
||||
seq := ""
|
||||
|
@ -192,6 +193,10 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
|||
// send a chunk immediately to enable CDN streaming.
|
||||
// many CDN buffer the response headers until the origin starts sending
|
||||
// the body, with no way to turn it off.
|
||||
padding := int(responseOkPadding.roll())
|
||||
for i := 0; i < padding; i++ {
|
||||
writer.Write([]byte("o"))
|
||||
}
|
||||
writer.Write([]byte("ok"))
|
||||
responseFlusher.Flush()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue