Catch SSL shutdown errors when closing clients

This commit is contained in:
Zed
2020-01-01 17:24:24 +01:00
parent b09798f2cf
commit ee43d8cfb1
3 changed files with 11 additions and 3 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ proc genHeaders*(agent: string; referer: Uri; lang=true;
template newClient*() {.dirty.} =
var client = newAsyncHttpClient()
defer: client.close()
defer:
try: client.close()
except: discard
client.headers = headers
proc fetchHtml*(url: Uri; headers: HttpHeaders; jsonKey = ""): Future[XmlNode] {.async.} =