proxy: recognize client's cancellation

fix issue #1589

Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
Tw
2017-04-19 22:56:51 +08:00
parent 705cb98865
commit 0146bb4e49
7 changed files with 87 additions and 41 deletions

View File

@@ -8,6 +8,7 @@ var (
_ error = NonHijackerError{}
_ error = NonFlusherError{}
_ error = NonCloseNotifierError{}
_ error = NonPusherError{}
)
// NonHijackerError is more descriptive error caused by a non hijacker
@@ -42,3 +43,14 @@ type NonCloseNotifierError struct {
func (c NonCloseNotifierError) Error() string {
return fmt.Sprintf("%T is not a closeNotifier", c.Underlying)
}
// NonPusherError is more descriptive error caused by a non pusher
type NonPusherError struct {
// underlying type which doesn't implement pusher
Underlying interface{}
}
// Implement Error
func (c NonPusherError) Error() string {
return fmt.Sprintf("%T is not a pusher", c.Underlying)
}