Reset HttpClient if new URL has different port
This commit is contained in:
parent
c486e6377c
commit
8fb7858291
1 changed files with 4 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue