diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-11-03 09:29:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-11-03 09:29:31 +0000 |
commit | 7333727189f0c82dd42f6040149a1b1717bad615 (patch) | |
tree | 4ebd9173ef690d2e93a7aca1e5beff9bd806df53 | |
parent | 7b9cf32e4ea2763c16a14c44ab5b4423e8a9aaa9 (diff) | |
download | libmicrohttpd-7333727189f0c82dd42f6040149a1b1717bad615.tar.gz libmicrohttpd-7333727189f0c82dd42f6040149a1b1717bad615.zip |
fixing shutdown issue on OS X -- 1760
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | doc/examples/hellobrowser.c | 2 | ||||
-rw-r--r-- | src/daemon/connection.c | 3 | ||||
-rw-r--r-- | src/daemon/daemon.c | 3 |
4 files changed, 10 insertions, 3 deletions
@@ -1,3 +1,8 @@ | |||
1 | Thu Nov 3 10:14:59 CET 2011 | ||
2 | shutdown(RDWR) fails on OS X after shutdown(RD), so only use | ||
3 | shutdown(WR) if we already closed the socket for reading (otherwise | ||
4 | OS X might not do shutdown (WR) at all). -CG | ||
5 | |||
1 | Tue Nov 1 18:51:50 CET 2011 | 6 | Tue Nov 1 18:51:50 CET 2011 |
2 | Force adding of 'Connection: close' to the header if we (for whatever | 7 | Force adding of 'Connection: close' to the header if we (for whatever |
3 | reason) are shutting down the socket for reading (see also | 8 | reason) are shutting down the socket for reading (see also |
diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c index defb5ae4..ec4ede78 100644 --- a/doc/examples/hellobrowser.c +++ b/doc/examples/hellobrowser.c | |||
@@ -14,7 +14,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
14 | const char *page = "<html><body>Hello, browser!</body></html>"; | 14 | const char *page = "<html><body>Hello, browser!</body></html>"; |
15 | struct MHD_Response *response; | 15 | struct MHD_Response *response; |
16 | int ret; | 16 | int ret; |
17 | 17 | ||
18 | response = | 18 | response = |
19 | MHD_create_response_from_buffer (strlen (page), (void *) page, | 19 | MHD_create_response_from_buffer (strlen (page), (void *) page, |
20 | MHD_RESPMEM_PERSISTENT); | 20 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/daemon/connection.c b/src/daemon/connection.c index a7f3ceae..e30e019a 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c | |||
@@ -302,7 +302,8 @@ MHD_connection_close (struct MHD_Connection *connection, | |||
302 | struct MHD_Daemon *daemon; | 302 | struct MHD_Daemon *daemon; |
303 | 303 | ||
304 | daemon = connection->daemon; | 304 | daemon = connection->daemon; |
305 | SHUTDOWN (connection->socket_fd, SHUT_RDWR); | 305 | SHUTDOWN (connection->socket_fd, |
306 | (connection->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR); | ||
306 | connection->state = MHD_CONNECTION_CLOSED; | 307 | connection->state = MHD_CONNECTION_CLOSED; |
307 | if ( (NULL != daemon->notify_completed) && | 308 | if ( (NULL != daemon->notify_completed) && |
308 | (MHD_YES == connection->client_aware) ) | 309 | (MHD_YES == connection->client_aware) ) |
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 280d7789..2b8eac5f 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -2445,7 +2445,8 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
2445 | abort(); | 2445 | abort(); |
2446 | } | 2446 | } |
2447 | for (pos = daemon->connections_head; pos != NULL; pos = pos->next) | 2447 | for (pos = daemon->connections_head; pos != NULL; pos = pos->next) |
2448 | SHUTDOWN (pos->socket_fd, SHUT_RDWR); | 2448 | SHUTDOWN (pos->socket_fd, |
2449 | (pos->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR); | ||
2449 | if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex)) | 2450 | if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex)) |
2450 | { | 2451 | { |
2451 | #if HAVE_MESSAGES | 2452 | #if HAVE_MESSAGES |