diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-03-15 21:05:15 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-03-15 21:05:15 +0300 |
commit | b8a3977d58c58ae42762aabefff8841eabeb49c1 (patch) | |
tree | 596e5270184db1538b0e63939bdc700099866ce8 | |
parent | 4b6e4c630dc6027ee5046d3c558864d94c6758c7 (diff) | |
download | libmicrohttpd-b8a3977d58c58ae42762aabefff8841eabeb49c1.tar.gz libmicrohttpd-b8a3977d58c58ae42762aabefff8841eabeb49c1.zip |
Added ability to get connection timeout by MHD_get_connection_info().
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/include/microhttpd.h | 18 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 2 |
3 files changed, 22 insertions, 2 deletions
@@ -1,3 +1,7 @@ | |||
1 | Wed Mar 15 21:02:26 MSK 2017 | ||
2 | Added new enum value MHD_CONNECTION_INFO_CONNECTION_TIMEOUT | ||
3 | to get connection timeout by MHD_get_connection_info(). -EG | ||
4 | |||
1 | Sat Mar 11 12:03:45 CET 2017 | 5 | Sat Mar 11 12:03:45 CET 2017 |
2 | Fix largepost example from tutorial to properly generate | 6 | Fix largepost example from tutorial to properly generate |
3 | error pages. -CG | 7 | error pages. -CG |
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index c1461988..d7fc448a 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -1641,6 +1641,13 @@ union MHD_ConnectionInfo | |||
1641 | int /* MHD_YES or MHD_NO */ suspended; | 1641 | int /* MHD_YES or MHD_NO */ suspended; |
1642 | 1642 | ||
1643 | /** | 1643 | /** |
1644 | * Amount of second that connection could spend in idle state | ||
1645 | * before automatically disconnected. | ||
1646 | * Zero for no timeout (unlimited idle time). | ||
1647 | */ | ||
1648 | unsigned int connection_timeout; | ||
1649 | |||
1650 | /** | ||
1644 | * Connect socket | 1651 | * Connect socket |
1645 | */ | 1652 | */ |
1646 | MHD_socket connect_fd; | 1653 | MHD_socket connect_fd; |
@@ -1742,10 +1749,17 @@ enum MHD_ConnectionInfoType | |||
1742 | MHD_CONNECTION_INFO_SOCKET_CONTEXT, | 1749 | MHD_CONNECTION_INFO_SOCKET_CONTEXT, |
1743 | 1750 | ||
1744 | /** | 1751 | /** |
1745 | * Check wheter the connection is suspended. | 1752 | * Check whether the connection is suspended. |
1753 | * @ingroup request | ||
1754 | */ | ||
1755 | MHD_CONNECTION_INFO_CONNECTION_SUSPENDED, | ||
1756 | |||
1757 | |||
1758 | /** | ||
1759 | * Get connection timeout | ||
1746 | * @ingroup request | 1760 | * @ingroup request |
1747 | */ | 1761 | */ |
1748 | MHD_CONNECTION_INFO_CONNECTION_SUSPENDED | 1762 | MHD_CONNECTION_INFO_CONNECTION_TIMEOUT |
1749 | }; | 1763 | }; |
1750 | 1764 | ||
1751 | 1765 | ||
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 7380c662..0d55fb3c 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -3331,6 +3331,8 @@ MHD_get_connection_info (struct MHD_Connection *connection, | |||
3331 | return (const union MHD_ConnectionInfo *) &connection->socket_context; | 3331 | return (const union MHD_ConnectionInfo *) &connection->socket_context; |
3332 | case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED: | 3332 | case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED: |
3333 | return (const union MHD_ConnectionInfo *) &connection->suspended; | 3333 | return (const union MHD_ConnectionInfo *) &connection->suspended; |
3334 | case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT: | ||
3335 | return (const union MHD_ConnectionInfo *) &connection->connection_timeout; | ||
3334 | default: | 3336 | default: |
3335 | return NULL; | 3337 | return NULL; |
3336 | }; | 3338 | }; |