lib: do not left stage30 until all content is sent

If for some reason the send() call returns -1 because the socket
is not yet ready to receive more data (due to non-blocking mode),
the routine should not stop working and should try to send the
information over and over until is fully served.

This is not an expected behavior in a non-blocking server, but is
a temporal fix until the 'pending buffers' interface is implemented.

This problem was found due to #170.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
configure: Conditionally set -O2

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
request: If mk_file_get_info returns -1, size is not set. Found by valgrind

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
dirlisting: Mem-optimize mk_f_list, 112 -> 88 bytes

The theoretical maximum of the strftime string is somewhere around 18 bytes.
Make it 24 to have some extra, and to be a nicely cacheable multiple.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
dirlisting: Remove unnecessary variable

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
dirlisting: Use case-insensitive sort

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
dirlisting: Fix failure in big directories

Dirlisting is not designed to support event-based working, it is one-shot.

So in a big directory, writev would return EAGAIN (EWOULDBLOCK) after
having written a partial entry.

This would then confuse the client in chunked mode (you promise X bytes but
only send less), which closes the connection, leaving you with a partial listing.

With this patch, dirlisting succeeds in a dir with 23k entries.
Without, it fails in a dir with little over 1k entries.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
dirlisting/guineo: Compact the theme

This saves about 270kb (29%) in a dir of about 3k entries, while looking the same.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>