Enforce a 4K limit for HTTP/3, like HTTP/2
This commit is contained in:
parent
9cf4bb6822
commit
ade0c1d682
2 changed files with 9 additions and 3 deletions
|
|
@ -33,7 +33,8 @@ type CryptoConstruct
|
|||
)
|
||||
|
||||
const (
|
||||
MaxHTTPBodyLength = 1000000
|
||||
MaxHTTPBodyLength = 1000000
|
||||
MaxHTTPResponseHeaderBytes = 4096
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue