net._build_sa, str.from_i64_buf

This commit is contained in:
2026-06-04 21:35:02 +02:00
parent 0b1b424478
commit 803aee772e
3 changed files with 85 additions and 96 deletions

View File

@@ -34,14 +34,14 @@ func main[argc: i64, argv: ptr] : i64
if !ok
panic("failed to connect")
// TODO: add string builder to std
req := "GET "
req = str.concat(req, path)
req = str.concat(req, " HTTP/1.0\r\nHost: ")
req = str.concat(req, host)
req = str.concat(req, "\r\nConnection: close\r\n\r\n")
net.send(s, req as ptr, str.len(req))
mem.free(req)
req := new str.Builder
str.Builder.append(req, "GET ")
str.Builder.append(req, path)
str.Builder.append(req, " HTTP/1.0\r\nHost: ")
str.Builder.append(req, host)
str.Builder.append(req, "\r\nConnection: close\r\n\r\n")
net.send(s, req->data, req->size)
mem.free(req->data)
header_buf := mem.alloc(8192) as str
header_size := 0