add target to interface
This commit is contained in:
		
							parent
							
								
									3097adb6e0
								
							
						
					
					
						commit
						05115af93a
					
				
					 4 changed files with 9 additions and 0 deletions
				
			
		|  | @ -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) | ||||||
|  |  | ||||||
|  | @ -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, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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)), | ||||||
|  |  | ||||||
|  | @ -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, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue