Merge pull request #4943 from nigredo-tori/fix-4942

Reset HttpClient if new URL has different port
This commit is contained in:
Andreas Rumpf 2016-10-24 17:07:30 +02:00 • committed by GitHub
commit 86ca077324

View file

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