Skip to content

Commit 955dbca

Browse files
committed
std.crypto.tls.Client: handle extra data after handshake
1 parent 947d57f commit 955dbca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/std/crypto/tls/Client.zig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,16 @@ pub fn init(stream: net.Stream, ca_bundle: Certificate.Bundle, host: []const u8)
583583
});
584584
},
585585
};
586-
std.debug.print("remaining bytes: {d}\n", .{len - end});
587-
return .{
586+
var client: Client = .{
588587
.application_cipher = app_cipher,
589588
.read_seq = 0,
590589
.write_seq = 0,
591590
.partially_read_buffer = undefined,
592-
.partially_read_len = 0,
591+
.partially_read_len = @intCast(u15, len - end),
593592
.eof = false,
594593
};
594+
mem.copy(u8, &client.partially_read_buffer, handshake_buf[len..end]);
595+
return client;
595596
},
596597
else => {
597598
return error.TlsUnexpectedMessage;

0 commit comments

Comments
 (0)