Skip to content

Commit 21542e2

Browse files
wuzihuipires
authored andcommitted
add SetReadHeaderTimeout
1 parent b718e7c commit 21542e2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

protocol.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ func ValidateHeader(v Validator) func(*Conn) {
6363
}
6464
}
6565

66+
// SetReadHeaderTimeout sets the readHeaderTimeout for a connection when passed as option to NewConn()
67+
func SetReadHeaderTimeout(t time.Duration) func(*Conn) {
68+
return func(c *Conn) {
69+
if t >= 0 {
70+
c.readHeaderTimeout = t
71+
}
72+
}
73+
}
74+
6675
// Accept waits for and returns the next connection to the listener.
6776
func (p *Listener) Accept() (net.Conn, error) {
6877
// Get the underlying connection

0 commit comments

Comments
 (0)