|
@@ -21,8 +21,24 @@ const (
|
21
|
21
|
maxProxyLineLen = 107
|
22
|
22
|
)
|
23
|
23
|
|
|
24
|
+// XXX implement net.Error with a Temporary() method that returns true;
|
|
25
|
+// otherwise, ErrBadProxyLine will cause (*http.Server).Serve() to exit
|
|
26
|
+type proxyLineError struct{}
|
|
27
|
+
|
|
28
|
+func (p *proxyLineError) Error() string {
|
|
29
|
+ return "invalid PROXY line"
|
|
30
|
+}
|
|
31
|
+
|
|
32
|
+func (p *proxyLineError) Timeout() bool {
|
|
33
|
+ return false
|
|
34
|
+}
|
|
35
|
+
|
|
36
|
+func (p *proxyLineError) Temporary() bool {
|
|
37
|
+ return true
|
|
38
|
+}
|
|
39
|
+
|
24
|
40
|
var (
|
25
|
|
- ErrBadProxyLine = errors.New("invalid PROXY line")
|
|
41
|
+ ErrBadProxyLine error = &proxyLineError{}
|
26
|
42
|
// TODO(golang/go#4373): replace this with the stdlib ErrNetClosing
|
27
|
43
|
ErrNetClosing = errors.New("use of closed network connection")
|
28
|
44
|
)
|