aboutsummaryrefslogtreecommitdiffstats
path: root/src/local
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/local
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/local')
-rw-r--r--src/local/client.nim2
-rw-r--r--src/local/container.nim2
-rw-r--r--src/local/pager.nim5
3 files changed, 5 insertions, 4 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index 432dbe1f..32f524b9 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -645,7 +645,7 @@ proc clientLoadJSModule(ctx: JSContext; module_name: cstringConst;
JS_ThrowTypeError(ctx, "Invalid URL: %s", module_name)
return nil
try:
- let f = readFile($x.get.path)
+ let f = readFile(x.get.pathname)
return finishLoadModule(ctx, f, cstring(module_name))
except IOError:
JS_ThrowTypeError(ctx, "Failed to open file %s", module_name)
diff --git a/src/local/container.nim b/src/local/container.nim
index 527c4975..a5cdd630 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -1427,7 +1427,7 @@ proc onload(container: Container; res: int) =
container.setLoadInfo("")
container.triggerEvent(cetStatus)
container.triggerEvent(cetLoaded)
- if cfHasStart notin container.flags and (container.url.anchor != "" or
+ if cfHasStart notin container.flags and (container.url.hash != "" or
container.config.autofocus):
container.requestLines().then(proc(): Promise[GotoAnchorResult] =
return container.iface.gotoAnchor()
diff --git a/src/local/pager.nim b/src/local/pager.nim
index b5b84b27..07244408 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -1390,7 +1390,8 @@ proc gotoURL(pager: Pager; request: Request; prevurl = none(URL);
if ourl == nil:
break
request.url = ourl
- if prevurl.isNone or not prevurl.get.equals(request.url, true) or
+ if prevurl.isNone or
+ not prevurl.get.equals(request.url, excludeHash = true) or
request.url.hash == "" or request.httpMethod != hmGet or save:
# Basically, we want to reload the page *only* when
# a) we force a reload (by setting prevurl to none)
@@ -1428,7 +1429,7 @@ proc gotoURL(pager: Pager; request: Request; prevurl = none(URL);
inc pager.numload
return container
else:
- pager.container.findAnchor(request.url.anchor)
+ pager.container.findAnchor(request.url.hash)
return nil
proc omniRewrite(pager: Pager; s: string): string =