about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-29 20:34:14 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-29 23:24:34 +0200
commitbfff8f7cee0c65c2f76164c8e75bbd267bc07cd0 (patch)
tree35b63c66974862d41d69743246ed121a78797b7e
parent83d119903270acc85110c291fe0b7a4d967a9052 (diff)
downloadchawan-bfff8f7cee0c65c2f76164c8e75bbd267bc07cd0.tar.gz
twtstr: fix startsWithIgnoreCase
-rw-r--r--src/server/buffer.nim2
-rw-r--r--src/utils/twtstr.nim4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim
index 3d466fa8..6da64c83 100644
--- a/src/server/buffer.nim
+++ b/src/server/buffer.nim
@@ -738,7 +738,7 @@ proc checkRefresh*(buffer: Buffer): CheckRefreshResult {.proxy.} =
   if s[i] notin {',', ';'}:
     return CheckRefreshResult(n: -1)
   i = s.skipBlanks(i + 1)
-  if s.startsWithIgnoreCase("url=", i):
+  if s.toOpenArray(i, s.high).startsWithIgnoreCase("url="):
     i = s.skipBlanks(i + "url=".len)
   var q = false
   if i < s.len and s[i] in {'"', '\''}:
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 44c6ea3f..7cadd41f 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -108,9 +108,9 @@ func toHexLower*(u: uint16): string =
 func equalsIgnoreCase*(s1, s2: string): bool {.inline.} =
   return s1.cmpIgnoreCase(s2) == 0
 
-func startsWithIgnoreCase*(s1, s2: string; si = 0): bool =
+func startsWithIgnoreCase*(s1, s2: openArray[char]): bool =
   if s1.len < s2.len: return false
-  for i in si ..< s2.len:
+  for i in 0 ..< s2.len:
     if s1[i].toLowerAscii() != s2[i].toLowerAscii():
       return false
   return true