libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit a0b1426077930b3c8f057ea6dd44e1fdc204eab3
parent 05c06d6be16c9b167843c06d9b978b8623b40bc4
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 17 Jan 2016 11:32:41 +0000

Do not give up if sendfile() failed with EINVAL

Diffstat:
MChangeLog | 4++++
Msrc/microhttpd/daemon.c | 5+++--
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +Sun Jan 17 11:18:55 CET 2016 + Do no refuse to send response if sendfile() failed with + EINVAL (common error for files located on SMB/CIF). -EG + Sat Jan 16 19:14:39 CET 2016 Use US-ASCII only (instead of user locale settings) when performing caseless string comparison as required by diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1158,9 +1158,10 @@ send_param_adapter (struct MHD_Connection *connection, err = MHD_socket_errno_; if ( (EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err) ) return 0; - if ( (EINVAL == err) || (EBADF == err) ) + if (EBADF == err) return -1; - /* None of the 'usual' sendfile errors occurred, so we should try + /* sendfile() failed with EINVAL if mmap()-like operations are not + supported for FD or other 'unusual' errors occurred, so we should try to fall back to 'SEND'; see also this thread for info on odd libc/Linux behavior with sendfile: http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */