First point, why does your proc return a string, when no result is actually set?
Second, why does it request the content twice, but only use it once? I'd rewrite your proc as follows: import httpclient, asyncdispatch, strutils const MAX_REDIRECTS = 5 TIMEOUT = 2000 proc getPage*(client: HttpClient | AsyncHttpClient, host: string): Future[void] {.multisync.} = let url = "http://" & host try: echo "HTTP/S Probe: ", host let content = await client.getContent(url) for line in content.splitLines(): if "Invalid URL" in line: echo "Invalid URL \n" elif "IIS7" in line: echo "Found IIS Portal \n" elif "bitnami-xampp" in line: echo "Default XAMPP Server \n" elif "Bad Request" in line: red("[-]Bad Request \n") elif "Bluehost.Com" in line: echo "Default Blue Host Server \n" else: red("[~]Check Manually\n") errorHandler(3, host) break except: errorHandler(2, host) when isMainModule: let client = newHttpClient(maxRedirects = MAX_REDIRECTS, timeout = TIMEOUT) getPage(client, "google.com") Run Looking at your code, you seem to be looping indefinitely testing several hosts. Ideally, you should create one HTTP client instance and re-use it for every loop iteration, which is why the above code passes the client in. I also made the above function take either an async or sync http client, leaving you the option to use an asynchronous version at a later date - as you seem to be trying to scan a bunch of random IP addresses, you could probably do a few at a time with an async version.