backport of commit 742651f2f715af69dda77b8ffb3af3d114e25ac2
This commit is contained in:
parent
525534f1d8
commit
78ce5a7d8a
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
agent: Correct websocket status code handling
|
||||||
|
```
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -671,6 +672,15 @@ func isClosedError(err error) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if the websocket "error" is one of the benign "close" status codes
|
||||||
|
if codedErr, ok := err.(HTTPCodedError); ok {
|
||||||
|
return slices.ContainsFunc([]string{
|
||||||
|
"close 1000", // CLOSE_NORMAL
|
||||||
|
"close 1001", // CLOSE_GOING_AWAY
|
||||||
|
"close 1005", // CLOSED_NO_STATUS
|
||||||
|
}, func(s string) bool { return strings.Contains(codedErr.Error(), s) })
|
||||||
|
}
|
||||||
|
|
||||||
return err == io.EOF ||
|
return err == io.EOF ||
|
||||||
err == io.ErrClosedPipe ||
|
err == io.ErrClosedPipe ||
|
||||||
strings.Contains(err.Error(), "closed") ||
|
strings.Contains(err.Error(), "closed") ||
|
||||||
|
|
Loading…
Reference in New Issue