aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/Server.zig
diff options
context:
space:
mode:
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();
}