Use system TLS trust
ASPL 0.7.0 · Current release
Native only. Use system TLS trust, with exact supplied sources, requirements, commands and outcomes.
On this page
Prepare the native host
Requires a peer at https://localhost:9443/hello with a certificate trusted by the host. A private untrusted local certificate produces http.tls_verify_failed and status 1. Missing or malformed system trust produces http.ca_load_failed.
Follow the deployment guide for certificates, CA selection, working directories and the complete upstream workflow.
Follow the HTTP guide and API reference. Keep the original filenames and the modules of the selected source variant. Save Arabic and English variants in separate directories. TLS inputs are supplied by the reader, with no bundled certificates or keys. No other data assets are required.
Arabic source
Execution: Native only · ASPL 0.7.0
- Native only. Published ASPL 0.7.0 on x86-64 Linux with glibc 2.34 or later. No input lines. Requires a peer at https://localhost:9443/hello with a certificate trusted by the host. A private untrusted local certificate produces http.tls_verify_failed and status 1. Missing or malformed system trust produces http.ca_load_failed.
Input: No input lines are required.
استورد أساسي::ويب.
دالة ابدأ_الرئيسية() -> ص64 {
دع طلب_صادر = ويب::أنشئ_طلب("GET", "https://localhost:9443/hello")::قيمة.
دع رد = ويب::اطلب(طلب_صادر, ويب::خيارات_طلب()).
إذا ليس رد::نجاح { اطبع(رد::الخطأ::الرمز). أرجع 1. }
اطبع(ويب::فك_نص(رد::قيمة::متن)::قيمة).
أرجع 0.
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download ثقة-افتراضية.لباتExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": "مرحبا من ASPL"
}
}English source
Execution: Native only · ASPL 0.7.0
- Native only. Published ASPL 0.7.0 on x86-64 Linux with glibc 2.34 or later. No input lines. Requires a peer at https://localhost:9443/hello with a certificate trusted by the host. A private untrusted local certificate produces http.tls_verify_failed and status 1. Missing or malformed system trust produces http.ca_load_failed.
Input: No input lines are required.
import core::http;
fn start_main() -> i64 {
let outbound = http::client_request("GET", "https://localhost:9443/hello")::value;
let reply = http::request(outbound, http::client_options());
if not reply::ok { print(reply::error::code); return 1; }
print(http::decode_utf8(reply::value::body)::value);
return 0;
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download default-trust.asplExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": "مرحبا من ASPL"
}
}Commands and outcomes
ar:
aspl check ar/default-trust.aspl
aspl run ar/default-trust.aspl
aspl build -o http-default-trust-ar-program ar/default-trust.aspl
./http-default-trust-ar-programen:
aspl check en/default-trust.aspl
aspl run en/default-trust.aspl
aspl build -o http-default-trust-en-program en/default-trust.aspl
./http-default-trust-en-programRun these commands from the parent of the separate ar/en source directories. With a trusted peer, the client prints its body without a trailing newline and exits with 0. With untrusted local material it prints the stable failure code and returns 1. Expected outcome details above come from the catalog. See the HTTP collection.
With an untrusted local certificate, output is exactly http.tls_verify_failed and process status is 1. Success prints مرحبا من ASPL and returns 0.