aboutsummaryrefslogtreecommitdiff
path: root/lib/std
AgeCommit message (Collapse)Author
2025-08-16Merge pull request #24874 from ziglang/tls-clientAndrew Kelley
std: more reliable HTTP and TLS networking
2025-08-16Compilation: remove last instance of deprecatedReaderAndrew Kelley
This also makes initStreaming preemptively disable file size checking.
2025-08-16http.BodyWriter: handle EOF in chunkedSendFile, simplifyIsaac Freund
With these changes, the `zig std` command now works again and doesn't trigger assertion failures or mess up the chunked transfer encoding.
2025-08-16[std] fix compile error in std.Io.Writer.failingJosh Wolfe
2025-08-16implement registering NAPI on IoUring (#24850)Özgür Akkurt
2025-08-16std: more reliable HTTP and TLS networkingAndrew Kelley
* std.Io.Reader: fix confused semantics of rebase. Before it was ambiguous whether it was supposed to be based on end or seek. Now it is clearly based on seek, with an added assertion for clarity. * std.crypto.tls.Client: fix panic due to not enough buffer size available. Also, avoid unnecessary rebasing. * std.http.Reader: introduce max_head_len to limit HTTP header length. This prevents crash in underlying reader which may require a minimum buffer length. * std.http.Client: choose better buffer sizes for streams and TLS client. Crucially, the buffer shared by HTTP reader and TLS client needs to be big enough for all http headers *and* the max TLS record size. Bump HTTP header size default from 4K to 8K. fixes #24872 I have noticed however that there are still fetch problems
2025-08-15zstd: Protect against index out-of-bounds when decoding sequencesRyan Liptak
Previously, index out-of-bounds could occur when copying match_length bytes while decoding whatever sequence happened to overflow `dest`. Now, each sequence checks that there is enough room for the full sequence_length (literal_length + match_length) before doing any copying. Fixes the failing inputs found here: https://github.com/ziglang/zig/issues/24817#issuecomment-3192927715
2025-08-16re-enable std.math.modf vector tests (#24786)Rue
* re-enable std.math.modf vector tests * re-disable std.math.modf vector tests for `aarch64-macos` * re-disable for s390x architecture
2025-08-15std.Build: improve error for peak RSS exceeding declared valuemlugg
As well as the exact byte count, include a human-readable value so it's clearer what the error is actually telling you. The exact byte count might not be worth keeping, but I decided I would in case it's useful in any scenario.
2025-08-15std.math: Add splat for vectors of u0s in rotl/rotr (#24822)Fri3dNstuff
2025-08-15zon: Add anonymous struct literal in the exampleManlio Perillo
2025-08-15std.compress.zstd.Decompress fixesAndrew Kelley
* std.Io.Reader: appendRemaining no longer supports alignment and has different rules about how exceeding limit. Fixed bug where it would return success instead of error.StreamTooLong like it was supposed to. * std.Io.Reader: simplify appendRemaining and appendRemainingUnlimited to be implemented based on std.Io.Writer.Allocating * std.Io.Writer: introduce unreachableRebase * std.Io.Writer: remove minimum_unused_capacity from Allocating. maybe that flexibility could have been handy, but let's see if anyone actually needs it. The field is redundant with the superlinear growth of ArrayList capacity. * std.Io.Writer: growingRebase also ensures total capacity on the preserve parameter, making it no longer necessary to do ensureTotalCapacity at the usage site of decompression streams. * std.compress.flate.Decompress: fix rebase not taking into account seek * std.compress.zstd.Decompress: split into "direct" and "indirect" usage patterns depending on whether a buffer is provided to init, matching how flate works. Remove some overzealous asserts that prevented buffer expansion from within rebase implementation. * std.zig: fix readSourceFileToAlloc returning an overaligned slice which was difficult to free correctly. fixes #24608
2025-08-15crypto/aes_ocb.zig: actually check against test vectors (#24835)Frank Denis
And use the correct bit endianness for padding
2025-08-14std.fs.File.Reader: fix freestanding build failuresAndrew Kelley
This should be enough to unblock people for now. We'll revisit the way these things are organized with the upcoming std.Io interface. fixes #24685
2025-08-15Merge pull request #24702 from The-King-of-Toasters/syscall-tablesAlex Rønne Petersen
Rewrite Linux syscalls generation
2025-08-14zstd.Decompress.stream: Fix handling of skippable frames in new_frame stateRyan Liptak
The previous code assumed that `initFrame` during the `new_frame` state would always result in the `in_frame` state, but that's not always the case. `initFrame` can also result in the `skippable_frame` state, which would lead to access of union field 'in_frame' while field 'skipping_frame' is active. Now, the switch is re-entered with the updated state so either case is handled appropriately. Fixes the crashes from https://github.com/ziglang/zig/issues/24817
2025-08-14Merge pull request #24847 from squeek502/zstd-partial-magicAndrew Kelley
zstd.Decompress: Treat a partial magic number as a failure
2025-08-14zig fmt: add tests for cast builtin canonicalizationJustus Klausecker
2025-08-14zstd.Decompress: Delete unused/impossible "end" stateRyan Liptak
2025-08-14zstd.Decompress: Treat a partial magic number as a failureRyan Liptak
Previously, the "allow EndOfStream" part of this logic was too permissive. If there are a few dangling bytes at the end of the stream, that should be treated as a bad magic number. The only case where EndOfStream is allowed is when the stream is truly at the end, with exactly zero bytes available.
2025-08-14std.Io.Writer: introduce rebase to the vtableAndrew Kelley
fixes #24814
2025-08-14Validate wildcard TLS certificates correctly (#24829)Frank Denis
Validate wildcard certificates as specified in RFC 6125. In particular, `*.example.com` should match `foo.example.com` but NOT `bar.foo.example.com` as it previously did.
2025-08-13std.fs.File.Writer.sendFile: handle sendfile errorsAndrew Kelley
fixes #24842
2025-08-14Linux: Use time64 syscalls when availableStephen Gregoratto
Newer 32-bit Linux targets like 32-bit RISC-V only use the 64-bit time ABI, with these syscalls having `time64` as their suffix. This is a stopgap solution in favor of a full audit of `std.os.linux` to prepare for #4726. See also #21440 for prior art.
2025-08-14Linux: Update syscall list for 6.16Stephen Gregoratto
The generic syscall table has different names for syscalls that take a timespec64 on 32-bit targets, in that it adds the `_time64` suffix. Similarly, the `_time32` suffix has been removed. I'm not sure if the existing logic for determining the proper timespec struct to use was subtly broken, but it should be a good chance to finish #4726 - we only have 12 years after all... As for the changes since 6.11..6.16: 6.11: - x86_64 gets `uretprobe`, a syscall to speed up returning BPF probes. - Hexagon gets `clone3`, but don't be fooled: it just returns ENOSYS. 6.13: - The `*xattr` family of syscalls have been enhanced with new `*xattrat` versions, similar to the other file-based `at` calls. 6.15: - Atomically create a detached mount tree and set mount options on it. Finally, this commit also adds the syscall numbers for OpenRISC and maps it to the `or1k` cpu.
2025-08-13build runner: fix single-threaded buildmlugg
Resolves: #24723
2025-08-13http: fix handling of limit in chunkedSendFileKendall Condon
`limit` in chunkedSendFile applies only to the file, not the entire chunk. `limit` in sendFileHeader does not include the header. Additionally adds a comment to clarify what `limit` applies to in sendFileHeader and fixed a small bug in it (`drain` is able to return less then `header.len`).
2025-08-13std.fs.File.Reader: fix seekByAndrew Kelley
Tested locally: stage3/bin/zig build test -Dskip-release -Dskip-non-native closes #24495 closes #24498 closes #24713
2025-08-13sema: strip `@splat` operand result type before checking itDavid Rubin
2025-08-13Merge pull request #24381 from Justus2308/switch-better-underscoreMatthew Lugg
Enhance switch on non-exhaustive enums
2025-08-13std.io.Writer.Allocating: rename getWritten() to written()Isaac Freund
This "get" is useless noise and was copied from FixedBufferWriter. Since this API has not yet landed in a release, now is a good time to make the breaking change to fix this.
2025-08-13std.crypto.aegis: Absorb ad instead of encrypting it.Erik Schlyter
`Aegis256XGeneric` behaves differently than `Aegis128XGeneric` in that it currently encrypts associated data instead of just absorbing it. Even though the end result is the same, there's no point in encrypting and copying the ad into a buffer that gets overwritten anyway. This fix makes `Aegis256XGeneric` behave the same as `Aegis128XGeneric`.
2025-08-13std.Target: bump default android API level from 24 to 29Alex Rønne Petersen
According to https://apilevels.com, 88.5% of Android users are on 29+. Older API levels require libc as of https://github.com/ziglang/zig/pull/24629, which has confused some users. Seems reasonable to bump the default so most people won't be confused by this.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-11aarch64: implement more assembler instructionsJacob Young
2025-08-11std: introduce orderedRemoveManyAndrew Kelley
This algorithm is non-trivial and makes sense for any data structure that acts as an array list, so I thought it would make sense as a method. I have a real world case for this in a music player application (deleting queue items). Adds the method to: * ArrayList * ArrayHashMap * MultiArrayList
2025-08-11std.fs.File: prefer getSize over getEndPosAndrew Kelley
The former detects when it is appropriate to switch to streaming mode. closes #24798
2025-08-11Dwarf: port to new Writer APIJacob Young
2025-08-10Writer: Delete writePreserve/writeAllPreserveRyan Liptak
This is one way of partially addressing https://github.com/ziglang/zig/issues/24767 - These functions are unused - These functions are untested - These functions are broken + The same dangling pointer bug from 6219c015d8e8c958d96e5caa5ef0dbab9c414996 exists in `writePreserve` + The order of the bytes preserved in relation to the `bytes` being written can differ depending on unused buffer capacity at the time of the call and the drain implementation. If there ends up being a need for these functions, they can be fixed and added back.
2025-08-10std.fs.File.Reader.getSize: check file kind on statAndrew Kelley
closes #24794
2025-08-10std.net.Stream.Reader: init size_errAndrew Kelley
This code knows in advance that stat() should never be called. closes #24754
2025-08-10Merge pull request #24774 from kcbanner/fixup_webui_windowsAndrew Kelley
Fix `respondWebSocket`, use overlapped sockets on Windows, and re-enable --webui
2025-08-10docs(zon/stringify.zig): Added missing non-serializable typeAlexandre Blais
2025-08-10std.c: Remove serenity's internet_checksum() functionLinus Groh
See: https://github.com/SerenityOS/serenity/commit/59911d8da3da36aefd2d4902a0fdfc21e1f6f8ac
2025-08-09Merge pull request #24743 from ziglang/BufferedWriterAndrew Kelley
std.Io: delete BufferedWriter
2025-08-09net: Always set WSA_FLAG_OVERLAPPED when creating Windows sockets. Rework ↵kcbanner
send and receive logic to use overlapped I/O. build-web: Remove the now-redundant supports_recv logic
2025-08-09Fix `respondWebSocket`, enable --webui on Windowskcbanner
This commit re-enables the --webui functionality on windows, with the caveat that rebuild functionality is still disabled (due to deadlocks caused by reading to / writing from the same non-overlapped socket on multiple threads). I updated the UI to be aware of this, and hide the `Rebuild` button. http.Server: Remove incorrect advance() call. This was causing browsers to disconnect the websocket, as we were sending undefined bytes. build.WebServer: Re-enable on windows, but disable functionality that requires receiving messages from the client build-web: Show total times in tables
2025-08-08std.Io.Writer.Allocating: configurable bump amountAndrew Kelley
2025-08-08zig std: fix build failuresAndrew Kelley
2025-08-08std.Io: remove BufferedWriterAndrew Kelley