mirror of https://github.com/XTLS/Xray-core
test3
parent
898b54b891
commit
014f5e6a09
|
@ -168,21 +168,20 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
||||||
} else {
|
} else {
|
||||||
writer.Header().Set("X-Accel-Buffering", "no")
|
writer.Header().Set("X-Accel-Buffering", "no")
|
||||||
writer.Header().Set("Cache-Control", "no-store")
|
writer.Header().Set("Cache-Control", "no-store")
|
||||||
if !h.config.NoSSEHeader {
|
|
||||||
writer.Header().Set("Content-Type", "text/event-stream")
|
|
||||||
}
|
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
if request.ProtoMajor != 1 && len(clientVer) > 0 && clientVer[0] >= 25 {
|
if request.ProtoMajor != 1 && len(clientVer) > 0 && clientVer[0] >= 25 {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
paddingLen := h.config.GetNormalizedXPaddingBytes().rand()
|
paddingLen := h.config.GetNormalizedXPaddingBytes().rand()
|
||||||
if paddingLen > 0 {
|
if paddingLen <= 0 {
|
||||||
|
writer.(http.Flusher).Flush()
|
||||||
|
break
|
||||||
|
}
|
||||||
_, err := writer.Write(bytes.Repeat([]byte{'0'}, int(paddingLen)))
|
_, err := writer.Write(bytes.Repeat([]byte{'0'}, int(paddingLen)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
writer.(http.Flusher).Flush()
|
writer.(http.Flusher).Flush()
|
||||||
}
|
|
||||||
time.Sleep(time.Duration(RangeConfig{From: 20, To: 80}.rand()) * time.Second)
|
time.Sleep(time.Duration(RangeConfig{From: 20, To: 80}.rand()) * time.Second)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue