Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27206)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+Mon May 20 12:29:35 CEST 2013
+	Added MHD_CONNECTION_INFO_CONNECTION_FD to allow clients
+	direct access to connection socket; useful for COMET
+	applications that need to disable NAGLE (#2886). -CG
+
 Mon May 15 12:49:01 CEST 2013
 	Fixing #2859. -CG
 
Index: doc/libmicrohttpd.texi
===================================================================
--- doc/libmicrohttpd.texi	(revision 27206)
+++ doc/libmicrohttpd.texi	(working copy)
@@ -2138,6 +2138,18 @@
 Returns information about @code{struct MHD_Daemon} which manages
 this connection.
 
+@item MHD_CONNECTION_INFO_CONNECTION_FD
+Returns the file descriptor (usually a TCP socket) associated with
+this connection (in the ``connect-fd'' member of the returned struct).
+Note that manipulating the descriptor directly can have problematic
+consequences (as in, break HTTP).  Applications might use this access
+to manipulate TCP options, for example to set the ``TCP-NODELAY''
+option for COMET-like applications.  Note that MHD will set TCP-CORK
+after sending the HTTP header and clear it after finishing the footers
+automatically (if the platform supports it).  As the connection
+callbacks are invoked in between, those might be used to set different
+values for TCP-CORK and TCP-NODELAY in the meantime.
+
 @end table
 @end deftp
 
Index: src/include/microhttpd.h
===================================================================
--- src/include/microhttpd.h	(revision 27206)
+++ src/include/microhttpd.h	(working copy)
@@ -791,8 +791,15 @@
   /**
    * Get the 'struct MHD_Daemon' responsible for managing this connection.
    */
-  MHD_CONNECTION_INFO_DAEMON
+  MHD_CONNECTION_INFO_DAEMON,
 
+
+  /**
+   * Request the file descriptor for the listening socket.
+   * No extra arguments should be passed.
+   */
+  MHD_CONNECTION_INFO_CONNECTION_FD
+
 };
 
 
@@ -1852,6 +1859,11 @@
   int /* enum gnutls_protocol */ protocol;
 
   /**
+   * Connect socket 
+   */
+  int connect_fd;
+
+  /**
    * GNUtls session handle, of type "gnutls_session_t".
    */
   void * /* gnutls_session_t */ tls_session;
Index: src/microhttpd/connection.c
===================================================================
--- src/microhttpd/connection.c	(revision 27206)
+++ src/microhttpd/connection.c	(working copy)
@@ -2555,6 +2555,8 @@
       return (const union MHD_ConnectionInfo *) &connection->addr;
     case MHD_CONNECTION_INFO_DAEMON:
       return (const union MHD_ConnectionInfo *) &connection->daemon;
+    case MHD_CONNECTION_INFO_CONNECTION_FD:
+      return (const union MHD_ConnectionInfo *) &connection->socket_fd;
     default:
       return NULL;
     };
