aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/protocol.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-11-08 02:01:52 -0500
committerGitHub <noreply@github.com>2024-11-08 02:01:52 -0500
commite5f5229fd6f9d0fe684ab32cce8f2b18e02c115b (patch)
treec9fb5a5324d741042de3c581d8719bb2b27c889a /lib/std/http/protocol.zig
parentee9f00d673f2bccddc2751c328758a2820d2bb70 (diff)
parent9373abf7f77c37094f9ba6ca68287d8a06ebafa0 (diff)
downloadzig-e5f5229fd6f9d0fe684ab32cce8f2b18e02c115b.tar.gz
zig-e5f5229fd6f9d0fe684ab32cce8f2b18e02c115b.zip
Merge pull request #21872 from jacobly0/tlsv1.2
std.crypto.tls: implement TLSv1.2
Diffstat (limited to 'lib/std/http/protocol.zig')
-rw-r--r--lib/std/http/protocol.zig24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/std/http/protocol.zig b/lib/std/http/protocol.zig
index 78511f435d..c56d3a24a1 100644
--- a/lib/std/http/protocol.zig
+++ b/lib/std/http/protocol.zig
@@ -172,7 +172,13 @@ pub const HeadersParser = struct {
const data_avail = r.next_chunk_length;
if (skip) {
- try conn.fill();
+ conn.fill() catch |err| switch (err) {
+ error.EndOfStream => {
+ r.done = true;
+ return 0;
+ },
+ else => |e| return e,
+ };
const nread = @min(conn.peek().len, data_avail);
conn.drop(@intCast(nread));
@@ -196,7 +202,13 @@ pub const HeadersParser = struct {
}
},
.chunk_data_suffix, .chunk_data_suffix_r, .chunk_head_size, .chunk_head_ext, .chunk_head_r => {
- try conn.fill();
+ conn.fill() catch |err| switch (err) {
+ error.EndOfStream => {
+ r.done = true;
+ return 0;
+ },
+ else => |e| return e,
+ };
const i = r.findChunkedLen(conn.peek());
conn.drop(@intCast(i));
@@ -226,7 +238,13 @@ pub const HeadersParser = struct {
const out_avail = buffer.len - out_index;
if (skip) {
- try conn.fill();
+ conn.fill() catch |err| switch (err) {
+ error.EndOfStream => {
+ r.done = true;
+ return 0;
+ },
+ else => |e| return e,
+ };
const nread = @min(conn.peek().len, data_avail);
conn.drop(@intCast(nread));