blob: e2eae4860451a2f61710ad3c1a442c19bc371792 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) Andrew Clayton
* Copyright (C) Timo Stark
* Copyright (C) F5, Inc.
*/
use unit_wasm::rusty::*;
#[no_mangle]
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
let ctx = &mut UWR_CTX_INITIALIZER();
uwr_init_ctx(ctx, addr, 4096);
uwr_write_str!(
ctx,
" * Welcome to WebAssembly in Rust on Unit! \
[libunit-wasm ({}.{}.{}/{:#010x})] *\n\n",
LUW_VERSION_MAJOR,
LUW_VERSION_MINOR,
LUW_VERSION_PATCH,
LUW_VERSION_NUMBER,
);
uwr_http_init_headers(ctx, 2, 0);
uwr_http_add_header_content_type(ctx, "text/plain");
uwr_http_add_header_content_len(ctx);
uwr_http_send_headers(ctx);
uwr_http_send_response(ctx);
uwr_http_response_end();
return 0;
}
|