diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 916542f4..03bc3a17 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1789,9 +1789,6 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
1789 | unsigned int i; | 1789 | unsigned int i; |
1790 | int eno; | 1790 | int eno; |
1791 | struct MHD_Daemon *worker; | 1791 | struct MHD_Daemon *worker; |
1792 | #if OSX | ||
1793 | static int on = 1; | ||
1794 | #endif | ||
1795 | 1792 | ||
1796 | if (NULL != daemon->worker_pool) | 1793 | if (NULL != daemon->worker_pool) |
1797 | { | 1794 | { |
@@ -1833,6 +1830,24 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
1833 | return MHD_NO; | 1830 | return MHD_NO; |
1834 | } | 1831 | } |
1835 | 1832 | ||
1833 | #ifdef MHD_socket_nosignal_ | ||
1834 | if (! MHD_socket_nosignal_ (client_socket)) | ||
1835 | { | ||
1836 | #ifdef HAVE_MESSAGES | ||
1837 | MHD_DLOG (daemon, | ||
1838 | _("Failed to set SO_NOSIGPIPE on accepted socket: %s\n"), | ||
1839 | MHD_socket_last_strerr_()); | ||
1840 | #endif | ||
1841 | #ifndef MSG_NOSIGNAL | ||
1842 | /* Cannot use socket as it can produce SIGPIPE. */ | ||
1843 | #ifdef ENOTSOCK | ||
1844 | errno = ENOTSOCK; | ||
1845 | #endif /* ENOTSOCK */ | ||
1846 | return MHD_NO; | ||
1847 | #endif /* ! MSG_NOSIGNAL */ | ||
1848 | } | ||
1849 | #endif /* MHD_socket_nosignal_ */ | ||
1850 | |||
1836 | 1851 | ||
1837 | #ifdef HAVE_MESSAGES | 1852 | #ifdef HAVE_MESSAGES |
1838 | #if DEBUG_CONNECT | 1853 | #if DEBUG_CONNECT |
@@ -1880,18 +1895,6 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
1880 | return MHD_NO; | 1895 | return MHD_NO; |
1881 | } | 1896 | } |
1882 | 1897 | ||
1883 | #if OSX | ||
1884 | #ifdef SOL_SOCKET | ||
1885 | #ifdef SO_NOSIGPIPE | ||
1886 | setsockopt (client_socket, | ||
1887 | SOL_SOCKET, | ||
1888 | SO_NOSIGPIPE, | ||
1889 | &on, | ||
1890 | sizeof (on)); | ||
1891 | #endif | ||
1892 | #endif | ||
1893 | #endif | ||
1894 | |||
1895 | if (NULL == (connection = malloc (sizeof (struct MHD_Connection)))) | 1898 | if (NULL == (connection = malloc (sizeof (struct MHD_Connection)))) |
1896 | { | 1899 | { |
1897 | eno = errno; | 1900 | eno = errno; |