aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/cookie.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-11 17:19:38 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-11 21:19:52 +0100
commit23beebe67a445aaeeae20a5cd80ff522db1b0ddb (patch)
tree7c29e0be74bc78b02492b31751383096ce1cffdd /src/types/cookie.nim
parentbce7d58e6e6e54814b74d9d41766f98552206e32 (diff)
downloadchawan-23beebe67a445aaeeae20a5cd80ff522db1b0ddb.tar.gz
url: reduce URL object size, simplify
* query, fragment are now strings, not options * get rid of Host, Path types, now hostname/pathname are strings * fix ipv4 parsing error case * in file protocol, fix URL for dirlist without slash with a redirection
Diffstat (limited to 'src/types/cookie.nim')
-rw-r--r--src/types/cookie.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/types/cookie.nim b/src/types/cookie.nim
index 78a10f81..305af9fa 100644
--- a/src/types/cookie.nim
+++ b/src/types/cookie.nim
@@ -125,7 +125,7 @@ proc `$`*(cookiejar: CookieJar): string =
# https://www.rfc-editor.org/rfc/rfc6265#section-5.1.4
func defaultCookiePath(url: URL): string =
- let path = ($url.path).beforeLast('/')
+ let path = url.pathname.beforeLast('/')
if path == "" or path[0] != '/':
return "/"
return path
@@ -197,7 +197,7 @@ proc serialize*(cookiejar: CookieJar; url: URL): string =
continue
if cookie.secure and url.scheme != "https":
continue
- if not cookiePathMatches(cookie.path, $url.path):
+ if not cookiePathMatches(cookie.path, url.pathname):
continue
if not cookieDomainMatches(cookie.domain, url):
continue