Skip to content

Commit ade0c1d

Browse files
committed
Enforce a 4K limit for HTTP/3, like HTTP/2
1 parent 9cf4bb6 commit ade0c1d

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎dnscrypt-proxy/common.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const (
3333
)
3434

3535
const (
36-
MaxHTTPBodyLength = 1000000
36+
MaxHTTPBodyLength = 1000000
37+
MaxHTTPResponseHeaderBytes = 4096
3738
)
3839

3940
var (

‎dnscrypt-proxy/xtransport.go‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func (xTransport *XTransport) rebuildTransport() {
295295
IdleConnTimeout: DefaultIdleConnTimeout,
296296
ResponseHeaderTimeout: timeout,
297297
ExpectContinueTimeout: timeout,
298-
MaxResponseHeaderBytes: 4096,
298+
MaxResponseHeaderBytes: MaxHTTPResponseHeaderBytes,
299299
DialContext: func(ctx context.Context, network, addrStr string) (net.Conn, error) {
300300
host, port := ExtractHostAndPort(addrStr, stamps.DefaultPort)
301301
formatEndpoint := func(ip net.IP) string {
@@ -500,7 +500,12 @@ func (xTransport *XTransport) rebuildTransport() {
500500
}
501501
return nil, lastErr
502502
}
503-
h3Transport := &http3.Transport{DisableCompression: true, TLSClientConfig: &tlsClientConfig, Dial: dial}
503+
h3Transport := &http3.Transport{
504+
DisableCompression: true,
505+
TLSClientConfig: &tlsClientConfig,
506+
MaxResponseHeaderBytes: MaxHTTPResponseHeaderBytes,
507+
Dial: dial,
508+
}
504509
xTransport.h3Transport = h3Transport
505510
}
506511
}

0 commit comments

Comments
 (0)