mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Use strings.EqualFold for string comparison (#5227)
This commit is contained in:
parent
8c1ceba76d
commit
65a0caeb94
@ -597,7 +597,7 @@ func stopAuthenticatedRpcServer(ctx context.Context, engineInfo *engineInfo) {
|
||||
|
||||
// isWebsocket checks the header of a http request for a websocket upgrade request.
|
||||
func isWebsocket(r *http.Request) bool {
|
||||
return strings.ToLower(r.Header.Get("Upgrade")) == "websocket" &&
|
||||
return strings.EqualFold(r.Header.Get("Upgrade"), "websocket") &&
|
||||
strings.Contains(strings.ToLower(r.Header.Get("Connection")), "upgrade")
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ func stopAuthenticatedRpcServer(ctx context.Context, engineInfo *engineInfo) {
|
||||
|
||||
// isWebsocket checks the header of a http request for a websocket upgrade request.
|
||||
func isWebsocket(r *http.Request) bool {
|
||||
return strings.ToLower(r.Header.Get("Upgrade")) == "websocket" &&
|
||||
return strings.EqualFold(r.Header.Get("Upgrade"), "websocket") &&
|
||||
strings.Contains(strings.ToLower(r.Header.Get("Connection")), "upgrade")
|
||||
}
|
||||
|
||||
|
@ -243,12 +243,12 @@ func (c *Compiler) pushBin(v interface{}) {
|
||||
// isPush returns whether the string op is either any of
|
||||
// push(N).
|
||||
func isPush(op string) bool {
|
||||
return strings.ToUpper(op) == "PUSH"
|
||||
return strings.EqualFold(op, "PUSH")
|
||||
}
|
||||
|
||||
// isJump returns whether the string op is jump(i)
|
||||
func isJump(op string) bool {
|
||||
return strings.ToUpper(op) == "JUMPI" || strings.ToUpper(op) == "JUMP"
|
||||
return strings.EqualFold(op, "JUMPI") || strings.EqualFold(op, "JUMP")
|
||||
}
|
||||
|
||||
// toBinary converts text to a vm.OpCode
|
||||
|
@ -324,7 +324,7 @@ func rpcRequest(t *testing.T, url string, extraHeaders ...string) *http.Response
|
||||
}
|
||||
for i := 0; i < len(extraHeaders); i += 2 {
|
||||
key, value := extraHeaders[i], extraHeaders[i+1]
|
||||
if strings.ToLower(key) == "host" {
|
||||
if strings.EqualFold(key, "host") {
|
||||
req.Host = value
|
||||
} else {
|
||||
req.Header.Set(key, value)
|
||||
|
Loading…
Reference in New Issue
Block a user