1
Fork 0

net::http::do: prepare read buffer

This commit is contained in:
Drew DeVault 2023-02-10 10:47:19 +01:00
parent a567ff4418
commit 1c1de31c1a

View file

@ -20,7 +20,7 @@ export fn do(client: *client, req: *request) (response | error) = {
fmt::fprintf(&file, "{} ", req.method)?; fmt::fprintf(&file, "{} ", req.method)?;
// TODO: Support other request-targets than origin-form // TODO: Support other request-targets than origin-form
let target = uri_origin_form(req.target); const target = uri_origin_form(req.target);
uri::fmt(&file, &target)?; uri::fmt(&file, &target)?;
fmt::fprintf(&file, " HTTP/1.1\r\n")?; fmt::fprintf(&file, " HTTP/1.1\r\n")?;
@ -40,6 +40,9 @@ export fn do(client: *client, req: *request) (response | error) = {
io::copy(conn, body)?; io::copy(conn, body)?;
}; };
// Switch buffer to read mode
file = bufio::buffered(conn, buf, []);
// TODO: Parse resposne // TODO: Parse resposne
return response { return response {
body = conn, body = conn,