Cache: add support for Cache-Control's s-maxage response directive.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Renamed ngx_handle_sent_chain() to ngx_chain_update_sent().

No functional changes.
Introduced the ngx_output_chain_to_iovec() function.

It deduplicates code of the send chain functions and uses only preallocated
memory, which completely solves the problem mentioned in d1bde5c3c5d2.
Refactored ngx_solaris_sendfilev_chain().

Though ngx_solaris_sendfilev_chain() shouldn't suffer from the problem mentioned
in d1bde5c3c5d2 since currently IOV_MAX on Solaris is 16, but this follows the
change from 3d5717550371 in order to make the code look similar to other systems
and potentially eliminates the problem in the future.
Moved the code for coalescing file buffers to a separate function.
Merged conditions in the ngx_*_sendfile_chain() functions.

No functional changes.
Moved writev() handling code to a separate function.

This reduces code duplication and unifies debug logging of the writev() syscall
among various send chain functions.
Fixed type of sendfile() return value on Linux.

There was no real problem since the amount of bytes can be sent is limited by
NGX_SENDFILE_MAXSIZE to less than 2G.  But that can be changed in the future