mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-11 21:40:02 -04:00
update curl/wolfssl, add per host connection limit
This commit is contained in:
parent
c1b78e1d0c
commit
5579550b8d
8 changed files with 15 additions and 9 deletions
|
@ -146,7 +146,7 @@ The valid HTTP session settings are:
|
|||
|
||||
Each HTTP session has the following methods available:
|
||||
- `fetch` - Identical to the `libcurl.fetch` function but only creates connections in this session.
|
||||
- `set_connections` - Set the connection limits. This takes two arguments, the first being the limit for the connection cache, and the second being the max number of active connections.
|
||||
- `set_connections` - Set the connection limits. This takes three arguments: the first [is the hard limit of active connections](https://curl.se/libcurl/c/CURLMOPT_MAX_TOTAL_CONNECTIONS.html) (default 60), the second is limit for the connection cache (default 50), and the third is the [max connections per host](https://curl.se/libcurl/c/CURLMOPT_MAXCONNECTS.html) (default 6).
|
||||
- `export_cookies` - Export any cookies which were recorded in the session. This will return an empty string if cookies are disabled or no cookies have been set yet.
|
||||
- `close` - Close all connections and clean up the session. You must call this after you are done using the session, otherwise it will leak memory.
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* DELETE
|
||||
assert\(sock\.stream\.fd ?< ?64\);
|
||||
*/
|
||||
|
||||
|
||||
/* DELETE
|
||||
assert\(!exceptfds, ?['"]exceptfds not supported['"]\);
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@ class HTTPSession extends CurlSession {
|
|||
this.options = options;
|
||||
this.base_url = undefined;
|
||||
|
||||
this.set_connections(50, 40);
|
||||
this.set_connections(50, 40, 6);
|
||||
this.import_cookies();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ class CurlSession {
|
|||
}
|
||||
}
|
||||
|
||||
set_connections(connections_limit, cache_limit) {
|
||||
set_connections(connections_limit, cache_limit, host_conn_limit=0) {
|
||||
this.assert_ready();
|
||||
_session_set_options(this.session_ptr, connections_limit, cache_limit);
|
||||
_session_set_options(this.session_ptr, connections_limit, cache_limit, host_conn_limit);
|
||||
}
|
||||
|
||||
end_callback(request_id, error) {
|
||||
|
|
|
@ -27,9 +27,10 @@ void session_perform(struct SessionInfo *session) {
|
|||
}
|
||||
}
|
||||
|
||||
void session_set_options(struct SessionInfo *session, int connections_limit, int cache_limit) {
|
||||
void session_set_options(struct SessionInfo *session, int connections_limit, int cache_limit, int host_conn_limit) {
|
||||
curl_multi_setopt(session->multi_handle, CURLMOPT_MAX_TOTAL_CONNECTIONS, connections_limit);
|
||||
curl_multi_setopt(session->multi_handle, CURLMOPT_MAXCONNECTS, cache_limit);
|
||||
curl_multi_setopt(session->multi_handle, CURLMOPT_MAX_HOST_CONNECTIONS, host_conn_limit);
|
||||
}
|
||||
|
||||
void session_add_request(struct SessionInfo *session, CURL* http_handle) {
|
||||
|
|
|
@ -14,7 +14,7 @@ NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm)
|
|||
|
||||
cd build
|
||||
rm -rf curl
|
||||
git clone -b curl-8_9_1 --depth=1 https://github.com/curl/curl
|
||||
git clone -b curl-8_10_1 --depth=1 https://github.com/curl/curl
|
||||
cd curl
|
||||
|
||||
autoreconf -fi
|
||||
|
|
|
@ -12,11 +12,11 @@ mkdir -p $PREFIX
|
|||
|
||||
cd build
|
||||
rm -rf wolfssl
|
||||
git clone -b v5.6.6-stable --depth=1 https://github.com/wolfSSL/wolfssl wolfssl
|
||||
git clone -b v5.7.2-stable --depth=1 https://github.com/wolfSSL/wolfssl wolfssl
|
||||
cd wolfssl
|
||||
|
||||
autoreconf -fi
|
||||
export CFLAGS="-Oz -DSP_WORD_SIZE=32 -DWOLFSSL_NO_ATOMICS -DWOLFSSL_TICKET_NONCE_MALLOC"
|
||||
export CFLAGS="-Oz -DSP_WORD_SIZE=32 -DWOLFSSL_NO_ATOMICS -DWOLFSSL_MAX_ALT_NAMES=1024"
|
||||
emconfigure ./configure --prefix=$PREFIX --enable-curl --enable-static --disable-shared --host=i686-linux --disable-examples --disable-asm --enable-sni --enable-alpn --enable-truncatedhmac --enable-oldtls --enable-tlsv12 --enable-all-crypto --disable-asyncthreads --disable-threadlocal --enable-tlsx
|
||||
emmake make -j$CORE_COUNT
|
||||
make install
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 78f872c8e5b180e26ec09cc126e841e12ac75c36
|
||||
Subproject commit f931adf9fea476fefffb1f0c3789cafda58d54ba
|
Loading…
Add table
Add a link
Reference in a new issue