diff --git a/cffi_dist/example_node/index.js b/cffi_dist/example_node/index.js index 72466e9..0217a41 100644 --- a/cffi_dist/example_node/index.js +++ b/cffi_dist/example_node/index.js @@ -1,7 +1,7 @@ const ffi = require('ffi-napi'); // load the tls-client shared package for your OS you are currently running your nodejs script (i'm running on mac) -const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.9.dylib', { +const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.10.dylib', { 'request': ['string', ['string']], 'getCookiesFromSession': ['string', ['string']], 'addCookiesToSession': ['string', ['string']], diff --git a/cffi_dist/example_node/index_async.js b/cffi_dist/example_node/index_async.js index b293182..e78fb6f 100644 --- a/cffi_dist/example_node/index_async.js +++ b/cffi_dist/example_node/index_async.js @@ -1,7 +1,7 @@ const ffi = require('ffi-napi'); // load the tls-client shared package for your OS you are currently running your nodejs script (i'm running on mac) -const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.9.dylib', { +const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.10.dylib', { 'request': ['string', ['string']], 'getCookiesFromSession': ['string', ['string']], 'addCookiesToSession': ['string', ['string']], diff --git a/cffi_dist/example_node/index_custom_client.js b/cffi_dist/example_node/index_custom_client.js index d61b387..eae647e 100644 --- a/cffi_dist/example_node/index_custom_client.js +++ b/cffi_dist/example_node/index_custom_client.js @@ -1,7 +1,7 @@ const ffi = require('ffi-napi'); // load the tls-client shared package for your OS you are currently running your nodejs script (i'm running on mac) -const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.9.dylib', { +const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.10.dylib', { 'request': ['string', ['string']], 'getCookiesFromSession': ['string', ['string']], 'addCookiesToSession': ['string', ['string']], diff --git a/cffi_dist/example_node/index_image.js b/cffi_dist/example_node/index_image.js index bf8b518..7758acc 100644 --- a/cffi_dist/example_node/index_image.js +++ b/cffi_dist/example_node/index_image.js @@ -2,7 +2,7 @@ const ffi = require('ffi-napi'); const fs = require("fs") // load the tls-client shared package for your OS you are currently running your nodejs script (i'm running on mac) -const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.9.dylib', { +const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.10.dylib', { 'request': ['string', ['string']], 'getCookiesFromSession': ['string', ['string']], 'addCookiesToSession': ['string', ['string']], diff --git a/cffi_dist/example_node/index_image_upload.js b/cffi_dist/example_node/index_image_upload.js index 6fc2f4f..83525db 100644 --- a/cffi_dist/example_node/index_image_upload.js +++ b/cffi_dist/example_node/index_image_upload.js @@ -2,7 +2,7 @@ const ffi = require('ffi-napi'); const fs = require("fs") // load the tls-client shared package for your OS you are currently running your nodejs script (i'm running on mac) -const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.9.dylib', { +const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.10.dylib', { 'request': ['string', ['string']], 'getCookiesFromSession': ['string', ['string']], 'addCookiesToSession': ['string', ['string']], diff --git a/cffi_dist/example_node/index_post.js b/cffi_dist/example_node/index_post.js index 5dce917..f4dcbcf 100644 --- a/cffi_dist/example_node/index_post.js +++ b/cffi_dist/example_node/index_post.js @@ -1,7 +1,7 @@ const ffi = require('ffi-napi'); // load the tls-client shared package for your OS you are currently running your nodejs script (i'm running on mac) -const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.9.dylib', { +const tlsClientLibrary = ffi.Library('./../dist/tls-client-darwin-amd64-1.3.10.dylib', { 'request': ['string', ['string']], 'getCookiesFromSession': ['string', ['string']], 'addCookiesToSession': ['string', ['string']], diff --git a/cffi_dist/example_python/example.py b/cffi_dist/example_python/example.py index b16a356..afc4773 100644 --- a/cffi_dist/example_python/example.py +++ b/cffi_dist/example_python/example.py @@ -2,7 +2,7 @@ import json # load the tls-client shared package for your OS you are currently running your python script (i'm running on mac) -library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.9.dylib') +library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.10.dylib') # extract the exposed request function from the shared package request = library.request diff --git a/cffi_dist/example_python/example_custom_client.py b/cffi_dist/example_python/example_custom_client.py index 5bd6668..22ebb08 100644 --- a/cffi_dist/example_python/example_custom_client.py +++ b/cffi_dist/example_python/example_custom_client.py @@ -2,7 +2,7 @@ import json # load the tls-client shared package for your OS you are currently running your python script (i'm running on mac) -library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.9.dylib') +library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.10.dylib') # extract the exposed request function from the shared package request = library.request diff --git a/cffi_dist/example_python/example_image.py b/cffi_dist/example_python/example_image.py index 2c1b573..1d3d41d 100644 --- a/cffi_dist/example_python/example_image.py +++ b/cffi_dist/example_python/example_image.py @@ -4,7 +4,7 @@ import re # load the tls-client shared package for your OS you are currently running your python script (i'm running on mac) -library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.9.dylib') +library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.10.dylib') # extract the exposed request function from the shared package request = library.request diff --git a/cffi_dist/example_python/example_image_upload.py b/cffi_dist/example_python/example_image_upload.py index 67cd7f5..3f6bde8 100644 --- a/cffi_dist/example_python/example_image_upload.py +++ b/cffi_dist/example_python/example_image_upload.py @@ -3,7 +3,7 @@ import base64 # load the tls-client shared package for your OS you are currently running your python script (i'm running on mac) -library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.9.dylib') +library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.10.dylib') # extract the exposed request function from the shared package request = library.request diff --git a/cffi_dist/example_python/example_post.py b/cffi_dist/example_python/example_post.py index af2dbf1..6f00059 100644 --- a/cffi_dist/example_python/example_post.py +++ b/cffi_dist/example_python/example_post.py @@ -4,7 +4,7 @@ import re # load the tls-client shared package for your OS you are currently running your python script (i'm running on mac) -library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.9.dylib') +library = ctypes.cdll.LoadLibrary('./../dist/tls-client-darwin-amd64-1.3.10.dylib') # extract the exposed request function from the shared package request = library.request diff --git a/cffi_dist/example_typescript/src/client.ts b/cffi_dist/example_typescript/src/client.ts index b2bfacd..9c74abf 100644 --- a/cffi_dist/example_typescript/src/client.ts +++ b/cffi_dist/example_typescript/src/client.ts @@ -66,10 +66,10 @@ export class TLSClient implements TLSClientInstance { const createWrapper = (): LibraryObject => { const sharedLibraryPath = join(__dirname, './../../dist/'); const sharedLibraryFilename = platform() === 'win32' - ? `tls-client-windows-64-1.3.9.dll` + ? `tls-client-windows-64-1.3.10.dll` : arch() === 'arm64' - ? `tls-client-darwin-arm64-1.3.9.dylib` - : `tls-client-darwin-amd64-1.3.9.dylib`; + ? `tls-client-darwin-arm64-1.3.10.dylib` + : `tls-client-darwin-amd64-1.3.10.dylib`; return Library(join(sharedLibraryPath, sharedLibraryFilename), { request: ['string', ['string']], diff --git a/client.go b/client.go index 5d689b2..93f14be 100644 --- a/client.go +++ b/client.go @@ -29,6 +29,7 @@ type HttpClient interface { GetProxy() string SetFollowRedirect(followRedirect bool) GetFollowRedirect() bool + CloseIdleConnections() Do(req *http.Request) (*http.Response, error) Get(url string) (resp *http.Response, err error) Head(url string) (resp *http.Response, err error) @@ -158,6 +159,11 @@ func buildFromConfig(config *httpClientConfig) (*http.Client, ClientProfile, err return client, clientProfile, nil } +// CloseIdleConnections closes all idle connections of the underlying http client. +func (c *httpClient) CloseIdleConnections() { + c.Client.CloseIdleConnections() +} + // SetFollowRedirect configures the client's HTTP redirect following policy. func (c *httpClient) SetFollowRedirect(followRedirect bool) { c.logger.Debug("set follow redirect from %v to %v", c.config.followRedirects, followRedirect)