remove wolfssl and nghttp2 entirely

This commit is contained in:
ading2210 2024-10-03 06:21:44 -04:00
parent c1b78e1d0c
commit bcda300153
10 changed files with 12 additions and 77 deletions

3
.gitignore vendored
View file

@ -2,4 +2,5 @@
/client/out /client/out
/client/fragments/tmp /client/fragments/tmp
/server/.venv /server/.venv
/server/websockify
node_modules

View file

@ -27,7 +27,7 @@ EXPORTED_FUNCS="${EXPORTED_FUNCS:1}"
#compile options #compile options
RUNTIME_METHODS="addFunction,removeFunction,allocate,ALLOC_NORMAL" RUNTIME_METHODS="addFunction,removeFunction,allocate,ALLOC_NORMAL"
COMPILER_OPTIONS="-o $MODULE_FILE -lcurl -lwolfssl -lcjson -lz -lbrotlidec -lbrotlicommon -lnghttp2 -I $INCLUDE_DIR -L $LIB_DIR" COMPILER_OPTIONS="-o $MODULE_FILE -lcurl -lcjson -lz -lbrotlidec -lbrotlicommon -I $INCLUDE_DIR -L $LIB_DIR"
EMSCRIPTEN_OPTIONS="-lwebsocket.js -sENVIRONMENT=worker,web -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sNO_EXIT_RUNTIME -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS" EMSCRIPTEN_OPTIONS="-lwebsocket.js -sENVIRONMENT=worker,web -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sNO_EXIT_RUNTIME -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS"
#clean output dir #clean output dir

View file

@ -1,3 +1,8 @@
/* DELETE /* DELETE
assert\(sock\.stream\.fd ?< ?64\); assert\(sock\.stream\.fd ?< ?64\);
*/ */
/* DELETE
assert\(!exceptfds, ?['"]exceptfds not supported['"]\);
*/

View file

