aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-05-20 10:30:32 +0000
committerChristian Grothoff <christian@grothoff.org>2013-05-20 10:30:32 +0000
commitcfea15fe53e1d84d38de88651f31122de6369143 (patch)
tree1a2b622d6c6d886cd0bdca52bf992c11da03ada3
parentf4a4a70d43a3c99915190447356c1080feb8867b (diff)
downloadlibmicrohttpd-cfea15fe53e1d84d38de88651f31122de6369143.tar.gz
libmicrohttpd-cfea15fe53e1d84d38de88651f31122de6369143.zip
-fix 2886
-rw-r--r--ChangeLog5
-rw-r--r--doc/libmicrohttpd.texi12
-rw-r--r--src/include/microhttpd.h14
-rw-r--r--src/microhttpd/connection.c2
4 files changed, 32 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4afe7fa7..1f3176a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
1Mon May 20 12:29:35 CEST 2013
2 Added MHD_CONNECTION_INFO_CONNECTION_FD to allow clients
3 direct access to connection socket; useful for COMET
4 applications that need to disable NAGLE (#2886). -CG
5
1Mon May 15 12:49:01 CEST 2013 6Mon May 15 12:49:01 CEST 2013
2 Fixing #2859. -CG 7 Fixing #2859. -CG
3 8
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index f3950e39..882431a4 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -2138,6 +2138,18 @@ and then call @code{gnutls_certificate_get_peers()}.
2138Returns information about @code{struct MHD_Daemon} which manages 2138Returns information about @code{struct MHD_Daemon} which manages
2139this connection. 2139this connection.
2140 2140
2141@item MHD_CONNECTION_INFO_CONNECTION_FD
2142Returns the file descriptor (usually a TCP socket) associated with
2143this connection (in the ``connect-fd'' member of the returned struct).
2144Note that manipulating the descriptor directly can have problematic
2145consequences (as in, break HTTP). Applications might use this access
2146to manipulate TCP options, for example to set the ``TCP-NODELAY''
2147option for COMET-like applications. Note that MHD will set TCP-CORK
2148after sending the HTTP header and clear it after finishing the footers
2149automatically (if the platform supports it). As the connection
2150callbacks are invoked in between, those might be used to set different
2151values for TCP-CORK and TCP-NODELAY in the meantime.
2152
2141@end table 2153@end table
2142@end deftp 2154@end deftp
2143 2155
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index a81c0724..ce6865b8 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -791,7 +791,14 @@ enum MHD_ConnectionInfoType
791 /** 791 /**
792 * Get the 'struct MHD_Daemon' responsible for managing this connection. 792 * Get the 'struct MHD_Daemon' responsible for managing this connection.
793 */ 793 */
794 MHD_CONNECTION_INFO_DAEMON 794 MHD_CONNECTION_INFO_DAEMON,
795
796
797 /**
798 * Request the file descriptor for the listening socket.
799 * No extra arguments should be passed.
800 */
801 MHD_CONNECTION_INFO_CONNECTION_FD
795 802
796}; 803};
797 804
@@ -1852,6 +1859,11 @@ union MHD_ConnectionInfo
1852 int /* enum gnutls_protocol */ protocol; 1859 int /* enum gnutls_protocol */ protocol;
1853 1860
1854 /** 1861 /**
1862 * Connect socket
1863 */
1864 int connect_fd;
1865
1866 /**
1855 * GNUtls session handle, of type "gnutls_session_t". 1867 * GNUtls session handle, of type "gnutls_session_t".
1856 */ 1868 */
1857 void * /* gnutls_session_t */ tls_session; 1869 void * /* gnutls_session_t */ tls_session;
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index d01d8260..8cd64000 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2555,6 +2555,8 @@ MHD_get_connection_info (struct MHD_Connection *connection,
2555 return (const union MHD_ConnectionInfo *) &connection->addr; 2555 return (const union MHD_ConnectionInfo *) &connection->addr;
2556 case MHD_CONNECTION_INFO_DAEMON: 2556 case MHD_CONNECTION_INFO_DAEMON:
2557 return (const union MHD_ConnectionInfo *) &connection->daemon; 2557 return (const union MHD_ConnectionInfo *) &connection->daemon;
2558 case MHD_CONNECTION_INFO_CONNECTION_FD:
2559 return (const union MHD_ConnectionInfo *) &connection->socket_fd;
2558 default: 2560 default:
2559 return NULL; 2561 return NULL;
2560 }; 2562 };