Fix Close connection for invalid header
RemoteAddr() must close the connection and clear the buffer if we receive a invalid PROXY protocol header. Change the client test as it can get an EOF or a ECONNRESET.
This commit is contained in:
@@ -110,6 +110,8 @@ func (p *Conn) RemoteAddr() net.Addr {
|
||||
p.once.Do(func() {
|
||||
if err := p.checkPrefix(); err != nil && err != io.EOF {
|
||||
log.Printf("[ERR] Failed to read proxy prefix: %v", err)
|
||||
p.Close()
|
||||
p.bufReader = bufio.NewReader(p.conn)
|
||||
}
|
||||
})
|
||||
if p.srcAddr != nil {
|
||||
|
||||
Reference in New Issue
Block a user