From 385014533572f2b8dd5a00a43a27acd743af19c2 Mon Sep 17 00:00:00 2001 From: Sergio Andres Virviescas Santana Date: Mon, 4 Jan 2021 12:36:13 +0100 Subject: [PATCH] Upgrade dependencies --- go.mod | 4 ++-- go.sum | 8 ++++---- server_fasthttp.go | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 727b403..3229bc8 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/fasthttp/websocket go 1.12 require ( - github.com/savsgio/gotils v0.0.0-20200909101946-939aa3fc74fb - github.com/valyala/fasthttp v1.18.0 + github.com/savsgio/gotils v0.0.0-20210104112019-96a5e1e9898f + github.com/valyala/fasthttp v1.19.0 ) diff --git a/go.sum b/go.sum index 56bc5a7..ba391ff 100644 --- a/go.sum +++ b/go.sum @@ -2,12 +2,12 @@ github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDa github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg= github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/savsgio/gotils v0.0.0-20200909101946-939aa3fc74fb h1:XPJCVf85HPE2jMVEQ7QWrazaZo1lc94GbUWaQ8Yv5sM= -github.com/savsgio/gotils v0.0.0-20200909101946-939aa3fc74fb/go.mod h1:TWNAOTaVzGOXq8RbEvHnhzA/A2sLZzgn0m6URjnukY8= +github.com/savsgio/gotils v0.0.0-20210104112019-96a5e1e9898f h1:MlVk9SWHScKX//xsHudKurgtyVOmD06TLYKnuTPNK4g= +github.com/savsgio/gotils v0.0.0-20210104112019-96a5e1e9898f/go.mod h1:TWNAOTaVzGOXq8RbEvHnhzA/A2sLZzgn0m6URjnukY8= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.18.0 h1:IV0DdMlatq9QO1Cr6wGJPVW1sV1Q8HvZXAIcjorylyM= -github.com/valyala/fasthttp v1.18.0/go.mod h1:jjraHZVbKOXftJfsOYoAjaeygpj5hr8ermTRJNroD7A= +github.com/valyala/fasthttp v1.19.0 h1:PfTS4PeH3xDr3WomrDS2ID8lU2GskK1xS3YG6gIpibU= +github.com/valyala/fasthttp v1.19.0/go.mod h1:jjraHZVbKOXftJfsOYoAjaeygpj5hr8ermTRJNroD7A= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/server_fasthttp.go b/server_fasthttp.go index 73dbb32..ee98511 100644 --- a/server_fasthttp.go +++ b/server_fasthttp.go @@ -12,7 +12,7 @@ import ( "sync" "time" - "github.com/savsgio/gotils" + "github.com/savsgio/gotils/strconv" "github.com/valyala/fasthttp" ) @@ -98,7 +98,7 @@ func (u *FastHTTPUpgrader) selectSubprotocol(ctx *fasthttp.RequestCtx) []byte { for _, serverProtocol := range u.Subprotocols { for _, clientProtocol := range clientProtocols { - if gotils.B2S(clientProtocol) == serverProtocol { + if strconv.B2S(clientProtocol) == serverProtocol { return clientProtocol } } @@ -138,15 +138,15 @@ func (u *FastHTTPUpgrader) Upgrade(ctx *fasthttp.RequestCtx, handler FastHTTPHan return u.responseError(ctx, fasthttp.StatusMethodNotAllowed, fmt.Sprintf("%s request method is not GET", badHandshake)) } - if !tokenContainsValue(gotils.B2S(ctx.Request.Header.Peek("Connection")), "Upgrade") { + if !tokenContainsValue(strconv.B2S(ctx.Request.Header.Peek("Connection")), "Upgrade") { return u.responseError(ctx, fasthttp.StatusBadRequest, fmt.Sprintf("%s 'upgrade' token not found in 'Connection' header", badHandshake)) } - if !tokenContainsValue(gotils.B2S(ctx.Request.Header.Peek("Upgrade")), "Websocket") { + if !tokenContainsValue(strconv.B2S(ctx.Request.Header.Peek("Upgrade")), "Websocket") { return u.responseError(ctx, fasthttp.StatusBadRequest, fmt.Sprintf("%s 'websocket' token not found in 'Upgrade' header", badHandshake)) } - if !tokenContainsValue(gotils.B2S(ctx.Request.Header.Peek("Sec-Websocket-Version")), "13") { + if !tokenContainsValue(strconv.B2S(ctx.Request.Header.Peek("Sec-Websocket-Version")), "13") { return u.responseError(ctx, fasthttp.StatusBadRequest, "websocket: unsupported version: 13 not found in 'Sec-Websocket-Version' header") } @@ -187,7 +187,7 @@ func (u *FastHTTPUpgrader) Upgrade(ctx *fasthttp.RequestCtx, handler FastHTTPHan c := newConn(netConn, true, u.ReadBufferSize, u.WriteBufferSize, u.WriteBufferPool, nil, writeBuf) if subprotocol != nil { - c.subprotocol = gotils.B2S(subprotocol) + c.subprotocol = strconv.B2S(subprotocol) } if compress { @@ -213,16 +213,16 @@ func fastHTTPcheckSameOrigin(ctx *fasthttp.RequestCtx) bool { if len(origin) == 0 { return true } - u, err := url.Parse(gotils.B2S(origin)) + u, err := url.Parse(strconv.B2S(origin)) if err != nil { return false } - return equalASCIIFold(u.Host, gotils.B2S(ctx.Host())) + return equalASCIIFold(u.Host, strconv.B2S(ctx.Host())) } // FastHTTPIsWebSocketUpgrade returns true if the client requested upgrade to the // WebSocket protocol. func FastHTTPIsWebSocketUpgrade(ctx *fasthttp.RequestCtx) bool { - return tokenContainsValue(gotils.B2S(ctx.Request.Header.Peek("Connection")), "Upgrade") && - tokenContainsValue(gotils.B2S(ctx.Request.Header.Peek("Upgrade")), "Websocket") + return tokenContainsValue(strconv.B2S(ctx.Request.Header.Peek("Connection")), "Upgrade") && + tokenContainsValue(strconv.B2S(ctx.Request.Header.Peek("Upgrade")), "Websocket") }