libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] feature request: get connection_timeout value from MHD_C


From: Vitaliy T
Subject: [libmicrohttpd] feature request: get connection_timeout value from MHD_Connection structure
Date: Tue, 14 Mar 2017 21:18:43 +0300

Hi,

While development of my own httpd server I've started using
  MHD_set_connection_option
    (connection, MHD_CONNECTION_OPTION_TIMEOUT, timeout)

It is useful before suspending a connection, because sending INTERNAL_ERROR
(src/microhttpd/connection.c) with the hardcoded text:

  Some programmer needs to study the manual more carefully.

is discourage, IMHO.

I want a function to retrieve the previous value of the element
connection_timeout
from MHD_Connection structure. In such way I may store this value somewhere
and restore it back after calling MHD_resume_connection().

Yes, I understand that I can use the global connection timeout from
MHD_OPTION_CONNECTION_TIMEOUT to restore back a timeout per connection.
But it does not cover all cases.

I would say even more. Because MHD_Connection is opaque it is not very useful
to pass everywhere MHD_Connection & MHD_Daemon. So, the implementation
might be something like this:

const union MHD_ConnectionInfo *
MHD_get_connection_info (struct MHD_Connection *connection,
  enum MHD_ConnectionInfoType info_type,
  ...)
{
   struct MHD_Daemon *daemon = connection->daemon;

   /* somehow we must to get an actual timeout, I did not read all
sources  yet */
   /* no critic about missing type cast */
   if (connection->connection_timeout == -1)
      return daemon->connection_timeout;
   else
      return connection->connection_timeout;
}


Thanks!

-- 
With Best Regards,
Vitaliy V. Tokarev



reply via email to

[Prev in Thread] Current Thread [Next in Thread]