summaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/websocket/server.go
diff options
context:
space:
mode:
authorLibravatar Daenney <daenney@users.noreply.github.com>2024-11-25 11:50:03 +0100
committerLibravatar GitHub <noreply@github.com>2024-11-25 10:50:03 +0000
commit2ed409888b988115433b5eddb62ca38c00c68325 (patch)
tree2196f46b63191bc79b9dab096ac52e5db877a24f /vendor/github.com/gorilla/websocket/server.go
parent[chore]: Bump github.com/tdewolff/minify/v2 from 2.21.1 to 2.21.2 (#3567) (diff)
downloadgotosocial-2ed409888b988115433b5eddb62ca38c00c68325.tar.xz
[chore] Update gorilla/websocket (#3561)
The maintainers messed with the v1.5.2 tag which causes Go checksum validation problems as the Go module proxy saw and recorded the original hash. This updates to 1.5.3 which doesn't have the issue.
Diffstat (limited to 'vendor/github.com/gorilla/websocket/server.go')
-rw-r--r--vendor/github.com/gorilla/websocket/server.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go
index fda75ff0d..bb3359743 100644
--- a/vendor/github.com/gorilla/websocket/server.go
+++ b/vendor/github.com/gorilla/websocket/server.go
@@ -33,7 +33,6 @@ type Upgrader struct {
// size is zero, then buffers allocated by the HTTP server are used. The
// I/O buffer sizes do not limit the size of the messages that can be sent
// or received.
- // The default value is 4096 bytes, 4kb.
ReadBufferSize, WriteBufferSize int
// WriteBufferPool is a pool of buffers for write operations. If the value
@@ -102,8 +101,8 @@ func checkSameOrigin(r *http.Request) bool {
func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string {
if u.Subprotocols != nil {
clientProtocols := Subprotocols(r)
- for _, clientProtocol := range clientProtocols {
- for _, serverProtocol := range u.Subprotocols {
+ for _, serverProtocol := range u.Subprotocols {
+ for _, clientProtocol := range clientProtocols {
if clientProtocol == serverProtocol {
return clientProtocol
}
@@ -173,7 +172,12 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
}
}
- netConn, brw, err := http.NewResponseController(w).Hijack()
+ h, ok := w.(http.Hijacker)
+ if !ok {
+ return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker")
+ }
+ var brw *bufio.ReadWriter
+ netConn, brw, err := h.Hijack()
if err != nil {
return u.returnError(w, r, http.StatusInternalServerError, err.Error())
}