Reset HttpClient if new URL has different port

This commit is contained in:
Dmitry Polienko
2016-10-24 09:42:18 +07:00
parent c486e6377c
commit 8fb7858291

View File

@@ -958,8 +958,10 @@ proc parseResponse(client: HttpClient | AsyncHttpClient,
proc newConnection(client: HttpClient | AsyncHttpClient,
url: Uri) {.multisync.} =
if client.currentURL.hostname != url.hostname or
client.currentURL.scheme != url.scheme:
if client.connected: client.close()
client.currentURL.scheme != url.scheme or
client.currentURL.port != url.port:
if client.connected:
client.close()
when client is HttpClient:
client.socket = newSocket()