diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-01-17 11:32:41 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-01-17 11:32:41 +0000 |
commit | a0b1426077930b3c8f057ea6dd44e1fdc204eab3 (patch) | |
tree | 68fd0ae72ac5780ce357e70c436cbe47188d03aa | |
parent | 05c06d6be16c9b167843c06d9b978b8623b40bc4 (diff) | |
download | libmicrohttpd-a0b1426077930b3c8f057ea6dd44e1fdc204eab3.tar.gz libmicrohttpd-a0b1426077930b3c8f057ea6dd44e1fdc204eab3.zip |
Do not give up if sendfile() failed with EINVAL
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 5 |
2 files changed, 7 insertions, 2 deletions
@@ -1,3 +1,7 @@ | |||
1 | Sun Jan 17 11:18:55 CET 2016 | ||
2 | Do no refuse to send response if sendfile() failed with | ||
3 | EINVAL (common error for files located on SMB/CIF). -EG | ||
4 | |||
1 | Sat Jan 16 19:14:39 CET 2016 | 5 | Sat Jan 16 19:14:39 CET 2016 |
2 | Use US-ASCII only (instead of user locale settings) when | 6 | Use US-ASCII only (instead of user locale settings) when |
3 | performing caseless string comparison as required by | 7 | performing caseless string comparison as required by |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index b9cebc43..be7335be 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1158,9 +1158,10 @@ send_param_adapter (struct MHD_Connection *connection, | |||
1158 | err = MHD_socket_errno_; | 1158 | err = MHD_socket_errno_; |
1159 | if ( (EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err) ) | 1159 | if ( (EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err) ) |
1160 | return 0; | 1160 | return 0; |
1161 | if ( (EINVAL == err) || (EBADF == err) ) | 1161 | if (EBADF == err) |
1162 | return -1; | 1162 | return -1; |
1163 | /* None of the 'usual' sendfile errors occurred, so we should try | 1163 | /* sendfile() failed with EINVAL if mmap()-like operations are not |
1164 | supported for FD or other 'unusual' errors occurred, so we should try | ||
1164 | to fall back to 'SEND'; see also this thread for info on | 1165 | to fall back to 'SEND'; see also this thread for info on |
1165 | odd libc/Linux behavior with sendfile: | 1166 | odd libc/Linux behavior with sendfile: |
1166 | http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ | 1167 | http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ |