diff --git a/net/http/client.ha b/net/http/client.ha index bf2a4bd..4eac8ab 100644 --- a/net/http/client.ha +++ b/net/http/client.ha @@ -48,6 +48,7 @@ fn new_request(client: *client, method: str, target: *uri::uri) request = { method = method, target = alloc(uri::dup(target)), header = header_dup(&client.default_header), + transport = null, body = void, }; if (req.target.port == 0) { diff --git a/net/http/do.ha b/net/http/do.ha index 7720dcc..1d68da7 100644 --- a/net/http/do.ha +++ b/net/http/do.ha @@ -33,6 +33,18 @@ export fn do(client: *client, req: *request) (response | error) = { fmt::fprintf(&file, "\r\n")?; bufio::flush(&file)?; + const trans = match (req.transport) { + case let t: *transport => + yield t; + case => + yield &client.default_transport; + }; + // TODO: Implement None + assert(trans.request_transport == transport_mode::AUTO); + assert(trans.response_transport == transport_mode::AUTO); + assert(trans.request_content == content_mode::AUTO); + assert(trans.response_content == content_mode::AUTO); + match (req.body) { case let body: io::handle => io::copy(conn, body)?;