aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/Server.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-23 06:29:46 -0700
committerGitHub <noreply@github.com>2023-04-23 06:29:46 -0700
commit1884be4ecd2bf5458afedbc73eb3286a8b1b2d18 (patch)
tree27aa7f425b40a8f7b8e9392e19dec3c91d8b75a1 /lib/std/http/Server.zig
parentb95cdf0aeb4d4d31c0b6a54302ef61baec8f6773 (diff)
parentafebef2465a828132f87cd2aeff0c5873ca10de5 (diff)
downloadzig-1884be4ecd2bf5458afedbc73eb3286a8b1b2d18.tar.gz
zig-1884be4ecd2bf5458afedbc73eb3286a8b1b2d18.zip
Merge pull request #15372 from nwtgck/fix-http-client
Diffstat (limited to 'lib/std/http/Server.zig')
-rw-r--r--lib/std/http/Server.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig
index 445a10bf48..59b76ea20d 100644
--- a/lib/std/http/Server.zig
+++ b/lib/std/http/Server.zig
@@ -336,8 +336,15 @@ pub const Response = struct {
headers: http.Headers,
request: Request,
+ pub fn deinit(res: *Response) void {
+ res.server.allocator.destroy(res);
+ }
+
/// Reset this response to its initial state. This must be called before handling a second request on the same connection.
pub fn reset(res: *Response) void {
+ res.request.headers.deinit();
+ res.headers.deinit();
+
switch (res.request.compression) {
.none => {},
.deflate => |*deflate| deflate.deinit(),
@@ -356,8 +363,6 @@ pub const Response = struct {
if (res.request.parser.header_bytes_owned) {
res.request.parser.header_bytes.deinit(res.server.allocator);
}
-
- res.* = undefined;
} else {
res.request.parser.reset();
}