diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-12-22 12:50:46 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-12-22 12:50:46 +0100 |
| commit | aa0249d74e573742db3567f589fc6e4a00e1fff8 (patch) | |
| tree | cce61cb7f02072d205a12ae451922f0bf09c13ce /lib/std/http/HeaderIterator.zig | |
| parent | 6b9125cbe662d530160e0732c856aa0da86894c0 (diff) | |
| parent | 02c5f05e2f0e8e786f0530014e35c1520efd0084 (diff) | |
| download | zig-aa0249d74e573742db3567f589fc6e4a00e1fff8.tar.gz zig-aa0249d74e573742db3567f589fc6e4a00e1fff8.zip | |
Merge pull request 'std.ascii: rename indexOf functions to find' (#30101) from adria/zig:indexof-find into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30101
Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org>
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
Diffstat (limited to 'lib/std/http/HeaderIterator.zig')
| -rw-r--r-- | lib/std/http/HeaderIterator.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/http/HeaderIterator.zig b/lib/std/http/HeaderIterator.zig index 518950a9ab..0b20fd6906 100644 --- a/lib/std/http/HeaderIterator.zig +++ b/lib/std/http/HeaderIterator.zig @@ -5,17 +5,17 @@ is_trailer: bool, pub fn init(bytes: []const u8) HeaderIterator { return .{ .bytes = bytes, - .index = std.mem.indexOfPosLinear(u8, bytes, 0, "\r\n").? + 2, + .index = std.mem.findPosLinear(u8, bytes, 0, "\r\n").? + 2, .is_trailer = false, }; } pub fn next(it: *HeaderIterator) ?std.http.Header { - const end = std.mem.indexOfPosLinear(u8, it.bytes, it.index, "\r\n").?; + const end = std.mem.findPosLinear(u8, it.bytes, it.index, "\r\n").?; if (it.index == end) { // found the trailer boundary (\r\n\r\n) if (it.is_trailer) return null; - const next_end = std.mem.indexOfPosLinear(u8, it.bytes, end + 2, "\r\n") orelse + const next_end = std.mem.findPosLinear(u8, it.bytes, end + 2, "\r\n") orelse return null; var kv_it = std.mem.splitScalar(u8, it.bytes[end + 2 .. next_end], ':'); |
