aboutsummaryrefslogtreecommitdiffstats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-07 15:49:15 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-07 15:49:15 +0200
commitb139631c361cadaff687f3f9a2d4950bdeb9dee7 (patch)
treeae48e7e9044279c008fe4620f353bd75402204b4 /src/types
parent205cb2b926c6c74ac8dcff9dfee86e464ee6a8ad (diff)
downloadchawan-b139631c361cadaff687f3f9a2d4950bdeb9dee7.tar.gz
url: fix \n, \t not being properly removed
For some reason we were only stripping tabs and newlines from the beginning/end of the string. The standard says they should be ignored completely.
Diffstat (limited to 'src/types')
-rw-r--r--src/types/url.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/types/url.nim b/src/types/url.nim
index e95e0d21..864b62e0 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -327,7 +327,6 @@ proc basicParseURL*(input: string, base = none(URL), url: URL = URL(),
stateOverride = none(URLState)): Option[URL] =
let input = input
.strip(true, false, {chr(0x00)..chr(0x1F), ' '})
- .strip(true, false, {'\t', '\n'})
var buffer = ""
var atsignseen = false
var insidebrackets = false
@@ -357,6 +356,9 @@ proc basicParseURL*(input: string, base = none(URL), url: URL = URL(),
template is_empty(path: URLPath): bool = path.ss.len == 0
while pointer <= input.len:
+ if pointer < input.len and input[pointer] in {'\n', '\t'}:
+ inc pointer
+ continue
case state
of SCHEME_START_STATE:
if has and c.isAlphaAscii():