#Is the server header buffer always stack allocated in std.http.Client.fetch?

1 messages · Page 1 of 1 (latest)

undone ocean
#

While trying to figure out how to make an idiomatic HTTP request, I couldn't find any examples, so I was browsing std.http.Client.fetch to see what was available. While reviewing that code, I noticed these lines and wondered if this means that even if one does provide their own buffer for the server headers via options, does this mean that 16k buffer is still stack allocated?

https://github.com/ziglang/zig/blob/e98aeeb73fba942c8e061bb8158ed073a7b19e1d/lib/std/http/Client.zig#L1748-L1754

I'm a complete newbie to zig (just ran zig init for first time this morning) and non-garbage collected languages, so please be gentle as I may be using terminology incorrectly. Thank you!

cedar thicket
#

yes the buffer is still there, it just isn’t used if you provide your own

#

stack space is relatively cheap, so it doesn’t hurt anything