aboutsummaryrefslogtreecommitdiff
path: root/lib/std/net.zig
AgeCommit message (Collapse)Author
2023-06-30Unrevert "Sema: preserve extern struct field alignment"Jacob Young
This unreverts commit 1a2468abfcd8b539193d943c1eefb71319cc7b88.
2023-06-29Revert "Sema: preserve extern struct field alignment"Jacob Young
This reverts commit 4620972d086ebb3b7686a79914876488c6dfd171.
2023-06-28Sema: preserve extern struct field alignmentAlex Kladov
In extern struct { x: u32, y: u16 } we actually know that y's alignment is `@alignOf(u32)`, and not just `@alignOf(u16)`. closes: #16134
2023-06-25std.cstr: deprecate namespaceEric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-16migration: std.math.{min, min3, max, max3} -> `@min` & `@max`r00ster91
2023-06-03Merge pull request #15579 from squeek502/mem-delimitersAndrew Kelley
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-05-23std.sort: add pdqsort and heapsortAli Chraghi
2023-05-13Update all std.mem.split calls to their appropriate functionRyan Liptak
Everywhere that can now use `splitScalar` should get a nice little performance boost.
2023-05-13Update all std.mem.tokenize calls to their appropriate functionRyan Liptak
Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.
2023-05-07convert s[start..start+len] to s[start..][0..len]dweiller
2023-04-28std: update to use `@memcpy` directlyAndrew Kelley
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-04-25change semantics of `@memcpy` and `@memset`Andrew Kelley
Now they use slices or array pointers with any element type instead of requiring byte pointers. This is a breaking enhancement to the language. The safety check for overlapping pointers will be implemented in a future commit. closes #14040
2023-04-24std.net.StreamServer.Options: add reuse_portJon
2023-03-17Enable IPv4 mapped address conversion in linux version getAddressList (#14916)hequn
It seems like the original code of setsockopt is not effective because i catch the EINVAL branch when uncomment this code, it should call setsockopt before the bind call. This should fix issue #14900. Co-authored-by: Qun He <hawkbee@qq.com>
2023-03-09std.http: handle relative redirectsNameless
2023-03-09add error sets to tcpConnect* and tls.Client.initNameless
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-01-23std.net.Address: clarify unix socket getOsSockLenIsaac Freund
2023-01-23std: eliminate pointless meta.assumeSentinel() usageIsaac Freund
This fixes a bug in std.net caused during the introduction of meta.assumeSentinel due to the unfortunate semantics of mem.span() This leaves only 3 remaining uses of meta.assumeSentinel() in the standard library, each of which could be a simple @ptrCast([*:0]T, foo) instead. I think this function should likely be removed.
2023-01-19Make `res` nullable in `getaddrinfo`Jarred Sumner
2023-01-17std.net.getAddressList: call WSAStartup on WindowsAndrew Kelley
2023-01-10std.net: check for localhost names before asking DNSpraschke
the old implementation asks DNS before checking if it shouldn't. additionally, it did not catch absolute 'localhost.' names.
2023-01-02std.crypto.tls.Client: rework the read functionAndrew Kelley
Here's what I landed on for the TLS client. It's 16896 bytes (max_ciphertext_record_len is 16640). I believe this is the theoretical minimum size, give or take a few bytes. These constraints are satisfied: * a call to the readvAdvanced() function makes at most one call to the underlying readv function * iovecs are provided by the API, and used by the implementation for underlying readv() calls to the socket * the theoretical minimum number of memcpy() calls are issued in all circumstances * decryption is only performed once for any given TLS record * large read buffers are fully exploited This is accomplished by using the partial read buffer to storing both cleartext and ciphertext.
2023-01-02std.crypto.tls.Client: fix the read functionAndrew Kelley
The read function has been renamed to readAdvanced since it has slightly different semantics than typical read functions, specifically regarding the end-of-file. A higher level read function is implemented on top. Now, API users may pass small buffers to the read function and everything will work fine. This is done by re-decrypting the same ciphertext record with each call to read() until the record is finished being transmitted. If the buffer supplied to read() is large enough, then any given ciphertext record will only be decrypted once, since it decrypts directly to the read() buffer and therefore does not need any memcpy. On the other hand, if the buffer supplied to read() is small, then the ciphertext is decrypted into a stack buffer, a subset is copied to the read() buffer, and then the entire ciphertext record is saved for the next call to read().
2023-01-02std.crypto.Tls: discard ChangeCipherSpec messagesAndrew Kelley
The next step here is to decrypt encrypted records
2023-01-02std.crypto.Tls: parse the ServerHello handshakeAndrew Kelley
2023-01-02std.http reorg; introduce std.crypto.TlsAndrew Kelley
TLS is capable of sending a Client Hello
2022-12-27update uses of overflow arithmetic builtinsVeikka Tuominen
2022-12-09api(std.ascii): remove deprecated declsr00ster91
2022-11-29std.mem.Allocator: allow shrink to failAndrew Kelley
closes #13535
2022-11-12Make invalidFmtError public and use in place of compileErrors for bad format ↵Nick Cernis
strings (#13526) * Export invalidFmtErr To allow consistent use of "invalid format string" compile error response for badly formatted format strings. See https://github.com/ziglang/zig/pull/13489#issuecomment-1311759340. * Replace format compile errors with invalidFmtErr - Provides more consistent compile errors. - Gives user info about the type of the badly formated value. * Rename invalidFmtErr as invalidFmtError For consistency. Zig seems to use “Error” more often than “Err”. * std: add invalid format string checks to remaining custom formatters * pass reference-trace to comp when building build file; fix checkobjectstep
2022-07-25std.mem: add `first` method to `SplitIterator` and `SplitBackwardsIterator`r00ster
2022-07-23std.net.getAddressList: fix segfault on bad hostnameVeikka Touminen
Fixes #12065
2022-06-07std: adjust for stage2 semanticsVeikka Tuominen
2022-06-03std: update tests to stage2 semanticsVeikka Tuominen
2022-01-15Merge pull request #10576 from schmee/macos-resolve-ipJakub Konka
Use libc if_nametoindex for macOS when parsing IPs
2022-01-14Check for isDarwin() instead of linked libcJohn Schmidt
2022-01-14Use allocPrintZ to avoid needing assumeSentinelbryfry
2022-01-12Use libc if_nametoindex if available when parsing IPsJohn Schmidt
Fixes https://github.com/ziglang/zig/issues/10521 and makes a couple of additional tests pass when linking libc.
2021-12-02update function name in errorAli Chraghi
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-16net.Address: Fix writing 0-bytes when formatting Unix addressesKirjastonhoitaja
The entire 'path' array would get written to the formatting function, when it should instead be treated as a regular zero-terminated string. Note that this doesn't handle abstract paths on Linux, those paths *start* with a \0 byte and are hence treated as empty strings instead. But fixing that would require more adjustments than just formatting, in particular to getOsSockLen().
2021-09-01std.os: more reorganization effortsAndrew Kelley
* std lib tests are passing on x86_64-linux with and without -lc * stage2 is building from source on x86_64-linux * down to 38 remaining uses of `usingnamespace`
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.