gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7921 - in libmicrohttpd: . doc src/daemon src/include


From: gnunet
Subject: [GNUnet-SVN] r7921 - in libmicrohttpd: . doc src/daemon src/include
Date: Sun, 16 Nov 2008 16:25:25 -0700 (MST)

Author: grothoff
Date: 2008-11-16 16:25:25 -0700 (Sun, 16 Nov 2008)
New Revision: 7921

Modified:
   libmicrohttpd/README
   libmicrohttpd/configure.ac
   libmicrohttpd/doc/microhttpd.texi
   libmicrohttpd/src/daemon/Makefile.am
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/connection.h
   libmicrohttpd/src/daemon/connection_https.c
   libmicrohttpd/src/daemon/daemon.c
   libmicrohttpd/src/daemon/internal.h
   libmicrohttpd/src/include/microhttpd.h
Log:
addressing 1433

Modified: libmicrohttpd/README
===================================================================
--- libmicrohttpd/README        2008-11-16 22:42:42 UTC (rev 7920)
+++ libmicrohttpd/README        2008-11-16 23:25:25 UTC (rev 7921)
@@ -70,19 +70,19 @@
 
 Missing features:
 =================
+- MHD_get_daemon_info is not implemented
 - SSL code is still too large:
-  - plenty of dead or unnecessary code imported from gnuTLS
-  => hunt for more dead code!
-  - some code is replicated (also in libgcrypt)
-  - libgcrypt is used, and is also bloated
+  * libgcrypt is used, and is also bloated
   => integrate required portions of libgcrypt into our tree
      instead of linking against it
+  * still some bloat in the SSL code;
+    consider removing "client" functionality
+  * most likely some headers declare functions, constants 
+    and types that are no longer present or used
+  * possibly other dead code
 - Make sure SSL works on non-GNU/Linux platforms
 
-- MHD_tls_connection_close is not called in any testcase!???
-  (is it used properly in the code!?)
 
