wasmtime
wasmtime copied to clipboard
wasi-http: add the port to authority when opening a TCP connection
#8563 removes the port from the authority, it makes the target address cannot be correctly resolved when opening a TCP connection. This results in that if we want to send an HTTP request in the wasi component, an error ErrorCode::ConnectionRefused will be reported directly. The underlying error is invalid socket address:
/cc @alexcrichton @elliottt
What if the program explicitly specified a port different from 80 or 443? Wouldn't this change break that by creating a nonsensical address like 127.0.0.1:1234:80 when trying to request http://127.0.0.1:1234/some_page?
What if the program explicitly specified a port different from 80 or 443? Wouldn't this change break that by creating a nonsensical address like
127.0.0.1:1234:80when trying to requesthttp://127.0.0.1:1234/some_page?
Indeed, I didn't consider that. I will update it again.
Does this mean that default_send_request_handler basically previously didn't work by default? If so, that seems bad!
Would you be up for adding a test for this?
Does this mean that
default_send_request_handlerbasically previously didn't work by default? If so, that seems bad!Would you be up for adding a test for this?
I think that that is the case, could we have a fix like this one on a 21.0.1 version?
Yeah, definitely seems bad enough for a point release! Would you be up for adding a test here? perhaps fetching something like example.com or similar? That'll be flaky over time but we can try to add various exceptions for possible errors due to flakiness over time.
I have added a test for this case, following @elliottt's advice in https://github.com/bytecodealliance/wasmtime/pull/8676#discussion_r1609131895, PTAL @alexcrichton @elliottt
Could you remove the use of ssl in your test program? CI failed because it's not supported on riscv64.
Ah I went ahead and just pushed up a commit to ignore s390x/riscv64, I don't think it's too critical to get all the architectures tested here