From b0db514adceb9869fd1c6cd6299bc8fc1286e092 Mon Sep 17 00:00:00 2001 From: jaina heartles Date: Mon, 19 Dec 2022 05:42:26 -0800 Subject: [PATCH] Make helper functions public --- src/http/request/parser.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/http/request/parser.zig b/src/http/request/parser.zig index f10b72d..114b6c0 100644 --- a/src/http/request/parser.zig +++ b/src/http/request/parser.zig @@ -277,7 +277,7 @@ fn isTokenChar(ch: u8) bool { // Parses a quoted-string (rfc 9110) off the stream. Backslash-tokens are unescaped. // The caller takes responsibility for deallocating the memory returned. -fn parseQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 { +pub fn parseQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 { const reader = peek_stream.reader(); var data = std.ArrayList(u8).init(alloc); @@ -345,7 +345,7 @@ test "parseQuotedString" { // Attempts to parse a token (rfc 9110) off the stream. It stops at the first non-token // char. Said char reamins on the stream. If the token is empty, returns error.EmptyToken; // The caller takes responsibility for deallocating the memory returned. -fn parseToken(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 { +pub fn parseToken(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 { var data = std.ArrayList(u8).init(alloc); errdefer data.deinit(); @@ -396,7 +396,7 @@ test "parseToken" { // Parses a token or quoted string (rfc 9110) off the stream, as appropriate. // The caller takes responsibility for deallocating the memory returned. -fn parseTokenOrQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 { +pub fn parseTokenOrQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 { return parseToken(alloc, peek_stream) catch |err| switch (err) { error.EmptyToken => return try parseQuotedString(alloc, peek_stream), else => |e| return e,