diff --git a/dnscrypt-proxy/common.go b/dnscrypt-proxy/common.go index a2de2b2e..a2f278ef 100644 --- a/dnscrypt-proxy/common.go +++ b/dnscrypt-proxy/common.go @@ -33,7 +33,8 @@ type CryptoConstruct ) const ( - MaxHTTPBodyLength = 1000000 + MaxHTTPBodyLength = 1000000 + MaxHTTPResponseHeaderBytes = 4096 ) var ( diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index 69077699..b522f0b6 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -295,7 +295,7 @@ func (xTransport *XTransport) rebuildTransport() { IdleConnTimeout: DefaultIdleConnTimeout, ResponseHeaderTimeout: timeout, ExpectContinueTimeout: timeout, - MaxResponseHeaderBytes: 4096, + MaxResponseHeaderBytes: MaxHTTPResponseHeaderBytes, DialContext: func(ctx context.Context, network, addrStr string) (net.Conn, error) { host, port := ExtractHostAndPort(addrStr, stamps.DefaultPort) formatEndpoint := func(ip net.IP) string { @@ -500,7 +500,12 @@ type udpTarget struct { } return nil, lastErr } - h3Transport := &http3.Transport{DisableCompression: true, TLSClientConfig: &tlsClientConfig, Dial: dial} + h3Transport := &http3.Transport{ + DisableCompression: true, + TLSClientConfig: &tlsClientConfig, + MaxResponseHeaderBytes: MaxHTTPResponseHeaderBytes, + Dial: dial, + } xTransport.h3Transport = h3Transport } }