-
 Untested features:
 ==================
 - add testcases for http/1.1 pipelining (need
@@ -99,12 +99,13 @@
 
 Functions not covered by "make check":
 ======================================
-- MHD_get_connection_values is not called in any testcase
-- MHD_set_connection_value is not called in any testcase
-- parse_cookie_header is not tested by any testcase
-- parse_arguments is not tested by any testcase
-- MHD_del_response_header is not called by any testcase
-- MHD_get_response_headers is not called by any testcase
+- MHD_get_connection_values
+- MHD_set_connection_value
+- parse_cookie_header
+- parse_arguments
+- MHD_del_response_header 
+- MHD_get_response_headers
+- MHD_tls_connection_close
 
 
 Missing documentation:

Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac  2008-11-16 22:42:42 UTC (rev 7920)
+++ libmicrohttpd/configure.ac  2008-11-16 23:25:25 UTC (rev 7921)
@@ -21,8 +21,8 @@
 #
 #
 AC_PREREQ(2.57)
-AC_INIT([libmicrohttpd], [0.4.0pre0],address@hidden)
-AM_INIT_AUTOMAKE([libmicrohttpd], [0.4.0pre0])
+AC_INIT([libmicrohttpd], [0.4.0],address@hidden)
+AM_INIT_AUTOMAKE([libmicrohttpd], [0.4.0])
 AM_CONFIG_HEADER([MHD_config.h])
 
 AH_TOP([#define _GNU_SOURCE  1])

Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi   2008-11-16 22:42:42 UTC (rev 7920)
+++ libmicrohttpd/doc/microhttpd.texi   2008-11-16 23:25:25 UTC (rev 7921)
@@ -292,6 +292,27 @@
 otherwise to a @code{struct sockaddr_in}.  If this option is not specified,
 the daemon will listen to incomming connections from anywhere.
 
address@hidden MHD_OPTION_URI_LOG_CALLBACK
+Specify a function that should be called before parsing the URI from
+the client.  The specified callback function can be used for processing
+the URI (including the options) before it is parsed.  The URI after
+parsing will no longer contain the options, which maybe inconvenient for
+logging.  This option should be followed by two arguments, the first
+one must be of the form
address@hidden
+ void * my_logger(void * cls, const char * uri)
address@hidden example
+where the return value will be passed as
address@hidden in calls to the @code{MHD_AccessHandlerCallback}
+when this request is processed later; returning a
+value of NULL has no special significance; (however,
+note that if you return non-NULL, you can no longer
+rely on the first call to the access handler having
address@hidden == *con_cls on entry} on entry)
address@hidden will be set to the second argument following
+MHD_OPTION_URI_LOG_CALLBACK.  Finally, @code{uri} will
+be the 0-terminated URI of the request.
+
 @item MHD_OPTION_HTTPS_MEM_KEY
 Memory pointer to the private key to be used by the
 HTTPS daemon.  This option should be followed by an
@@ -419,10 +440,6 @@
 
 @item MHD_GNUTLS_CIPHER_ARCFOUR_40
 
address@hidden MHD_GNUTLS_CIPHER_CAMELLIA_128_CBC
-
address@hidden MHD_GNUTLS_CIPHER_CAMELLIA_256_CBC
-
 @item MHD_GNUTLS_CIPHER_RC2_40_CBC
 
 @item MHD_GNUTLS_CIPHER_DES_CBC

Modified: libmicrohttpd/src/daemon/Makefile.am
===================================================================
--- libmicrohttpd/src/daemon/Makefile.am        2008-11-16 22:42:42 UTC (rev 
7920)
+++ libmicrohttpd/src/daemon/Makefile.am        2008-11-16 23:25:25 UTC (rev 
7921)
@@ -9,7 +9,7 @@
 
 if HAVE_GNU_LD
 #  If you want to debug with gdb, comment out this line:
-#  retaincommand=-Wl,--retain-symbols-file -Wl,$(srcdir)/SYMBOLS
+  retaincommand=-Wl,--retain-symbols-file -Wl,$(srcdir)/SYMBOLS
 endif
 
 EXTRA_DIST = SYMBOLS

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2008-11-16 22:42:42 UTC (rev 
7920)
+++ libmicrohttpd/src/daemon/connection.c       2008-11-16 23:25:25 UTC (rev 
7921)
@@ -275,12 +275,14 @@
 }
 
 /**
- * A serious error occured, close the
- * connection (and notify the application).
+ * Close the given connection and give the
+ * specified termination code to the user.
  */
-static void
-connection_close_error (struct MHD_Connection *connection)
+void 
+MHD_connection_close (struct MHD_Connection *connection,
+                     enum MHD_RequestTerminationCode termination_code)
 {
+
   SHUTDOWN (connection->socket_fd, SHUT_RDWR);
   CLOSE (connection->socket_fd);
   connection->socket_fd = -1;
@@ -290,10 +292,21 @@
                                           daemon->notify_completed_cls,
                                           connection,
                                           &connection->client_context,
-                                          MHD_REQUEST_TERMINATED_WITH_ERROR);
+                                          termination_code);
 }
 
 /**
+ * A serious error occured, close the
+ * connection (and notify the application).
+ */
+static void
+connection_close_error (struct MHD_Connection *connection)
+{
+  MHD_connection_close(connection,
+                      MHD_REQUEST_TERMINATED_WITH_ERROR);
+}
+
+/**
  * Prepare the response buffer of this connection for
  * sending.  Assumes that the response mutex is
  * already held.  If the transmission is complete,
@@ -1024,6 +1037,10 @@
       httpVersion[0] = '\0';
       httpVersion++;
     }
+  if (connection->daemon->uri_log_callback != NULL)
+    connection->client_context 
+      = 
connection->daemon->uri_log_callback(connection->daemon->uri_log_callback_cls,
+                                            uri);
   args = strstr (uri, "?");
   if (args != NULL)
     {

Modified: libmicrohttpd/src/daemon/connection.h
===================================================================
--- libmicrohttpd/src/daemon/connection.h       2008-11-16 22:42:42 UTC (rev 
7920)
+++ libmicrohttpd/src/daemon/connection.h       2008-11-16 23:25:25 UTC (rev 
7921)
@@ -43,8 +43,16 @@
 void MHD_set_http_calbacks (struct MHD_Connection *connection);
 
 int MHD_connection_handle_read (struct MHD_Connection *connection);
+
 int MHD_connection_handle_write (struct MHD_Connection *connection);
+
 int MHD_connection_handle_idle (struct MHD_Connection *connection);
 
+/**
+ * Close the given connection and give the
+ * specified termination code to the user.
+ */
+void MHD_connection_close (struct MHD_Connection *connection,
+                          enum MHD_RequestTerminationCode termination_code);
 
 #endif

