about summary refs log tree commit diff stats
path: root/src/buffer/container.nim
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/container.nim
parent1a24350ee44859f6b3370ac15e8875a79fa7ae9b (diff)
downloadchawan-5da4c6e629dd4a0647fd3fe06906445eea65b867.tar.gz
loader: proper redirect handling
Diffstat (limited to 'src/buffer/container.nim')
-rw-r--r--src/buffer/container.nim8
1 files changed, 3 insertions, 5 deletions
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()