gospider007 / requests

🚀A next-generation HTTP client for Golang, Support ja3, ja4, http2, tls fingerprint modification
GNU General Public License v3.0
102 stars 19 forks source link

Changes and clarification of the close connection api #2

Closed gospider007 closed 7 months ago

gospider007 commented 10 months ago

The official client.CloseIdleConnections() function is to close idle connections without affecting the connections in use. The function of client.CloseConns() is to close all connections, wait for the connection in use and then close it. client.ForceCloseConns() will force close all connections immediately, even if it is in use

client.CloseIdleConnections()  => client.CloseConns()
client.CloseConnections()  => client.ForceCloseConns()

The function of response.CloseBody() is to close the body. For streaming requests, the connection will be closed at the same time, such as: websocket, sse, stream=true The function of response.CloseConn() is to close the connection. For the connection in use, wait for it to be closed after completion. The function of response.ForceCloseConns() is to forcefully close the connection. The connection will be closed immediately even if it is in use.

response.Close() => response.CloseBody()
response.Delete() => response.CloseConn()
response.ForceDelete() => response.ForceCloseConn()