Modified: libmicrohttpd/src/daemon/connection_https.c
===================================================================
--- libmicrohttpd/src/daemon/connection_https.c 2008-11-16 22:42:42 UTC (rev 
7920)
+++ libmicrohttpd/src/daemon/connection_https.c 2008-11-16 23:25:25 UTC (rev 
7921)
@@ -100,16 +100,8 @@
 {
   MHD__gnutls_bye (connection->tls_session, GNUTLS_SHUT_WR);
   connection->tls_session->internals.read_eof = 1;
-  SHUTDOWN (connection->socket_fd, SHUT_RDWR);
-  CLOSE (connection->socket_fd);
-  connection->socket_fd = -1;
-  connection->state = MHD_CONNECTION_CLOSED;
-  if (connection->daemon->notify_completed != NULL)
-    connection->daemon->notify_completed (connection->
-                                          daemon->notify_completed_cls,
-                                          connection,
-                                          &connection->client_context,
-                                          termination_code);
+  MHD_connection_close(connection,
+                      termination_code);
 }
 
 /**

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2008-11-16 22:42:42 UTC (rev 7920)
+++ libmicrohttpd/src/daemon/daemon.c   2008-11-16 23:25:25 UTC (rev 7921)
@@ -274,9 +274,8 @@
                 "Processing thread terminating, closing connection\n");
 #endif
 #endif
-      SHUTDOWN (con->socket_fd, SHUT_RDWR);
-      CLOSE (con->socket_fd);
-      con->socket_fd = -1;
+      MHD_connection_close(con,
+                          MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN);
     }
   return NULL;
 }
@@ -871,6 +870,10 @@
         case MHD_OPTION_SOCK_ADDR:
           servaddr = va_arg (ap, struct sockaddr *);
           break;
+       case MHD_OPTION_URI_LOG_CALLBACK:
+         retVal->uri_log_callback = va_arg(ap, void* (*)(void * cls, const 
char* uri));
+         retVal->uri_log_callback_cls = va_arg(ap, void*);
+         break;
 #if HTTPS_SUPPORT
         case MHD_OPTION_PROTOCOL_VERSION:
           _set_priority (&retVal->priority_cache->protocol,
@@ -1065,14 +1068,8 @@
           MHD_DLOG (daemon, "MHD shutdown, closing active connections\n");
 #endif
 #endif
-          if (daemon->notify_completed != NULL)
-            daemon->notify_completed (daemon->notify_completed_cls,
-                                      daemon->connections,
-                                      &daemon->connections->client_context,
-                                      MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN);
-          SHUTDOWN (daemon->connections->socket_fd, SHUT_RDWR);
-          CLOSE (daemon->connections->socket_fd);
-          daemon->connections->socket_fd = -1;
+         MHD_connection_close(daemon->connections,
+                              MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN);
         }
       MHD_cleanup_connections (daemon);
     }

Modified: libmicrohttpd/src/daemon/internal.h
===================================================================
--- libmicrohttpd/src/daemon/internal.h 2008-11-16 22:42:42 UTC (rev 7920)
+++ libmicrohttpd/src/daemon/internal.h 2008-11-16 23:25:25 UTC (rev 7921)
@@ -599,6 +599,10 @@
 
   void *notify_completed_cls;
 
+  void * (*uri_log_callback)(void * cls, const char * uri);
+
+  void * uri_log_callback_cls;
+
     /**
      * PID of the select thread (if we have internal select)
      */

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2008-11-16 22:42:42 UTC (rev 
7920)
+++ libmicrohttpd/src/include/microhttpd.h      2008-11-16 23:25:25 UTC (rev 
7921)
@@ -341,14 +341,37 @@
    */
   MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5,
 
- /**
-  * Bind daemon to the supplied sockaddr. this option should be followed by a
-  * 'struct sockaddr *'.  If 'MHD_USE_IPv6' is specified, the 'struct 
sockaddr*'
-  * should point to a 'struct sockaddr_in6', otherwise to a 'struct 
sockaddr_in'.
-  */
+  /**
+   * Bind daemon to the supplied sockaddr. this option should be followed by a
+   * 'struct sockaddr *'.  If 'MHD_USE_IPv6' is specified, the 'struct 
sockaddr*'
+   * should point to a 'struct sockaddr_in6', otherwise to a 'struct 
sockaddr_in'.
+   */
   MHD_OPTION_SOCK_ADDR = 6,
 
   /**
+   * Specify a function that should be called before parsing the URI from
+   * the client.  The specified callback function can be used for processing
+   * the URI (including the options) before it is parsed.  The URI after
+   * parsing will no longer contain the options, which maybe inconvenient for
+   * logging.  This option should be followed by two arguments, the first
+   * one must be of the form
+   * <pre>
+   *  void * my_logger(void * cls, const char * uri)
+   * </pre>
+   * where the return value will be passed as
+   * (*con_cls) in calls to the MHD_AccessHandlerCallback
+   * when this request is processed later; returning a
+   * value of NULL has no special significance (however,
+   * note that if you return non-NULL, you can no longer
+   * rely on the first call to the access handler having
+   * NULL == *con_cls on entry;)
+   * "cls" will be set to the second argument following
+   * MHD_OPTION_URI_LOG_CALLBACK.  Finally, uri will
+   * be the 0-terminated URI of the request.
+   */
+  MHD_OPTION_URI_LOG_CALLBACK = 7,
+
+  /**
    * Memory pointer for the private key (key.pem) to be used by the
    * HTTPS daemon.  This option should be followed by an
    * "const char*" argument.
@@ -513,8 +536,6 @@
   MHD_GNUTLS_CIPHER_AES_128_CBC,
   MHD_GNUTLS_CIPHER_AES_256_CBC,
   MHD_GNUTLS_CIPHER_ARCFOUR_40,
-  MHD_GNUTLS_CIPHER_CAMELLIA_128_CBC,
-  MHD_GNUTLS_CIPHER_CAMELLIA_256_CBC,
   MHD_GNUTLS_CIPHER_RC2_40_CBC = 90,
   MHD_GNUTLS_CIPHER_DES_CBC
 };





reply via email to

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