about summary refs log tree commit diff stats
path: root/src/ips/forkserver.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-04 12:25:40 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-04 12:25:56 +0200
commitb96d8cc51a7f469eaa5804c24a8b45cc4d5b3756 (patch)
tree0d1deb5281e233d6627a4cfde91732c34adbbc05 /src/ips/forkserver.nim
parente961b086d263022c3486a4742d1ab29331212c62 (diff)
downloadchawan-b96d8cc51a7f469eaa5804c24a8b45cc4d5b3756.tar.gz
Add proxy support
Diffstat (limited to 'src/ips/forkserver.nim')
-rw-r--r--src/ips/forkserver.nim12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ips/forkserver.nim b/src/ips/forkserver.nim
index e2e825c1..62d41198 100644
--- a/src/ips/forkserver.nim
+++ b/src/ips/forkserver.nim
@@ -15,6 +15,7 @@ import ips/serialize
 import ips/serversocket
 import types/buffersource
 import types/cookie
+import types/url
 import utils/twtstr
 
 type
@@ -33,8 +34,8 @@ type
     children: seq[(Pid, Pid)]
 
 proc newFileLoader*(forkserver: ForkServer, defaultHeaders: Headers = nil,
-    filter = newURLFilter(default = true),
-    cookiejar: CookieJar = nil): FileLoader =
+    filter = newURLFilter(default = true), cookiejar: CookieJar = nil,
+    proxy: URL = nil, acceptProxy = false): FileLoader =
   new(result)
   forkserver.ostream.swrite(FORK_LOADER)
   var defaultHeaders = defaultHeaders
@@ -44,7 +45,9 @@ proc newFileLoader*(forkserver: ForkServer, defaultHeaders: Headers = nil,
   let config = LoaderConfig(
     defaultHeaders: defaultHeaders,
     filter: filter,
-    cookiejar: cookiejar
+    cookiejar: cookiejar,
+    proxy: proxy,
+    acceptProxy: acceptProxy
   )
   forkserver.ostream.swrite(config)
   forkserver.ostream.flush()
@@ -113,7 +116,8 @@ proc forkBuffer(ctx: var ForkServerContext): Pid =
       defaultHeaders: config.headers,
       filter: config.filter,
       cookiejar: config.cookiejar,
-      referrerpolicy: config.referrerpolicy
+      referrerpolicy: config.referrerpolicy,
+      proxy: config.proxy
     )
   )
   let pid = fork()