The project aims to compile libcurl with SSL support (OpenSSL) to WebAssembly target using WASI interfaces.
The goal of the project is to identify any gaps (performance, features) in WebAssembly/WASI to run HTTPS clients (and other clients) completely on top of WebAssembly runtime. Whereas having a full HTTPS stack implemented in WebAssembly might sound questionable, there are scenarios where the approach makes sense.
The project uses WebAssembly Micro Runtime (WAMR) WASI socket extension until the wasi-sockets proposal is not finalized.
The project was only tested on Ubuntu 20.04 and 22.04. It will most likely compile on other Linux distributions. Windows / MacOS probably doesn't work out of the box. Contributions are very welcome.
- Protocols: DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS MQTT POP3 POP3S RTSP SMTP SMTPS TELNET TFTP
- SSL
- IPv6
- AsynchDNS
- Largefile
- alt-svc
- HSTS
- NTLM
- HTTPS-proxy
- threadsafe
- CURL executable
- compression (zlib)
- WebSocket
- compression (brotli)
- c-ares
- ...
Dependent projects required patching in order to compile. All the patches can be found in the libs/*/*.patch
. Some of the changes can be applied to upstream repositories (and we will propose them to maintainers), but some are WAMR-specific and can be removed once the wasi-sockets proposal is implemented.
- Install dependencies
sudo apt install -y cmake
- Initialize submodules
git submodule update --init --recursive --depth 1
- Configure project
This internally downloads WASI SDK and runs
cmake
command to configure the project.
./configure.sh
- Compile code
cmake --build build
Run the command:
cmake --install build
The compiled libraries, executables and include headers will be available in the install/
directory.
Some of the examples using libcurl can be found in tests. To run examples using WAMR, execute the command:
cmake --build build --target test
Please note the tests require valid ssl certificates to be located in build/libs_instal/ssl/certs
. They can be copied from the system path, e.g. on Ubuntu it's (add -L
flag to resolve symlinks):
cp -Lr /etc/ssl/certs/* build/libs_install/ssl/certs/
This code sample is released under the MIT license. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.