diff --git a/src/lib/lwan-io-wrappers.c b/src/lib/lwan-io-wrappers.c index 6084f0a3d..51ca62226 100644 --- a/src/lib/lwan-io-wrappers.c +++ b/src/lib/lwan-io-wrappers.c @@ -270,13 +270,13 @@ int lwan_sendfile_fd(struct lwan_request *request, } } #elif defined(__FreeBSD__) || defined(__APPLE__) -int lwan_sendfile(struct lwan_request *request, - int out_fd, - int in_fd, - off_t offset, - size_t count, - const char *header, - size_t header_len) +int lwan_sendfile_fd(struct lwan_request *request, + int out_fd, + int in_fd, + off_t offset, + size_t count, + const char *header, + size_t header_len) { struct sf_hdtr headers = {.headers = (struct iovec[]){{.iov_base = (void *)header, diff --git a/src/lib/lwan-io-wrappers.h b/src/lib/lwan-io-wrappers.h index 94e44df28..980c8db62 100644 --- a/src/lib/lwan-io-wrappers.h +++ b/src/lib/lwan-io-wrappers.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include #include diff --git a/src/lib/lwan-socket.c b/src/lib/lwan-socket.c index 87072f183..fc6d95378 100644 --- a/src/lib/lwan-socket.c +++ b/src/lib/lwan-socket.c @@ -245,8 +245,6 @@ static int set_socket_options(const struct lwan *l, int fd) SET_SOCKET_OPTION(SOL_SOCKET, SO_LINGER, (&(struct linger){.l_onoff = 1, .l_linger = 1})); - SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_NODELAY, (int[]){1}); - #ifdef __linux__ #ifndef TCP_FASTOPEN @@ -254,6 +252,7 @@ static int set_socket_options(const struct lwan *l, int fd) #endif SET_SOCKET_OPTION_MAY_FAIL(SOL_SOCKET, SO_REUSEADDR, (int[]){1}); + SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_NODELAY, (int[]){1}); SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_FASTOPEN, (int[]){5}); SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_QUICKACK, (int[]){0}); SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_DEFER_ACCEPT, diff --git a/src/lib/missing/sys/socket.h b/src/lib/missing/sys/socket.h index 3df3ea62b..2ec51d878 100644 --- a/src/lib/missing/sys/socket.h +++ b/src/lib/missing/sys/socket.h @@ -27,6 +27,10 @@ #define MSG_MORE 0 #endif +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 0 #endif