@ -2,9 +2,7 @@ const copyright_notice = `libcurl.js is licensed under the GNU AGPL v3. You can
Several C libraries are used, and their licenses are listed below: Several C libraries are used, and their licenses are listed below:
- libcurl: curl License (https://curl.se/docs/copyright.html) - libcurl: curl License (https://curl.se/docs/copyright.html)
- wolfssl: GNU GPL v2 (https://github.com/wolfSSL/wolfssl/blob/master/COPYING)
- cjson: MIT License (https://github.com/DaveGamble/cJSON/blob/master/LICENSE) - cjson: MIT License (https://github.com/DaveGamble/cJSON/blob/master/LICENSE)
- zlib: zlib License (https://www.zlib.net/zlib_license.html) - zlib: zlib License (https://www.zlib.net/zlib_license.html)
- brotli: MIT License (https://github.com/google/brotli/blob/master/LICENSE) - brotli: MIT License (https://github.com/google/brotli/blob/master/LICENSE)
- nghttp2: MIT License (https://github.com/nghttp2/nghttp2/blob/master/COPYING)
`; `;

View file

@ -14,7 +14,7 @@ void http_set_options(CURL* http_handle, const char* json_params, const char* bo
//some default options //some default options
curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(http_handle, CURLOPT_ACCEPT_ENCODING, ""); curl_easy_setopt(http_handle, CURLOPT_ACCEPT_ENCODING, "");
curl_easy_setopt(http_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); curl_easy_setopt(http_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
//parse json options //parse json options
cJSON* request_json = cJSON_Parse(json_params); cJSON* request_json = cJSON_Parse(json_params);

View file

@ -21,14 +21,10 @@ char* get_version() {
} }
cJSON* curl_version_item = cJSON_CreateString(version_info->version); cJSON* curl_version_item = cJSON_CreateString(version_info->version);
cJSON* ssl_version_item = cJSON_CreateString(version_info->ssl_version);
cJSON* brotli_version_item = cJSON_CreateString(version_info->brotli_version); cJSON* brotli_version_item = cJSON_CreateString(version_info->brotli_version);
cJSON* nghttp2_version_item = cJSON_CreateString(version_info->nghttp2_version);
cJSON_AddItemToObject(version_json, "curl", curl_version_item); cJSON_AddItemToObject(version_json, "curl", curl_version_item);
cJSON_AddItemToObject(version_json, "ssl", ssl_version_item);
cJSON_AddItemToObject(version_json, "brotli", brotli_version_item); cJSON_AddItemToObject(version_json, "brotli", brotli_version_item);
cJSON_AddItemToObject(version_json, "nghttp2", nghttp2_version_item);
cJSON_AddItemToObject(version_json, "protocols", protocols_array); cJSON_AddItemToObject(version_json, "protocols", protocols_array);
char* version_json_str = cJSON_Print(version_json); char* version_json_str = cJSON_Print(version_json);

View file

@ -5,16 +5,11 @@
set -e set -e
mkdir -p build mkdir -p build
WOLFSSL_PREFIX=$(realpath build/wolfssl-wasm)
CJSON_PREFIX=$(realpath build/cjson-wasm) CJSON_PREFIX=$(realpath build/cjson-wasm)
CURL_PREFIX=$(realpath build/curl-wasm) CURL_PREFIX=$(realpath build/curl-wasm)
ZLIB_PREFIX=$(realpath build/zlib-wasm) ZLIB_PREFIX=$(realpath build/zlib-wasm)
BROTLI_PREFIX=$(realpath build/brotli-wasm) BROTLI_PREFIX=$(realpath build/brotli-wasm)
NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm)
if [ ! -d $WOLFSSL_PREFIX ]; then
tools/wolfssl.sh
fi
if [ ! -d $CJSON_PREFIX ]; then if [ ! -d $CJSON_PREFIX ]; then
tools/cjson.sh tools/cjson.sh
fi fi
@ -24,15 +19,10 @@ fi
if [ ! -d $BROTLI_PREFIX ]; then if [ ! -d $BROTLI_PREFIX ]; then
tools/brotli.sh tools/brotli.sh
fi fi
if [ ! -d $NGHTTP2_PREFIX ]; then
tools/nghttp2.sh
fi
if [ ! -d $CURL_PREFIX ]; then if [ ! -d $CURL_PREFIX ]; then
tools/curl.sh tools/curl.sh
fi fi
cp -r $WOLFSSL_PREFIX/* $CURL_PREFIX
cp -r $CJSON_PREFIX/* $CURL_PREFIX cp -r $CJSON_PREFIX/* $CURL_PREFIX
cp -r $ZLIB_PREFIX/* $CURL_PREFIX cp -r $ZLIB_PREFIX/* $CURL_PREFIX
cp -r $BROTLI_PREFIX/* $CURL_PREFIX cp -r $BROTLI_PREFIX/* $CURL_PREFIX
cp -r $NGHTTP2_PREFIX/* $CURL_PREFIX

View file

@ -7,14 +7,12 @@ set -e
CORE_COUNT=$(nproc --all) CORE_COUNT=$(nproc --all)
PREFIX=$(realpath build/curl-wasm) PREFIX=$(realpath build/curl-wasm)
WOLFSSL_PREFIX=$(realpath build/wolfssl-wasm)
ZLIB_PREFIX=$(realpath build/zlib-wasm) ZLIB_PREFIX=$(realpath build/zlib-wasm)
BROTLI_PREFIX=$(realpath build/brotli-wasm) BROTLI_PREFIX=$(realpath build/brotli-wasm)
NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm)
cd build cd build
rm -rf curl 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 cd curl
autoreconf -fi autoreconf -fi
@ -24,8 +22,8 @@ emconfigure ./configure --host i686-linux \
--enable-websockets --disable-ftp --disable-file --disable-gopher \ --enable-websockets --disable-ftp --disable-file --disable-gopher \
--disable-imap --disable-mqtt --disable-pop3 --disable-rtsp \ --disable-imap --disable-mqtt --disable-pop3 --disable-rtsp \
--disable-smb --disable-smtp --disable-telnet --disable-dict \ --disable-smb --disable-smtp --disable-telnet --disable-dict \
--with-wolfssl=$WOLFSSL_PREFIX --with-zlib=$ZLIB_PREFIX \ --with-zlib=$ZLIB_PREFIX --with-brotli=$BROTLI_PREFIX \
--with-brotli=$BROTLI_PREFIX --with-nghttp2=$NGHTTP2_PREFIX --without-ssl
emmake make -j$CORE_COUNT CFLAGS="-Oz" LIBS="-lbrotlicommon" emmake make -j$CORE_COUNT CFLAGS="-Oz" LIBS="-lbrotlicommon"

View file

@ -1,24 +0,0 @@
#!/bin/bash
#compile nghttp2 for use with emscripten
set -x
set -e
CORE_COUNT=$(nproc --all)
PREFIX=$(realpath build/nghttp2-wasm)
cd build
rm -rf nghttp2
git clone -b v1.63.0 --depth=1 https://github.com/nghttp2/nghttp2
cd nghttp2
rm -rf $PREFIX
mkdir -p $PREFIX
autoreconf -fi
emconfigure ./configure --host i686-linux --enable-static --disable-shared --enable-lib-only --prefix=$PREFIX
emmake make -j$CORE_COUNT
make install
cd ../../

View file

@ -1,29 +0,0 @@
#!/bin/bash
#compile wolfssl for use with emscripten
set -x
set -e
CORE_COUNT=$(nproc --all)
PREFIX=$(realpath build/wolfssl-wasm)
rm -rf $PREFIX
mkdir -p $PREFIX
cd build
rm -rf wolfssl
git clone -b v5.6.6-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"
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
rm -rf $PREFIX/bin
rm -rf $PREFIX/share
rm -rf $PREFIX/lib/pkgconfig
rm -rf $PREFIX/lib/*.la
cd ../../