gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r7599 - in libmicrohttpd: . doc src/daemon
Date: Sun, 24 Aug 2008 13:08:13 -0600 (MDT)

Author: grothoff
Date: 2008-08-24 13:08:13 -0600 (Sun, 24 Aug 2008)
New Revision: 7599

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/doc/microhttpd.texi
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/daemon.c
   libmicrohttpd/src/daemon/reason_phrase.c
Log:
handle 0 as specified in documentation

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2008-08-24 18:48:08 UTC (rev 7598)
+++ libmicrohttpd/ChangeLog     2008-08-24 19:08:13 UTC (rev 7599)
@@ -1,3 +1,9 @@
+Sun Aug 24 13:05:41 MDT 2008
+        Now handling clients returning 0 from response callback
+        as specified in the documentation (abort if internal
+        select is used, retry immediately if a thread per 
+        connection is used). -CG
+
 Sun Aug 24 12:44:43 MDT 2008
         Added missing reason phrase. -SG
 

Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi   2008-08-24 18:48:08 UTC (rev 7598)
+++ libmicrohttpd/doc/microhttpd.texi   2008-08-24 19:08:13 UTC (rev 7599)
@@ -507,10 +507,11 @@
 
 Note that returning zero will cause @mhd{} to try again, either
 ``immediately'' if in multi-threaded mode (in which case the callback
-may want to do blocking operations) or in the next round if MHD_run is
-used.  Returning zero for a daemon that runs in internal
address@hidden mode is an error (since it would result in busy
-waiting) and will cause the program to be aborted (@cfunction{abort}).
+may want to do blocking operations to avoid busy waiting) or in the
+next round if @code{MHD_run} is used.  Returning zero for a daemon
+that runs in internal @cfunction{select} mode is an error (since it
+would result in busy waiting) and cause the program to be aborted
+(@cfunction{abort}).
 
 @table @var
 @item cls

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2008-08-24 18:48:08 UTC (rev 
7598)
+++ libmicrohttpd/src/daemon/connection.c       2008-08-24 19:08:13 UTC (rev 
7599)
@@ -330,6 +330,9 @@
                        MHD_MIN (response->data_buffer_size,
                                 response->total_size -
                                 connection->response_write_position));
+  if ( (ret == 0) &&
+       (0 != (connection->daemon->options & MHD_USE_SELECT_INTERNALLY)) )
+    abort(); /* serious client API violation */
   if (ret == -1)
     {
       /* either error or http 1.0 transfer, close
@@ -1715,6 +1718,12 @@
           if (connection->socket_fd != -1)
             connection_close_error (connection);
           return MHD_NO;
+        case MHD_TLS_CONNECTION_INIT:
+       case MHD_TLS_HELLO_REQUEST:
+       case MHD_TLS_HANDSHAKE_FAILED:
+       case MHD_TLS_HANDSHAKE_COMPLETE:
+         EXTRA_CHECK(0);
+         break;
         }
       break;
     }

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2008-08-24 18:48:08 UTC (rev 7598)
+++ libmicrohttpd/src/daemon/daemon.c   2008-08-24 19:08:13 UTC (rev 7599)
@@ -251,6 +251,9 @@
         tv.tv_sec = timeout - (now - con->last_activity);
       else
         tv.tv_sec = 0;
+      if ( (con->state == MHD_CONNECTION_NORMAL_BODY_UNREADY) ||
+          (con->state == MHD_CONNECTION_CHUNKED_BODY_UNREADY) )
+       timeout = 1; /* do not block */ 
       num_ready = SELECT (max + 1,
                           &rs, &ws, &es, (timeout != 0) ? &tv : NULL);
       if (num_ready < 0)

Modified: libmicrohttpd/src/daemon/reason_phrase.c
===================================================================
--- libmicrohttpd/src/daemon/reason_phrase.c    2008-08-24 18:48:08 UTC (rev 
7598)
+++ libmicrohttpd/src/daemon/reason_phrase.c    2008-08-24 19:08:13 UTC (rev 
7599)
@@ -2,7 +2,6 @@
      This file is part of libmicrohttpd
      (C) 2007 Lymba
 
-
      This library is free software; you can redistribute it and/or
      modify it under the terms of the GNU Lesser General Public
      License as published by the Free Software Foundation; either





reply via email to

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