Commit 3f907d1c authored by dmknght's avatar dmknght

try fix crash multithreading

parent 43543b8e
Pipeline #1248 failed with stages
switch("threads", "on")
switch("define", "ssl")
\ No newline at end of file
switch("define", "ssl")
switch("gc", "arc")
\ No newline at end of file
......@@ -2,6 +2,7 @@ import httpclient
import .. / cli / utils
import options
import strutils
import asyncdispatch
proc checkBranch*(subPath: string, opts: DirbOptions) =
......@@ -9,7 +10,8 @@ proc checkBranch*(subPath: string, opts: DirbOptions) =
# TODO use a callback function instead of progressbar cli
progressBar(fullURL)
# TODO http header crafting here
let client = if opts.proxy_addr == "": newHttpClient() else: newHttpClient(proxy = newProxy(opts.proxy_addr))
# let client = if opts.proxy_addr == "": newHttpClient() else: newHttpClient(proxy = newProxy(opts.proxy_addr))
let client = if opts.proxy_addr == "": newAsyncHttpClient() else: newAsyncHttpClient(proxy = newProxy(opts.proxy_addr))
client.headers = newHttpHeaders(
{
"Cookie": opts.cookie,
......@@ -17,19 +19,19 @@ proc checkBranch*(subPath: string, opts: DirbOptions) =
}
)
try:
let resp = client.get(fullURL)
let resp = waitFor client.get(fullURL)
if resp.status != "404 Not Found":
# TODO use a callback function instead of print cli
prntFound(resp.status, fullURL)
if opts.add_slash and not fullURL.endsWith("/"):
progressBar(fullURL & "/")
let slash_resp = client.get(fullURL & "/")
let slash_resp = waitFor client.get(fullURL & "/")
if slash_resp.status != "404 Not Found":
# TODO use a callback function instead of print cli
prntFound(slash_resp.status, fullURL & "/")
if len(opts.final_extensions) != 0:
for thisExtension in opts.final_extensions:
let extResp = client.get(fullURL & thisExtension)
let extResp = waitFor client.get(fullURL & thisExtension)
progressBar(fullURL & thisExtension)
if extResp.status != "404 Not Found":
# TODO use a callback function instead of print cli
......
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