From 9beca3a995a8ff2ea4b8ce477ecc2104bac89c0f Mon Sep 17 00:00:00 2001 From: zach Date: Wed, 7 Feb 2024 14:32:58 -0800 Subject: [PATCH 1/2] feat: allow max HTTP request size to be configured in the manifest --- src/manifest.zig | 2 +- src/plugin.zig | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/manifest.zig b/src/manifest.zig index a593248..231fc4a 100644 --- a/src/manifest.zig +++ b/src/manifest.zig @@ -31,7 +31,7 @@ pub const Wasm = union(enum) { pub const Manifest = struct { wasm: []const Wasm, - memory: ?struct { max_pages: ?u32 } = null, + memory: ?struct { max_pages: ?u32, max_http_response_bytes: ?u32 } = null, config: ?std.json.ArrayHashMap([]const u8) = null, allowed_hosts: ?[]const []const u8 = null, allowed_paths: ?std.json.ArrayHashMap([]const u8) = null, diff --git a/src/plugin.zig b/src/plugin.zig index 23c8226..8d9dc33 100644 --- a/src/plugin.zig +++ b/src/plugin.zig @@ -92,3 +92,9 @@ pub fn hasFunction(self: Self, function_name: []const u8) bool { const res = c.extism_plugin_function_exists(self.ptr, function_name.ptr); return res; } + +pub fn TypedPlugin(comptime functions: []type) type { + return struct { + functions: functions, + }; +} From f953df82ba62b895c4cc7b9975736fd8c13ce562 Mon Sep 17 00:00:00 2001 From: zach Date: Thu, 8 Feb 2024 10:48:41 -0800 Subject: [PATCH 2/2] cleanup: use u64 for max http response size, remove unrelated code --- src/manifest.zig | 2 +- src/plugin.zig | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/manifest.zig b/src/manifest.zig index 231fc4a..53398d1 100644 --- a/src/manifest.zig +++ b/src/manifest.zig @@ -31,7 +31,7 @@ pub const Wasm = union(enum) { pub const Manifest = struct { wasm: []const Wasm, - memory: ?struct { max_pages: ?u32, max_http_response_bytes: ?u32 } = null, + memory: ?struct { max_pages: ?u32, max_http_response_bytes: ?u64 } = null, config: ?std.json.ArrayHashMap([]const u8) = null, allowed_hosts: ?[]const []const u8 = null, allowed_paths: ?std.json.ArrayHashMap([]const u8) = null, diff --git a/src/plugin.zig b/src/plugin.zig index 8d9dc33..23c8226 100644 --- a/src/plugin.zig +++ b/src/plugin.zig @@ -92,9 +92,3 @@ pub fn hasFunction(self: Self, function_name: []const u8) bool { const res = c.extism_plugin_function_exists(self.ptr, function_name.ptr); return res; } - -pub fn TypedPlugin(comptime functions: []type) type { - return struct { - functions: functions, - }; -}