graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix: keep a malformed TLS handshake from aborting the process
Cursor Agentee51f2182d4e
diff --git a/build.zig.zon b/build.zig.zonindex 8792aba6..a6f9a070 100644--- a/build.zig.zon+++ b/build.zig.zon@@ -8,8 +8,8 @@.hash = "accord-0.0.0-aQy1J3iBAgADDHWM0hIAXhISKtQ0zasFN7TyLhI_tkI8",},.http_zig = .{- .url = "git+https://github.com/justrach/http-zig#1d734eee07d3add6638b171adcc0da9f933d7902",- .hash = "http_zig-0.1.0-2CB7E-I9AgAXrxfMjTCoG9Q9RRwh3QhfEY4OXfhHWCiX",+ .url = "git+https://github.com/justrach/http-zig#1497076c4c26ac6c9598439ef55e9124f8091dba",+ .hash = "http_zig-0.1.0-2CB7E5o_AgDSwjkseaa3aIWEWTwev854XzkurPW4RLHI",},},.paths = .{""},diff --git a/src/http2_pool.zig b/src/http2_pool.zigindex 09b146d5..9459247b 100644--- a/src/http2_pool.zig+++ b/src/http2_pool.zig@@ -2,6 +2,7 @@//! latches HTTP/1.1. One session per origin; peer close redials inside Session.const std = @import("std");+const builtin = @import("builtin");const Io = std.Io;const http_zig = @import("http_zig");const main_mod = @import("main.zig");@@ -49,6 +50,18 @@ pub fn sessionFor(gpa: std.mem.Allocator, io: Io, host: []const u8, p: u16) !*htreturn s;}+/// Drop the process-wide session. Tests allocate it with `std.testing.allocator`.+pub fn resetForTest() void {+ if (!builtin.is_test) return;+ const live = session orelse return;+ const io = live.io;+ mu.lockUncancelable(io);+ defer mu.unlock(io);+ if (session) |current| current.close();+ session = null;+ host_len = 0;+}+test "want is https-only" {const saved = main_mod.g_http2;defer main_mod.g_http2 = saved;diff --git a/src/http_client_integration_tests.zig b/src/http_client_integration_tests.zigindex 553f3352..8d46098b 100644--- a/src/http_client_integration_tests.zig+++ b/src/http_client_integration_tests.zig@@ -130,9 +130,11 @@ test "real malformed TLS handshakes traverse both production constructor catchesvar server = try std.Io.net.IpAddress.listen(&address, io, .{});defer server.deinit(io);var accepted: std.atomic.Value(usize) = .init(0);- var server_future = io.async(serveInvalidTls, .{ io, &server, 2, &accepted });+ // The stream constructor probes HTTP/2 before std.http, so it accepts twice.+ var server_future = io.async(serveInvalidTls, .{ io, &server, 3, &accepted });defer server_future.await(io);defer releaseAccept(io, &server);+ defer @import("http2_pool.zig").resetForTest();var url_buf: [64]u8 = undefined;const url = try std.fmt.bufPrint(&url_buf, "https://127.0.0.1:{d}/v1/test", .{server.socket.address.getPort()});@@ -148,7 +150,7 @@ test "real malformed TLS handshakes traverse both production constructor catchesroot.sub = false;try std.testing.expectError(error.TlsRequestConstructionFailed, root.postStreamWithClient(&runtime.client, "{}"));try std.testing.expectEqual(@as(u64, 2), runtime.recovery.stats().active_id);- try std.testing.expectEqual(@as(usize, 2), accepted.load(.acquire));+ try std.testing.expectEqual(@as(usize, 3), accepted.load(.acquire));}test "TUI turn agent and actual runSub child share the recovered generation" {