set read/write buffer and enable nagle's algorithm for testing

This commit is contained in:
WeidiDeng 2025-04-18 08:21:55 +08:00
parent 0b2802faa4
commit 8690157240
No known key found for this signature in database
GPG Key ID: 25F87CE1741EC7CD

View File

@ -276,6 +276,18 @@ func (h *HTTPTransport) NewTransport(caddyCtx caddy.Context) (*http.Transport, e
return nil, DialError{err}
}
// set read/write buffer, enable nagle's algorithm
if srb, ok := conn.(interface{ SetReadBuffer(int) error }); ok {
_ = srb.SetReadBuffer(4096)
}
if swb, ok := conn.(interface{ SetWriteBuffer(int) error }); ok {
_ = swb.SetWriteBuffer(4096)
}
if snd, ok := conn.(interface{ SetNoDelay(bool) error }); ok {
_ = snd.SetNoDelay(false)
}
if h.ProxyProtocol != "" {
proxyProtocolInfo, ok := caddyhttp.GetVar(ctx, proxyProtocolInfoVarKey).(ProxyProtocolInfo)
if !ok {