diff options
author | bptato <nincsnevem662@gmail.com> | 2023-07-04 12:25:40 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-07-04 12:25:56 +0200 |
commit | b96d8cc51a7f469eaa5804c24a8b45cc4d5b3756 (patch) | |
tree | 0d1deb5281e233d6627a4cfde91732c34adbbc05 /src/io | |
parent | e961b086d263022c3486a4742d1ab29331212c62 (diff) | |
download | chawan-b96d8cc51a7f469eaa5804c24a8b45cc4d5b3756.tar.gz |
Add proxy support
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/loader.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/io/loader.nim b/src/io/loader.nim index 6583ce2c..46f694e6 100644 --- a/src/io/loader.nim +++ b/src/io/loader.nim @@ -84,6 +84,10 @@ type filter*: URLFilter cookiejar*: CookieJar referrerpolicy*: ReferrerPolicy + proxy*: URL + # When set to false, requests with a proxy URL are overridden by the + # loader proxy. + acceptProxy*: bool FetchPromise* = Promise[Result[Response, JSError]] @@ -132,6 +136,8 @@ proc onLoad(ctx: LoaderContext, stream: Stream) = let r = getReferer(request.referer, request.url, ctx.config.referrerpolicy) if r != "": request.headers["Referer"] = r + if request.proxy == nil or not ctx.config.acceptProxy: + request.proxy = ctx.config.proxy ctx.loadResource(request, stream) proc acceptConnection(ctx: LoaderContext) = |