mirror of
https://github.com/ziglang/zig.git
synced 2025-12-29 09:33:18 +00:00
std.http.Client.connectUnix: handle unsupported OS at compile time
This commit is contained in:
parent
6de8748b05
commit
e204b2ca92
@ -1282,14 +1282,12 @@ pub fn connectTcp(client: *Client, host: []const u8, port: u16, protocol: Connec
|
||||
return &conn.data;
|
||||
}
|
||||
|
||||
pub const ConnectUnixError = Allocator.Error || std.os.SocketError || error{ NameTooLong, Unsupported } || std.os.ConnectError;
|
||||
pub const ConnectUnixError = Allocator.Error || std.os.SocketError || error{NameTooLong} || std.os.ConnectError;
|
||||
|
||||
/// Connect to `path` as a unix domain socket. This will reuse a connection if one is already open.
|
||||
///
|
||||
/// This function is threadsafe.
|
||||
pub fn connectUnix(client: *Client, path: []const u8) ConnectUnixError!*Connection {
|
||||
if (!net.has_unix_sockets) return error.Unsupported;
|
||||
|
||||
if (client.connection_pool.findConnection(.{
|
||||
.host = path,
|
||||
.port = 0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user