add target to interface
Some checks failed
Build / build (push) Successful in 1m35s
Build / sign (push) Failing after 18s
Build / deploy (push) Successful in 37s

This commit is contained in:
Emil Lerch 2023-10-03 13:27:18 -07:00
parent 3097adb6e0
commit 05115af93a
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
4 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,7 @@
# <http header key>: <header match prefix> <path match prefix> # <http header key>: <header match prefix> <path match prefix>
Host: iam / = zig-out/lib/libflexilib-sample-lib.so Host: iam / = zig-out/lib/libflexilib-sample-lib.so
/c = zig-out/lib/libflexilib-in-c.so /c = zig-out/lib/libflexilib-in-c.so
/universal = zig-out/lib/libuniversal-lambda-example.so
/ = zig-out/lib/libflexilib-sample-lib.so / = zig-out/lib/libflexilib-sample-lib.so
# JS-based Cloudflare worker: 0.051s +/- 0.002s (50ms) # JS-based Cloudflare worker: 0.051s +/- 0.002s (50ms)

View File

@ -17,6 +17,9 @@ pub const Response = extern struct {
}; };
pub const Request = extern struct { pub const Request = extern struct {
target: [*]const u8,
target_len: usize,
method: [*:0]u8, method: [*:0]u8,
method_len: usize, method_len: usize,

View File

@ -92,6 +92,8 @@ test "handle_request" {
.value_len = 3, .value_len = 3,
}}); }});
var req = interface.Request{ var req = interface.Request{
.target = @ptrCast(@constCast("/".ptr)),
.target_len = 1,
.method = @ptrCast(@constCast("GET".ptr)), .method = @ptrCast(@constCast("GET".ptr)),
.method_len = 3, .method_len = 3,
.content = @ptrCast(@constCast("GET".ptr)), .content = @ptrCast(@constCast("GET".ptr)),

View File

@ -82,6 +82,9 @@ fn serve(allocator: *std.mem.Allocator, response: *std.http.Server.Response) !*F
} }
log.debug("{d} bytes read from request", .{request_content.len}); log.debug("{d} bytes read from request", .{request_content.len});
var request = interface.Request{ var request = interface.Request{
.target = response.request.target.ptr,
.target_len = response.request.target.len,
.method = @constCast(method_tag[0..].ptr), .method = @constCast(method_tag[0..].ptr),
.method_len = method_tag.len, .method_len = method_tag.len,