added getSocket proc (#11233)
This commit is contained in:
parent
7fb256bded
commit
de6b2e88d2
1 changed files with 15 additions and 0 deletions
|
|
@ -640,6 +640,21 @@ proc close*(client: HttpClient | AsyncHttpClient) =
|
|||
client.socket.close()
|
||||
client.connected = false
|
||||
|
||||
proc getSocket*(client: HttpClient): Socket =
|
||||
## Get network socket, useful if you want to find out more details about the connection
|
||||
##
|
||||
## this example shows info about local and remote endpoints
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## if client.connected:
|
||||
## echo client.getSocket.getLocalAddr
|
||||
## echo client.getSocket.getPeerAddr
|
||||
##
|
||||
return client.socket
|
||||
|
||||
proc getSocket*(client: AsyncHttpClient): AsyncSocket =
|
||||
return client.socket
|
||||
|
||||
proc reportProgress(client: HttpClient | AsyncHttpClient,
|
||||
progress: BiggestInt) {.multisync.} =
|
||||
client.contentProgress += progress
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue