Commit 43543b8e authored by dmknght's avatar dmknght

Fix status check and temp add header

parent 4f0ee084
Pipeline #1247 canceled with stages
......@@ -9,7 +9,13 @@ proc checkBranch*(subPath: string, opts: DirbOptions) =
# TODO use a callback function instead of progressbar cli
progressBar(fullURL)
# TODO http header crafting here
var client = newHttpClient()
let client = if opts.proxy_addr == "": newHttpClient() else: newHttpClient(proxy = newProxy(opts.proxy_addr))
client.headers = newHttpHeaders(
{
"Cookie": opts.cookie,
"User-Agent": opts.agent,
}
)
try:
let resp = client.get(fullURL)
if resp.status != "404 Not Found":
......@@ -20,7 +26,7 @@ proc checkBranch*(subPath: string, opts: DirbOptions) =
let slash_resp = client.get(fullURL & "/")
if slash_resp.status != "404 Not Found":
# TODO use a callback function instead of print cli
prntFound(resp.status, fullURL & "/")
prntFound(slash_resp.status, fullURL & "/")
if len(opts.final_extensions) != 0:
for thisExtension in opts.final_extensions:
let extResp = client.get(fullURL & thisExtension)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment