use explicit splitScalar
Some checks failed
AWS-Zig Build / build-zig-amd64-host (push) Successful in 3m6s
aws-zig mach nominated build / build-zig-nominated-mach-latest (push) Successful in 3m7s
aws-zig nightly build / build-zig-nightly (push) Failing after 48s

This commit is contained in:
Emil Lerch 2024-07-01 13:45:29 -07:00
parent e665b94683
commit f558b058e1
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 3 additions and 3 deletions

View File

@ -392,7 +392,7 @@ fn verifyParsedAuthorization(
// Credential=ACCESS/20230908/us-west-2/s3/aws4_request // Credential=ACCESS/20230908/us-west-2/s3/aws4_request
// SignedHeaders=accept;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-storage-class // SignedHeaders=accept;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-storage-class
// Signature=fcc43ce73a34c9bd1ddf17e8a435f46a859812822f944f9eeb2aabcd64b03523 // Signature=fcc43ce73a34c9bd1ddf17e8a435f46a859812822f944f9eeb2aabcd64b03523
var credential_iterator = std.mem.split(u8, credential, "/"); var credential_iterator = std.mem.splitScalar(u8, credential, '/');
const access_key = credential_iterator.next().?; const access_key = credential_iterator.next().?;
const credentials = credentials_fn(access_key) orelse return error.CredentialsNotFound; const credentials = credentials_fn(access_key) orelse return error.CredentialsNotFound;
// TODO: https://stackoverflow.com/questions/29276609/aws-authentication-requires-a-valid-date-or-x-amz-date-header-curl // TODO: https://stackoverflow.com/questions/29276609/aws-authentication-requires-a-valid-date-or-x-amz-date-header-curl
@ -750,7 +750,7 @@ fn canonicalQueryString(allocator: std.mem.Allocator, path: []const u8) ![]const
const query = path[first_question.? + 1 ..]; const query = path[first_question.? + 1 ..];
// Split this by component // Split this by component
var portions = std.mem.split(u8, query, "&"); var portions = std.mem.splitScalar(u8, query, '&');
var sort_me = std.ArrayList([]const u8).init(allocator); var sort_me = std.ArrayList([]const u8).init(allocator);
defer sort_me.deinit(); defer sort_me.deinit();
while (portions.next()) |item| while (portions.next()) |item|

View File

@ -371,7 +371,7 @@ fn proxyFromString(string: []const u8) !std.http.Client.Proxy {
rc.port = 443; rc.port = 443;
rc.protocol = .tls; rc.protocol = .tls;
} else return error.InvalidScheme; } else return error.InvalidScheme;
var split_iterator = std.mem.split(u8, remaining, ":"); var split_iterator = std.mem.splitScalar(u8, remaining, ':');
rc.host = std.mem.trimRight(u8, split_iterator.first(), "/"); rc.host = std.mem.trimRight(u8, split_iterator.first(), "/");
if (split_iterator.next()) |port| if (split_iterator.next()) |port|
rc.port = try std.fmt.parseInt(u16, port, 10); rc.port = try std.fmt.parseInt(u16, port, 10);