@@ -299,7 +299,7 @@ func startPipe(cfg *Config) {
299
299
}
300
300
}
301
301
302
- func safeEuqal (a , b string ) bool {
302
+ func safeEqual (a , b string ) bool {
303
303
aBuf := utils .ImmutableBytesFromString (a )
304
304
bBuf := utils .ImmutableBytesFromString (b )
305
305
return subtle .ConstantTimeCompare (aBuf , bBuf ) == 1
@@ -311,7 +311,7 @@ func authentication(secret string) func(http.Handler) http.Handler {
311
311
// Browser websocket not support custom header
312
312
if r .Header .Get ("Upgrade" ) == "websocket" && r .URL .Query ().Get ("token" ) != "" {
313
313
token := r .URL .Query ().Get ("token" )
314
- if ! safeEuqal (token , secret ) {
314
+ if ! safeEqual (token , secret ) {
315
315
render .Status (r , http .StatusUnauthorized )
316
316
render .JSON (w , r , ErrUnauthorized )
317
317
return
@@ -324,7 +324,7 @@ func authentication(secret string) func(http.Handler) http.Handler {
324
324
bearer , token , found := strings .Cut (header , " " )
325
325
326
326
hasInvalidHeader := bearer != "Bearer"
327
- hasInvalidSecret := ! found || ! safeEuqal (token , secret )
327
+ hasInvalidSecret := ! found || ! safeEqual (token , secret )
328
328
if hasInvalidHeader || hasInvalidSecret {
329
329
render .Status (r , http .StatusUnauthorized )
330
330
render .JSON (w , r , ErrUnauthorized )
0 commit comments