| ... | ... | @@ -571,6 +571,30 @@ pub fn main() !void { |
| 571 | 571 | // connection has been kept alive |
| 572 | 572 | try testing.expect(client.connection_pool.free_len == 1); |
| 573 | 573 | |
| 574 | { // issue 16282 |
| 575 | const location = try std.fmt.allocPrint(calloc, "http://127.0.0.1:{d}/get", .{port}); |
| 576 | defer calloc.free(location); |
| 577 | const uri = try std.Uri.parse(location); |
| 578 | |
| 579 | const total_connections = client.connection_pool.free_size + 64; |
| 580 | var requests = try calloc.alloc(http.Client.Request, total_connections); |
| 581 | defer calloc.free(requests); |
| 582 | |
| 583 | for (0..total_connections) |i| { |
| 584 | var req = try client.request(.GET, uri, .{ .allocator = calloc }, .{}); |
| 585 | req.response.parser.done = true; |
| 586 | req.connection.?.data.closing = false; |
| 587 | requests[i] = req; |
| 588 | } |
| 589 | |
| 590 | for (0..total_connections) |i| { |
| 591 | requests[i].deinit(); |
| 592 | } |
| 593 | |
| 594 | // free connections should be full now |
| 595 | try testing.expect(client.connection_pool.free_len == client.connection_pool.free_size); |
| 596 | } |
| 597 | |
| 574 | 598 | client.deinit(); |
| 575 | 599 | |
| 576 | 600 | killServer(server.socket.listen_address); |