net::http::do: place buffer on stack
We can afford 4K of stack space
This commit is contained in:
parent
8ccb846c55
commit
859c8dc06e
|
@ -9,18 +9,14 @@ use os;
|
|||
type context = struct {
|
||||
conn: io::handle,
|
||||
file: bufio::bufstream,
|
||||
buf: []u8,
|
||||
buf: [os::BUFSIZ]u8,
|
||||
};
|
||||
|
||||
// Performs an HTTP [[request]] with the given [[client]]. The request is
|
||||
// performed synchronously; this function blocks until the server has returned
|
||||
// the response status and all HTTP headers associated with the response.
|
||||
export fn do(client: *client, req: *request) (response | error) = {
|
||||
let ctx = context {
|
||||
buf = alloc([0...], os::BUFSIZ),
|
||||
...
|
||||
};
|
||||
defer free(ctx.buf);
|
||||
let ctx = context { ... };
|
||||
|
||||
assert(req.target.scheme == "http"); // TODO: https
|
||||
const conn = dial::dial_uri("tcp", req.target)?;
|
||||
|
|
Loading…
Reference in a new issue