aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-12-29 18:56:51 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-01-02 16:57:16 -0700
commit05fee3b22b593c6b0829499b53f26f5750df3645 (patch)
tree7932bddde29fead3aae19c7ea5f078be2d70f3e0 /lib/std
parent22e2aaa283646858502ac1075c9657383366005d (diff)
downloadzig-05fee3b22b593c6b0829499b53f26f5750df3645.tar.gz
zig-05fee3b22b593c6b0829499b53f26f5750df3645.zip
std.crypto.tls.Client: fix eof logic
Before this, it incorrectly returned true when there was still cleartext to be read.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/crypto/tls/Client.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/crypto/tls/Client.zig b/lib/std/crypto/tls/Client.zig
index 2eb5923187..6260995685 100644
--- a/lib/std/crypto/tls/Client.zig
+++ b/lib/std/crypto/tls/Client.zig
@@ -754,7 +754,9 @@ pub fn writeAll(c: *Client, stream: net.Stream, bytes: []const u8) !void {
}
pub fn eof(c: Client) bool {
- return c.received_close_notify and c.partial_ciphertext_idx >= c.partial_ciphertext_end;
+ return c.received_close_notify and
+ c.partial_cleartext_idx >= c.partial_ciphertext_idx and
+ c.partial_ciphertext_idx >= c.partial_ciphertext_end;
}
/// Returns the number of bytes read, calling the underlying read function the