I was playing with wasmedge + quickjs last night (thank you all for the great work here!) when I ran into an error with the http fetch examples.
Each one returned "InternalError: invalid socket address syntax"
After digging around on the internet I stumbled on to_socket_addrs (line 475 in src/internal_module/wasi_net_module.rs) as the culprit.
Changing this line to the following:
diff --git a/src/internal_module/wasi_net_module.rs b/src/internal_module/wasi_net_module.rs
index 3991f33..764ddb7 100644
--- a/src/internal_module/wasi_net_module.rs
+++ b/src/internal_module/wasi_net_module.rs
@@ -472,7 +472,7 @@ fn js_nsloopup(ctx: &mut Context, _this: JsValue, param: &[JsValue]) -> JsValue
let node = param.get(0);
let service = param.get(1);
if let (Some(JsValue::String(node)), Some(JsValue::String(service))) = (node, service) {
- let r = format!("{}:{}", node.as_str(), service.as_str()).to_socket_addrs();
+ let r = (node.as_str(), service.as_str().parse::<u16>().unwrap_or(0)).to_socket_addrs();
match r {
Ok(addr_vec) => {
let mut array = ctx.new_array();
did the trick and I was able to run the http fetch tests successfully on my Mac.
I was playing with wasmedge + quickjs last night (thank you all for the great work here!) when I ran into an error with the http fetch examples.
Each one returned "InternalError: invalid socket address syntax"
After digging around on the internet I stumbled on
to_socket_addrs
(line 475 in src/internal_module/wasi_net_module.rs) as the culprit.Changing this line to the following:
did the trick and I was able to run the http fetch tests successfully on my Mac.