Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
karlseguin committed Oct 20, 2024
1 parent ab549d1 commit be9a673
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/worker.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1632,11 +1632,11 @@ fn requestError(conn: *HTTPConn, err: anyerror) !void {
return err;
}

fn writeError(socket: posix.fd_t, comptime status: u16, comptime msg: []const u8) !void {
fn writeError(socket: posix.socket_t, comptime status: u16, comptime msg: []const u8) !void {
const response = std.fmt.comptimePrint("HTTP/1.1 {d} \r\nConnection: Close\r\nContent-Length: {d}\r\n\r\n{s}", .{ status, msg.len, msg });

// Zig doesn't have the BSD/Darwin values for this.
const DONTWAIT = if (posix.MSG != void) posix.MSG.DONTWAIT else 0x00080;
const DONTWAIT = if (posix.MSG != void and @hasDecl(posix.MSG, "DONTWAIT")) posix.MSG.DONTWAIT else 0x00080;
var i: usize = 0;
while (i < response.len) {
const n = try posix.sendto(socket, response[i..], DONTWAIT, null, 0);
Expand Down

0 comments on commit be9a673

Please sign in to comment.