Fixed sendfile() trailers on OS X (8e903522c17a, 1.7.8). The trailer.count variable was not initialized if there was a header, resulting in "sendfile() failed (22: Invalid argument)" alerts on OS X if the "sendfile" directive was used. The bug was introduced in 8e903522c17a (1.7.8).
diff --git a/src/os/unix/ngx_darwin_sendfile_chain.c b/src/os/unix/ngx_darwin_sendfile_chain.c index f01651a..c802e9f 100644 --- a/src/os/unix/ngx_darwin_sendfile_chain.c +++ b/src/os/unix/ngx_darwin_sendfile_chain.c
@@ -111,6 +111,9 @@ } send += trailer.size; + + } else { + trailer.count = 0; } /*