From 1c1de31c1ac62bf8f8944acd1c0020873d8acba8 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 10 Feb 2023 10:47:19 +0100 Subject: [PATCH] net::http::do: prepare read buffer --- net/http/do.ha | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/http/do.ha b/net/http/do.ha index 851da13..09c1743 100644 --- a/net/http/do.ha +++ b/net/http/do.ha @@ -20,7 +20,7 @@ export fn do(client: *client, req: *request) (response | error) = { fmt::fprintf(&file, "{} ", req.method)?; // 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)?; 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)?; }; + // Switch buffer to read mode + file = bufio::buffered(conn, buf, []); + // TODO: Parse resposne return response { body = conn,