most requests working (see below)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			rest_json_1_work_with_lambda seems to fail STS-generated keys not working there might be an intermittent signature failure
This commit is contained in:
		
							parent
							
								
									acba4d7962
								
							
						
					
					
						commit
						e66c82468a
					
				
					 3 changed files with 20 additions and 14 deletions
				
			
		|  | @ -129,14 +129,15 @@ pub const AwsHttp = struct { | |||
|         defer if (len) |l| self.allocator.free(l); | ||||
|         request_cp.headers = request_headers.items; | ||||
| 
 | ||||
|         log.debug("All Request Headers (before signing. Count: {d}):", .{request_cp.headers.len}); | ||||
|         for (request_cp.headers) |h| | ||||
|             log.debug("\t{s}: {s}", .{ h.name, h.value }); | ||||
|         // Signing will alter request headers | ||||
|         // log.debug("All Request Headers (before signing. Count: {d}):", .{request_cp.headers.len}); | ||||
|         // for (request_cp.headers) |h| { | ||||
|         //     log.debug("\t{s}: {s}", .{ h.name, h.value }); | ||||
|         // } | ||||
|         if (signing_config) |opts| request_cp = try signing.signRequest(self.allocator, request_cp, opts); | ||||
|         log.debug("All Request Headers (after signing):", .{}); | ||||
|         for (request_cp.headers) |h| | ||||
|             log.debug("\t{s}: {s}", .{ h.name, h.value }); | ||||
|         // log.debug("All Request Headers (after signing):", .{}); | ||||
|         // for (request_cp.headers) |h| { | ||||
|         //     log.debug("\t{s}: {s}", .{ h.name, h.value }); | ||||
|         // } | ||||
|         defer { | ||||
|             if (signing_config) |opts| { | ||||
|                 signing.freeSignedRequest(self.allocator, &request_cp, opts); | ||||
|  | @ -150,12 +151,16 @@ pub const AwsHttp = struct { | |||
|         for (request_cp.headers) |header| | ||||
|             try headers.appendValue(header.name, header.value); | ||||
|         log.debug("All Request Headers (zfetch):", .{}); | ||||
|         for (headers.list.items) |h| | ||||
|         for (headers.list.items) |h| { | ||||
|             log.debug("\t{s}: {s}", .{ h.name, h.value }); | ||||
|         } | ||||
| 
 | ||||
|         // TODO: Construct URL with endpoint and request info | ||||
|         // TODO: We need the certificate trust chain | ||||
|         var req = try zfetch.Request.init(self.allocator, "https://sts.us-west-2.amazonaws.com/", null); | ||||
|         const url = try std.fmt.allocPrint(self.allocator, "{s}{s}", .{ endpoint.uri, request.path }); | ||||
|         defer self.allocator.free(url); | ||||
|         log.debug("Request url: {s}", .{url}); | ||||
|         var req = try zfetch.Request.init(self.allocator, url, null); | ||||
|         defer req.deinit(); | ||||
| 
 | ||||
|         const method = std.meta.stringToEnum(zfetch.Method, request_cp.method).?; | ||||
|  |  | |||
|  | @ -165,8 +165,6 @@ pub fn signRequest(allocator: std.mem.Allocator, request: base.Request, config: | |||
|         .value = signing_iso8601, | ||||
|     }; | ||||
|     rc.headers = newheaders[0 .. newheaders.len - 1]; | ||||
|     for (rc.headers) |h| | ||||
|         std.log.debug("{d}/{d}", .{ h.name.len, h.value.len }); | ||||
|     log.debug("Signing with access key: {s}", .{config.credentials.access_key}); | ||||
|     const canonical_request = try createCanonicalRequest(allocator, rc, config); | ||||
|     defer { | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ const aws = @import("aws.zig"); | |||
| const json = @import("json.zig"); | ||||
| const version = @import("git_version.zig"); | ||||
| 
 | ||||
| var verbose = true; | ||||
| var verbose: u8 = 0; | ||||
| 
 | ||||
| pub fn log( | ||||
|     comptime level: std.log.Level, | ||||
|  | @ -11,8 +11,11 @@ pub fn log( | |||
|     comptime format: []const u8, | ||||
|     args: anytype, | ||||
| ) void { | ||||
|     // Ignore aws_signing messages | ||||
|     if (verbose < 2 and scope == .aws_signing and @enumToInt(level) >= @enumToInt(std.log.Level.debug)) | ||||
|         return; | ||||
|     // Ignore awshttp messages | ||||
|     if (!verbose and scope == .awshttp and @enumToInt(level) >= @enumToInt(std.log.Level.debug)) | ||||
|     if (verbose < 1 and scope == .awshttp and @enumToInt(level) >= @enumToInt(std.log.Level.debug)) | ||||
|         return; | ||||
|     const scope_prefix = "(" ++ @tagName(scope) ++ "): "; | ||||
|     const prefix = "[" ++ @tagName(level) ++ "] " ++ scope_prefix; | ||||
|  | @ -52,7 +55,7 @@ pub fn main() anyerror!void { | |||
|             std.log.info("{s} {s}", .{ arg, version.pretty_version }); | ||||
|         first = false; | ||||
|         if (std.mem.eql(u8, "-v", arg)) { | ||||
|             verbose = true; | ||||
|             verbose += 1; | ||||
|             continue; | ||||
|         } | ||||
|         inline for (@typeInfo(Tests).Enum.fields) |f| { | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue