diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-07-25 13:17:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-07-25 13:17:10 +0000 |
commit | 8157744d45ee018ab325ff5a16be1212cd7e8f58 (patch) | |
tree | 429f881f931ea9c1ae5cf58e2614cd01c818005c /src/daemon/connection.c | |
parent | eaba29f5716951cffff9869f98db9b4726f1b154 (diff) | |
download | libmicrohttpd-8157744d45ee018ab325ff5a16be1212cd7e8f58.tar.gz libmicrohttpd-8157744d45ee018ab325ff5a16be1212cd7e8f58.zip |
systemd and sendfile support
Diffstat (limited to 'src/daemon/connection.c')
-rw-r--r-- | src/daemon/connection.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c index 0c81ca81..dab19472 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c | |||
@@ -333,6 +333,11 @@ try_ready_normal_body (struct MHD_Connection *connection) | |||
333 | (response->data_size + response->data_start > | 333 | (response->data_size + response->data_start > |
334 | connection->response_write_position) ) | 334 | connection->response_write_position) ) |
335 | return MHD_YES; /* response already ready */ | 335 | return MHD_YES; /* response already ready */ |
336 | #if LINUX | ||
337 | if ( (response->fd != -1) && | ||
338 | (0 == (connection->daemon->options & MHD_USE_SSL)) ) | ||
339 | return MHD_YES; /* will use sendfile */ | ||
340 | #endif | ||
336 | ret = response->crc (response->crc_cls, | 341 | ret = response->crc (response->crc_cls, |
337 | connection->response_write_position, | 342 | connection->response_write_position, |
338 | response->data, | 343 | response->data, |
@@ -1795,29 +1800,13 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
1795 | connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; | 1800 | connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; |
1796 | break; | 1801 | break; |
1797 | } | 1802 | } |
1798 | #if HTTPS_SUPPORT | 1803 | ret = connection->send_cls (connection, |
1799 | if (connection->daemon->options & MHD_USE_SSL) | 1804 | &response->data |
1800 | { | 1805 | [connection->response_write_position |
1801 | ret = gnutls_record_send (connection->tls_session, | 1806 | - response->data_start], |
1802 | &connection->response->data | 1807 | response->data_size - |
1803 | [connection-> | 1808 | (connection->response_write_position |
1804 | response_write_position - | 1809 | - response->data_start)); |
1805 | response->data_start], | ||
1806 | response->data_size - | ||
1807 | (connection->response_write_position | ||
1808 | - response->data_start)); | ||
1809 | } | ||
1810 | else | ||
1811 | #endif | ||
1812 | { | ||
1813 | ret = connection->send_cls (connection, | ||
1814 | &response->data | ||
1815 | [connection->response_write_position | ||
1816 | - response->data_start], | ||
1817 | response->data_size - | ||
1818 | (connection->response_write_position | ||
1819 | - response->data_start)); | ||
1820 | } | ||
1821 | #if DEBUG_SEND_DATA | 1810 | #if DEBUG_SEND_DATA |
1822 | if (ret > 0) | 1811 | if (ret > 0) |
1823 | FPRINTF (stderr, | 1812 | FPRINTF (stderr, |