aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-01 19:52:49 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-01 20:02:22 +0100
commit5da4c6e629dd4a0647fd3fe06906445eea65b867 (patch)
treec116a41e32444512cd13e4c18327f65c8d868fad /src/buffer
parent1a24350ee44859f6b3370ac15e8875a79fa7ae9b (diff)
downloadchawan-5da4c6e629dd4a0647fd3fe06906445eea65b867.tar.gz
loader: proper redirect handling
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/buffer.nim2
-rw-r--r--src/buffer/container.nim8
2 files changed, 4 insertions, 6 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index 7b38b255..e07e9146 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -525,7 +525,7 @@ proc loadResources(buffer: Buffer, document: Document) =
type ConnectResult* = object
code*: int
needsAuth*: bool
- redirect*: Option[URL]
+ redirect*: Request
contentType*: string
cookies*: seq[Cookie]
referrerpolicy*: Option[ReferrerPolicy]
diff --git a/src/buffer/container.nim b/src/buffer/container.nim
index 2d2ff73e..a42422e5 100644
--- a/src/buffer/container.nim
+++ b/src/buffer/container.nim
@@ -46,12 +46,10 @@ type
password*: bool
of READ_AREA:
tvalue*: string
- of OPEN:
+ of OPEN, REDIRECT:
request*: Request
of ANCHOR, NO_ANCHOR:
anchor*: string
- of REDIRECT:
- location*: URL
of ALERT:
msg*: string
of UPDATE:
@@ -685,8 +683,8 @@ proc load(container: Container) =
container.setLoadInfo("Connected to " & $container.source.location & ". Downloading...")
if res.needsAuth:
container.triggerEvent(NEEDS_AUTH)
- if res.redirect.isSome:
- container.triggerEvent(ContainerEvent(t: REDIRECT, location: res.redirect.get))
+ if res.redirect != nil:
+ container.triggerEvent(ContainerEvent(t: REDIRECT, request: res.redirect))
if res.contentType != "":
container.contenttype = some(res.contentType)
return container.iface.load()