mirror of
https://github.com/ergochat/ergo.git
synced 2025-01-03 16:42:38 +01:00
Merge pull request #1269 from slingamn/websocket_proxy
fix websocket listeners with proxy-before-TLS closing on bad PROXY lines
This commit is contained in:
commit
3ed047ccb8
@ -21,8 +21,24 @@ const (
|
|||||||
maxProxyLineLen = 107
|
maxProxyLineLen = 107
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// XXX implement net.Error with a Temporary() method that returns true;
|
||||||
|
// otherwise, ErrBadProxyLine will cause (*http.Server).Serve() to exit
|
||||||
|
type proxyLineError struct{}
|
||||||
|
|
||||||
|
func (p *proxyLineError) Error() string {
|
||||||
|
return "invalid PROXY line"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *proxyLineError) Timeout() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *proxyLineError) Temporary() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrBadProxyLine = errors.New("invalid PROXY line")
|
ErrBadProxyLine error = &proxyLineError{}
|
||||||
// TODO(golang/go#4373): replace this with the stdlib ErrNetClosing
|
// TODO(golang/go#4373): replace this with the stdlib ErrNetClosing
|
||||||
ErrNetClosing = errors.New("use of closed network connection")
|
ErrNetClosing = errors.New("use of closed network connection")
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user