From f558b058e1a9d1d8366ea5471eac3b086350ac63 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 1 Jul 2024 13:45:29 -0700 Subject: [PATCH] use explicit splitScalar --- src/aws_signing.zig | 4 ++-- src/main.zig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aws_signing.zig b/src/aws_signing.zig index 966fc88..925f1b6 100644 --- a/src/aws_signing.zig +++ b/src/aws_signing.zig @@ -392,7 +392,7 @@ fn verifyParsedAuthorization( // 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 // 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 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 @@ -750,7 +750,7 @@ fn canonicalQueryString(allocator: std.mem.Allocator, path: []const u8) ![]const const query = path[first_question.? + 1 ..]; // 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); defer sort_me.deinit(); while (portions.next()) |item| diff --git a/src/main.zig b/src/main.zig index 811dca9..6eb2fdc 100644 --- a/src/main.zig +++ b/src/main.zig @@ -371,7 +371,7 @@ fn proxyFromString(string: []const u8) !std.http.Client.Proxy { rc.port = 443; rc.protocol = .tls; } 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(), "/"); if (split_iterator.next()) |port| rc.port = try std.fmt.parseInt(u16, port, 10);