| ... | @@ -336,6 +336,10 @@ pub const Response = struct { | ... | @@ -336,6 +336,10 @@ pub const Response = struct { |
| 336 | headers: http.Headers, | 336 | headers: http.Headers, |
| 337 | request: Request, | 337 | request: Request, |
| 338 | | 338 | |
| | 339 | pub fn deinit(res: *Response) void { |
| | 340 | res.server.allocator.destroy(res); |
| | 341 | } |
| | 342 | |
| 339 | /// Reset this response to its initial state. This must be called before handling a second request on the same connection. | 343 | /// Reset this response to its initial state. This must be called before handling a second request on the same connection. |
| 340 | pub fn reset(res: *Response) void { | 344 | pub fn reset(res: *Response) void { |
| 341 | res.request.headers.deinit(); | 345 | res.request.headers.deinit(); |
| ... | @@ -359,8 +363,6 @@ pub const Response = struct { | ... | @@ -359,8 +363,6 @@ pub const Response = struct { |
| 359 | if (res.request.parser.header_bytes_owned) { | 363 | if (res.request.parser.header_bytes_owned) { |
| 360 | res.request.parser.header_bytes.deinit(res.server.allocator); | 364 | res.request.parser.header_bytes.deinit(res.server.allocator); |
| 361 | } | 365 | } |
| 362 | | | |
| 363 | res.server.allocator.destroy(res); | | |
| 364 | } else { | 366 | } else { |
| 365 | res.request.parser.reset(); | 367 | res.request.parser.reset(); |
| 366 | } | 368 | } |