gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5927 - libmicrohttpd/src/daemon


From: gnunet
Subject: [GNUnet-SVN] r5927 - libmicrohttpd/src/daemon
Date: Sun, 16 Dec 2007 03:28:23 -0700 (MST)

Author: grothoff
Date: 2007-12-16 03:28:22 -0700 (Sun, 16 Dec 2007)
New Revision: 5927

Modified:
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/daemon.c
   libmicrohttpd/src/daemon/daemontest_post_loop.c
   libmicrohttpd/src/daemon/daemontest_postform.c
   libmicrohttpd/src/daemon/daemontest_put_chunked.c
   libmicrohttpd/src/daemon/postprocessor.c
   libmicrohttpd/src/daemon/reason_phrase.c
   libmicrohttpd/src/daemon/reason_phrase.h
Log:
formatting

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2007-12-16 10:27:29 UTC (rev 
5926)
+++ libmicrohttpd/src/daemon/connection.c       2007-12-16 10:28:22 UTC (rev 
5927)
@@ -152,7 +152,8 @@
   if ((connection == NULL) ||
       (response == NULL) ||
       (connection->response != NULL) ||
-      (connection->have_received_body == MHD_NO) || 
(connection->have_received_headers == MHD_NO))
+      (connection->have_received_body == MHD_NO)
+      || (connection->have_received_headers == MHD_NO))
     return MHD_NO;
   MHD_increment_response_rc (response);
   connection->response = response;
@@ -184,7 +185,8 @@
                                                           MHD_HEADER_KIND,
                                                           
MHD_HTTP_HEADER_EXPECT)))
           && (0 == strcasecmp (expect, "100-continue"))
-          && (connection->continue_message_write_offset < strlen 
(HTTP_100_CONTINUE)));
+          && (connection->continue_message_write_offset <
+              strlen (HTTP_100_CONTINUE)));
 }
 
 /**
@@ -224,11 +226,12 @@
                        connection->response_write_position,
                        response->data,
                        MIN (response->data_buffer_size,
-                            response->total_size - 
connection->response_write_position));
+                            response->total_size -
+                            connection->response_write_position));
   if (ret == -1)
     {
       /* end of message, signal other side by closing! */
-#if DEBUG_CLOSE 
+#if DEBUG_CLOSE
 #if HAVE_MESSAGES
       MHD_DLOG (connection->daemon, "Closing connection (end of response)\n");
 #endif
@@ -608,9 +611,9 @@
   unsigned long long cval;
   struct MHD_Response *response;
 
-  if ( ( (connection->have_received_body == MHD_YES) &&
-        (connection->have_chunked_upload == MHD_NO) ) ||
-       (connection->have_received_headers == MHD_YES) )
+  if (((connection->have_received_body == MHD_YES) &&
+       (connection->have_chunked_upload == MHD_NO)) ||
+      (connection->have_received_headers == MHD_YES))
     abort ();
   colon = NULL;                 /* make gcc happy */
   last = NULL;
@@ -689,24 +692,25 @@
                 }
               else
                 {
-                 if (connection->have_chunked_upload == MHD_NO) 
-                   {
-                     connection->remaining_upload_size = -1;  /* unknown size 
*/
-                     if (0 == 
strcasecmp(MHD_lookup_connection_value(connection,
-                                                                     
MHD_HEADER_KIND,
-                                                                     
MHD_HTTP_HEADER_TRANSFER_ENCODING),
-                                         "chunked"))
-                       connection->have_chunked_upload = MHD_YES;
-                   }
-                 else
-                   {
-                     /* we were actually processing the footers at the
-                        END of a chunked encoding; give connection 
-                        handler an extra chance... */
-                     connection->have_chunked_upload = MHD_NO; /* no more! */
-                     MHD_call_connection_handler(connection);
-                   }
-               }
+                  if (connection->have_chunked_upload == MHD_NO)
+                    {
+                      connection->remaining_upload_size = -1;   /* unknown 
size */
+                      if (0 ==
+                          strcasecmp (MHD_lookup_connection_value
+                                      (connection, MHD_HEADER_KIND,
+                                       MHD_HTTP_HEADER_TRANSFER_ENCODING),
+                                      "chunked"))
+                        connection->have_chunked_upload = MHD_YES;
+                    }
+                  else
+                    {
+                      /* we were actually processing the footers at the
+                         END of a chunked encoding; give connection 
+                         handler an extra chance... */
+                      connection->have_chunked_upload = MHD_NO; /* no more! */
+                      MHD_call_connection_handler (connection);
+                    }
+                }
             }
           if ((0 != (MHD_USE_PEDANTIC_CHECKS & connection->daemon->options))
               && (NULL != connection->version)
@@ -807,166 +811,167 @@
     return;                     /* already queued a response */
   if (connection->have_received_headers == MHD_NO)
     abort ();                   /* bad timing... */
-  do 
+  do
     {
       instant_retry = MHD_NO;
       available = connection->read_buffer_offset;
-      if (connection->have_chunked_upload == MHD_YES) 
-       {
-         if ( (connection->current_chunk_offset == 
connection->current_chunk_size) &&
-              (connection->current_chunk_offset != 0) &&
-              (available >= 2) )
-           {
-             /* skip new line at the *end* of a chunk */
-             i = 0;
-             if ( (connection->read_buffer[i] == '\r') ||
-                  (connection->read_buffer[i] == '\n') )
-               i++; /* skip 1st part of line feed */
-             if ( (connection->read_buffer[i] == '\r') ||
-                  (connection->read_buffer[i] == '\n') )
-               i++; /* skip 2nd part of line feed */
-             if (i == 0)
-               {
-                 /* malformed encoding */
+      if (connection->have_chunked_upload == MHD_YES)
+        {
+          if ((connection->current_chunk_offset ==
+               connection->current_chunk_size)
+              && (connection->current_chunk_offset != 0) && (available >= 2))
+            {
+              /* skip new line at the *end* of a chunk */
+              i = 0;
+              if ((connection->read_buffer[i] == '\r') ||
+                  (connection->read_buffer[i] == '\n'))
+                i++;            /* skip 1st part of line feed */
+              if ((connection->read_buffer[i] == '\r') ||
+                  (connection->read_buffer[i] == '\n'))
+                i++;            /* skip 2nd part of line feed */
+              if (i == 0)
+                {
+                  /* malformed encoding */
 #if HAVE_MESSAGES
-                 MHD_DLOG (connection->daemon,
-                           "Received malformed HTTP request (bad chunked 
encoding), closing connection.\n");
+                  MHD_DLOG (connection->daemon,
+                            "Received malformed HTTP request (bad chunked 
encoding), closing connection.\n");
 #endif
-                 connection_close_error (connection);
-                 return;
-               }
-             connection->read_buffer_offset -= i;
-             available -= i;
-             memmove(connection->read_buffer,
-                     &connection->read_buffer[i],
-                     available);
-             connection->current_chunk_offset = 0;
-             connection->current_chunk_size = 0;
-           }
-         if (connection->current_chunk_offset < connection->current_chunk_size)
-           {
-             /* we are in the middle of a chunk, give
-                as much as possible to the client (without
-                crossing chunk boundaries) */
-             processed = connection->current_chunk_size - 
connection->current_chunk_offset;
-             if (processed > available)
-               processed = available;    
-             available -= processed;
-             if (available > 0)
-               instant_retry = MHD_YES;
-           }
-         else
-           {
-             /* we need to read chunk boundaries */
-             i = 0;
-             while (i < available)
-               {
-                 if ( (connection->read_buffer[i] == '\r') ||
-                      (connection->read_buffer[i] == '\n') )
-                   break;
-                 i++;
-                 if (i >= 6)
-                   break;
-               }
-             if (i >= available)
-               return; /* need more data... */
-             /* The following if-statement is a bit crazy -- we
-                use the second clause only for the side-effect,
-                0-terminating the buffer for the following sscanf
-                attempts; yes, there should be only a single 
-                "="-sign (assignment!) in the read_buffer[i]-line. */
-             if ( (i >= 6) || 
-                  ((connection->read_buffer[i] = '\0')) ||
-                  ( (1 != sscanf(connection->read_buffer,
-                                 "%X",
-                                 &connection->current_chunk_size)) &&
-                    (1 != sscanf(connection->read_buffer,
-                                 "%x",
-                                 &connection->current_chunk_size)) ) )
-               {
-                 /* malformed encoding */
+                  connection_close_error (connection);
+                  return;
+                }
+              connection->read_buffer_offset -= i;
+              available -= i;
+              memmove (connection->read_buffer,
+                       &connection->read_buffer[i], available);
+              connection->current_chunk_offset = 0;
+              connection->current_chunk_size = 0;
+            }
+          if (connection->current_chunk_offset <
+              connection->current_chunk_size)
+            {
+              /* we are in the middle of a chunk, give
+                 as much as possible to the client (without
+                 crossing chunk boundaries) */
+              processed =
+                connection->current_chunk_size -
+                connection->current_chunk_offset;
+              if (processed > available)
+                processed = available;
+              available -= processed;
+              if (available > 0)
+                instant_retry = MHD_YES;
+            }
+          else
+            {
+              /* we need to read chunk boundaries */
+              i = 0;
+              while (i < available)
+                {
+                  if ((connection->read_buffer[i] == '\r') ||
+                      (connection->read_buffer[i] == '\n'))
+                    break;
+                  i++;
+                  if (i >= 6)
+                    break;
+                }
+              if (i >= available)
+                return;         /* need more data... */
+              /* The following if-statement is a bit crazy -- we
+                 use the second clause only for the side-effect,
+                 0-terminating the buffer for the following sscanf
+                 attempts; yes, there should be only a single 
+                 "="-sign (assignment!) in the read_buffer[i]-line. */
+              if ((i >= 6) ||
+                  ((connection->read_buffer[i] = '\0')) ||
+                  ((1 != sscanf (connection->read_buffer,
+                                 "%X",
+                                 &connection->current_chunk_size)) &&
+                   (1 != sscanf (connection->read_buffer,
+                                 "%x", &connection->current_chunk_size))))
+                {
+                  /* malformed encoding */
 #if HAVE_MESSAGES
-                 MHD_DLOG (connection->daemon,
-                           "Received malformed HTTP request (bad chunked 
encoding), closing connection.\n");
+                  MHD_DLOG (connection->daemon,
+                            "Received malformed HTTP request (bad chunked 
encoding), closing connection.\n");
 #endif
-                 connection_close_error (connection);
-                 return;
-               }
-             i++;
-             if ( (connection->read_buffer[i] == '\r') ||
-                  (connection->read_buffer[i] == '\n') )
-               i++; /* skip 2nd part of line feed */
-             memmove(connection->read_buffer,
-                     &connection->read_buffer[i],
-                     available - i);
-             connection->read_buffer_offset -= i;
-             connection->current_chunk_offset = 0;
-             instant_retry = MHD_YES; 
-             if (connection->current_chunk_size == 0)
-               {
-                 /* we're back to reading HEADERS (footers!) */
-                 connection->have_received_body = MHD_YES;
-                 connection->remaining_upload_size = 0;
-                 connection->have_received_headers = MHD_NO;
-                 MHD_parse_connection_headers(connection);
-                 return;
-               }
-             continue;
-           }      
-       }
+                  connection_close_error (connection);
+                  return;
+                }
+              i++;
+              if ((connection->read_buffer[i] == '\r') ||
+                  (connection->read_buffer[i] == '\n'))
+                i++;            /* skip 2nd part of line feed */
+              memmove (connection->read_buffer,
+                       &connection->read_buffer[i], available - i);
+              connection->read_buffer_offset -= i;
+              connection->current_chunk_offset = 0;
+              instant_retry = MHD_YES;
+              if (connection->current_chunk_size == 0)
+                {
+                  /* we're back to reading HEADERS (footers!) */
+                  connection->have_received_body = MHD_YES;
+                  connection->remaining_upload_size = 0;
+                  connection->have_received_headers = MHD_NO;
+                  MHD_parse_connection_headers (connection);
+                  return;
+                }
+              continue;
+            }
+        }
       else
-       {
-         /* no chunked encoding, give all to the client */
-         processed = available;
-         available = 0;
-       }
+        {
+          /* no chunked encoding, give all to the client */
+          processed = available;
+          available = 0;
+        }
       used = processed;
       ah = MHD_find_access_handler (connection);
       if (MHD_NO == ah->dh (ah->dh_cls,
-                           connection,
-                           connection->url,
-                           connection->method,
-                           connection->version,
-                           connection->read_buffer, &processed,
-                           &connection->client_context))
-       {
-         /* serious internal error, close connection */
+                            connection,
+                            connection->url,
+                            connection->method,
+                            connection->version,
+                            connection->read_buffer, &processed,
+                            &connection->client_context))
+        {
+          /* serious internal error, close connection */
 #if HAVE_MESSAGES
-         MHD_DLOG (connection->daemon,
-                   "Internal application error, closing connection.\n");
+          MHD_DLOG (connection->daemon,
+                    "Internal application error, closing connection.\n");
 #endif
-         connection_close_error (connection);
-         return;
-       }
+          connection_close_error (connection);
+          return;
+        }
       if (processed != 0)
-       instant_retry = MHD_NO; /* client did not process everything */
+        instant_retry = MHD_NO; /* client did not process everything */
       used -= processed;
-      if (connection->have_chunked_upload == MHD_YES) 
-       connection->current_chunk_offset += used;
+      if (connection->have_chunked_upload == MHD_YES)
+        connection->current_chunk_offset += used;
       /* dh left "processed" bytes in buffer for next time... */
       if (used > 0)
-       memmove (connection->read_buffer,
-                &connection->read_buffer[used],
-                processed + available);
-      if (connection->remaining_upload_size != -1) 
-       connection->remaining_upload_size -= used;
+        memmove (connection->read_buffer,
+                 &connection->read_buffer[used], processed + available);
+      if (connection->remaining_upload_size != -1)
+        connection->remaining_upload_size -= used;
       connection->read_buffer_offset = processed + available;
       if ((connection->remaining_upload_size == 0) ||
-         ((connection->read_buffer_offset == 0) &&
-          (connection->remaining_upload_size == -1) && (connection->socket_fd 
== -1)))
-       {
-         connection->have_received_body = MHD_YES;
-         if (connection->read_buffer != NULL)
-           MHD_pool_reallocate (connection->pool,
-                                connection->read_buffer,
-                                (connection->read_buffer ==
-                                 NULL) ? 0 : connection->read_buffer_size + 1,
-                                0);
-         connection->read_buffer_offset = 0;
-         connection->read_buffer_size = 0;
-         connection->read_buffer = NULL;
-       }
-    } while (instant_retry == MHD_YES);
+          ((connection->read_buffer_offset == 0) &&
+           (connection->remaining_upload_size == -1)
+           && (connection->socket_fd == -1)))
+        {
+          connection->have_received_body = MHD_YES;
+          if (connection->read_buffer != NULL)
+            MHD_pool_reallocate (connection->pool,
+                                 connection->read_buffer,
+                                 (connection->read_buffer ==
+                                  NULL) ? 0 : connection->read_buffer_size +
+                                 1, 0);
+          connection->read_buffer_offset = 0;
+          connection->read_buffer_size = 0;
+          connection->read_buffer = NULL;
+        }
+    }
+  while (instant_retry == MHD_YES);
 }
 
 /**
@@ -1023,8 +1028,8 @@
     }
   bytes_read = RECV (connection->socket_fd,
                      &connection->read_buffer[connection->read_buffer_offset],
-                     connection->read_buffer_size - 
connection->read_buffer_offset, 
-                    MSG_NOSIGNAL);
+                     connection->read_buffer_size -
+                     connection->read_buffer_offset, MSG_NOSIGNAL);
   if (bytes_read < 0)
     {
       if (errno == EINTR)
@@ -1040,7 +1045,8 @@
     {
       /* other side closed connection */
       connection->read_close = MHD_YES;
-      if ((connection->have_received_headers == MHD_YES) && 
(connection->read_buffer_offset > 0))
+      if ((connection->have_received_headers == MHD_YES)
+          && (connection->read_buffer_offset > 0))
         MHD_call_connection_handler (connection);
 #if DEBUG_CLOSE
 #if HAVE_MESSAGES
@@ -1049,18 +1055,20 @@
 #endif
 #endif
       shutdown (connection->socket_fd, SHUT_RD);
-      if ( (connection->have_received_headers == MHD_NO) ||
-          (connection->have_received_body == MHD_NO) ) {
-       /* no request => no response! */
-       CLOSE (connection->socket_fd);
-       connection->socket_fd = -1;
-      }
+      if ((connection->have_received_headers == MHD_NO) ||
+          (connection->have_received_body == MHD_NO))
+        {
+          /* no request => no response! */
+          CLOSE (connection->socket_fd);
+          connection->socket_fd = -1;
+        }
       return MHD_YES;
     }
   connection->read_buffer_offset += bytes_read;
   if (connection->have_received_headers == MHD_NO)
     MHD_parse_connection_headers (connection);
-  if ((connection->have_received_headers == MHD_YES) && (connection->method != 
NULL))
+  if ((connection->have_received_headers == MHD_YES)
+      && (connection->method != NULL))
     MHD_call_connection_handler (connection);
   return MHD_YES;
 }
@@ -1134,8 +1142,9 @@
   char *data;
 
   MHD_add_extra_headers (connection);
-  const char* reason_phrase = 
MHD_get_reason_phrase_for(connection->responseCode);
-  _REAL_SNPRINTF (code, 128, "%s %u %s\r\n", MHD_HTTP_VERSION_1_1, 
+  const char *reason_phrase =
+    MHD_get_reason_phrase_for (connection->responseCode);
+  _REAL_SNPRINTF (code, 128, "%s %u %s\r\n", MHD_HTTP_VERSION_1_1,
                   connection->responseCode, reason_phrase);
   off = strlen (code);
   /* estimate size */
@@ -1193,14 +1202,15 @@
 {
   struct MHD_Response *response;
   int ret;
-  const char * end;
+  const char *end;
 
   if (MHD_need_100_continue (connection))
     {
       ret = SEND (connection->socket_fd,
-                  
&HTTP_100_CONTINUE[connection->continue_message_write_offset],
-                  strlen (HTTP_100_CONTINUE) - 
connection->continue_message_write_offset, 
-                 MSG_NOSIGNAL);
+                  &HTTP_100_CONTINUE[connection->
+                                     continue_message_write_offset],
+                  strlen (HTTP_100_CONTINUE) -
+                  connection->continue_message_write_offset, MSG_NOSIGNAL);
       if (ret < 0)
         {
           if (errno == EINTR)
@@ -1215,7 +1225,8 @@
 #if DEBUG_SEND_DATA
       fprintf (stderr,
                "Sent 100 continue response: `%.*s'\n",
-               ret, 
&HTTP_100_CONTINUE[connection->continue_message_write_offset]);
+               ret,
+               &HTTP_100_CONTINUE[connection->continue_message_write_offset]);
 #endif
       connection->continue_message_write_offset += ret;
       return MHD_YES;
@@ -1242,9 +1253,10 @@
           return MHD_NO;
         }
       ret = SEND (connection->socket_fd,
-                  
&connection->write_buffer[connection->write_buffer_send_offset],
-                  connection->write_buffer_append_offset - 
connection->write_buffer_send_offset, 
-                 MSG_NOSIGNAL);
+                  &connection->write_buffer[connection->
+                                            write_buffer_send_offset],
+                  connection->write_buffer_append_offset -
+                  connection->write_buffer_send_offset, MSG_NOSIGNAL);
       if (ret < 0)
         {
           if (errno == EINTR)
@@ -1259,10 +1271,13 @@
 #if DEBUG_SEND_DATA
       fprintf (stderr,
                "Sent HEADER response: `%.*s'\n",
-               ret, 
&connection->write_buffer[connection->write_buffer_send_offset]);
+               ret,
+               &connection->write_buffer[connection->
+                                         write_buffer_send_offset]);
 #endif
       connection->write_buffer_send_offset += ret;
-      if (connection->write_buffer_append_offset == 
connection->write_buffer_send_offset)
+      if (connection->write_buffer_append_offset ==
+          connection->write_buffer_send_offset)
         {
           connection->write_buffer_append_offset = 0;
           connection->write_buffer_send_offset = 0;
@@ -1284,17 +1299,18 @@
   if ((response->crc != NULL) &&
       ((response->data_start > connection->response_write_position) ||
        (response->data_start + response->data_size <=
-        connection->response_write_position)) && (MHD_YES != ready_response 
(connection)))
+        connection->response_write_position))
+      && (MHD_YES != ready_response (connection)))
     {
       pthread_mutex_unlock (&response->mutex);
       return MHD_YES;
     }
   /* transmit */
   ret = SEND (connection->socket_fd,
-              &response->data[connection->response_write_position - 
response->data_start],
+              &response->data[connection->response_write_position -
+                              response->data_start],
               response->data_size - (connection->response_write_position -
-                                     response->data_start), 
-             MSG_NOSIGNAL);
+                                     response->data_start), MSG_NOSIGNAL);
   if (response->crc != NULL)
     pthread_mutex_unlock (&response->mutex);
   if (ret < 0)
@@ -1312,7 +1328,8 @@
   fprintf (stderr,
            "Sent DATA response: `%.*s'\n",
            ret,
-           &response->data[connection->response_write_position - 
response->data_start]);
+           &response->data[connection->response_write_position -
+                           response->data_start]);
 #endif
   connection->response_write_position += ret;
   if (connection->response_write_position > response->total_size)
@@ -1330,8 +1347,8 @@
                                               &connection->client_context,
                                               
MHD_REQUEST_TERMINATED_COMPLETED_OK);
       end = MHD_lookup_connection_value (connection,
-                                        MHD_HEADER_KIND,
-                                        MHD_HTTP_HEADER_CONNECTION);
+                                         MHD_HEADER_KIND,
+                                         MHD_HTTP_HEADER_CONNECTION);
       connection->client_context = NULL;
       connection->continue_message_write_offset = 0;
       connection->responseCode = 0;
@@ -1343,14 +1360,14 @@
       connection->response_write_position = 0;
       connection->have_chunked_upload = MHD_NO;
       connection->method = NULL;
-      connection->url = NULL;      
+      connection->url = NULL;
       if ((end != NULL) && (0 == strcasecmp (end, "close")))
-       {
-         /* other side explicitly requested
-            that we close the connection after
-            this request */
-         connection->read_close = MHD_YES;
-       }
+        {
+          /* other side explicitly requested
+             that we close the connection after
+             this request */
+          connection->read_close = MHD_YES;
+        }
       if ((connection->read_close == MHD_YES) ||
           (0 != strcasecmp (MHD_HTTP_VERSION_1_1, connection->version)))
         {

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2007-12-16 10:27:29 UTC (rev 5926)
+++ libmicrohttpd/src/daemon/daemon.c   2007-12-16 10:28:22 UTC (rev 5927)
@@ -171,7 +171,7 @@
     }
 #if DEBUG_CONNECT
   MHD_DLOG (daemon, "Maximum socket in select set: %d\n", *max_fd);
-#endif  
+#endif
   return MHD_YES;
 }
 
@@ -264,7 +264,7 @@
   socklen_t addrlen;
   int s;
 #if OSX
-  static int on=1;
+  static int on = 1;
 #endif
 
 
@@ -287,7 +287,7 @@
     }
 #if DEBUG_CONNECT
   MHD_DLOG (daemon, "Accepted connection on socket %d\n", s);
-#endif  
+#endif
   if (daemon->max_connections == 0)
     {
       /* above connection limit - reject */
@@ -314,11 +314,7 @@
 #if OSX
 #ifdef SOL_SOCKET
 #ifdef SO_NOSIGPIPE
-  setsockopt(s,
-            SOL_SOCKET,
-            SO_NOSIGPIPE,
-            &on,
-            sizeof(on));
+  setsockopt (s, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof (on));
 #endif
 #endif
 #endif
@@ -437,8 +433,9 @@
           continue;
         }
 
-      if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
-          ((pos->have_received_headers == MHD_YES) && (pos->response == NULL)) 
)
+      if ((0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
+          ((pos->have_received_headers == MHD_YES)
+           && (pos->response == NULL)))
         MHD_call_connection_handler (pos);
 
       prev = pos;
@@ -680,11 +677,12 @@
   if ((SETSOCKOPT (socket_fd,
                    SOL_SOCKET,
                    SO_REUSEADDR,
-                   &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0) {
+                   &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0)
+    {
 #if HAVE_MESSAGES
-    fprintf (stderr, "setsockopt failed: %s\n", STRERROR (errno));
+      fprintf (stderr, "setsockopt failed: %s\n", STRERROR (errno));
 #endif
-  }
+    }
   if ((options & MHD_USE_IPv6) != 0)
     {
       memset (&servaddr6, 0, sizeof (struct sockaddr_in6));

Modified: libmicrohttpd/src/daemon/daemontest_post_loop.c
===================================================================
--- libmicrohttpd/src/daemon/daemontest_post_loop.c     2007-12-16 10:27:29 UTC 
(rev 5926)
+++ libmicrohttpd/src/daemon/daemontest_post_loop.c     2007-12-16 10:28:22 UTC 
(rev 5927)
@@ -78,19 +78,17 @@
       printf ("METHOD: %s\n", method);
       return MHD_NO;            /* unexpected method */
     }
-  if ( (*mptr != NULL) &&
-       (0 == *upload_data_size) ) {
-    if (*mptr != &marker)
-      abort();
-    response = MHD_create_response_from_data (2,
-                                             "OK",
-                                             MHD_NO, MHD_NO);
-    ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
-    MHD_destroy_response (response);
-    *mptr = NULL;
-    return ret;
-  }
-  if (strlen(POST_DATA) != *upload_data_size)
+  if ((*mptr != NULL) && (0 == *upload_data_size))
+    {
+      if (*mptr != &marker)
+        abort ();
+      response = MHD_create_response_from_data (2, "OK", MHD_NO, MHD_NO);
+      ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+      MHD_destroy_response (response);
+      *mptr = NULL;
+      return ret;
+    }
+  if (strlen (POST_DATA) != *upload_data_size)
     return MHD_YES;
   *upload_data_size = 0;
   *mptr = &marker;
@@ -115,48 +113,49 @@
                         1080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
-  for (i=0;i<LOOPCOUNT;i++) {
-    if (0 == i % 100)
-      fprintf(stderr, ".");
-    c = curl_easy_init ();
-    cbc.pos = 0;
-    buf[0] = '\0';
-    sprintf(url, "http://localhost:1080/hw%d";, i);
-    curl_easy_setopt (c, CURLOPT_URL, url);
-    curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
-    curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-    curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA);
-    curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA));
-    curl_easy_setopt (c, CURLOPT_POST, 1L);
-    curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
-    curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
-    if (oneone)
-      curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
-    else
-      curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
-    curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 2L);
-    // NOTE: use of CONNECTTIMEOUT without also
-    //   setting NOSIGNAL results in really weird
-    //   crashes on my system!
-    curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
-    if (CURLE_OK != (errornum = curl_easy_perform (c)))
-      {
-       fprintf (stderr,
-                "curl_easy_perform failed: `%s'\n",
-                curl_easy_strerror (errornum));
-       curl_easy_cleanup (c);
-       MHD_stop_daemon (d);
-       return 2;
-      }
-    curl_easy_cleanup (c);
-    if ( (buf[0] != 'O') ||
-        (buf[1] != 'K') ) {
-      MHD_stop_daemon (d);
-      return 4;
+  for (i = 0; i < LOOPCOUNT; i++)
+    {
+      if (0 == i % 100)
+        fprintf (stderr, ".");
+      c = curl_easy_init ();
+      cbc.pos = 0;
+      buf[0] = '\0';
+      sprintf (url, "http://localhost:1080/hw%d";, i);
+      curl_easy_setopt (c, CURLOPT_URL, url);
+      curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
+      curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
+      curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA);
+      curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA));
+      curl_easy_setopt (c, CURLOPT_POST, 1L);
+      curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
+      curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
+      if (oneone)
+        curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+      else
+        curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+      curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 2L);
+      // NOTE: use of CONNECTTIMEOUT without also
+      //   setting NOSIGNAL results in really weird
+      //   crashes on my system!
+      curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
+      if (CURLE_OK != (errornum = curl_easy_perform (c)))
+        {
+          fprintf (stderr,
+                   "curl_easy_perform failed: `%s'\n",
+                   curl_easy_strerror (errornum));
+          curl_easy_cleanup (c);
+          MHD_stop_daemon (d);
+          return 2;
+        }
+      curl_easy_cleanup (c);
+      if ((buf[0] != 'O') || (buf[1] != 'K'))
+        {
+          MHD_stop_daemon (d);
+          return 4;
+        }
     }
-  }
   MHD_stop_daemon (d);
-  fprintf(stderr, "\n");
+  fprintf (stderr, "\n");
   return 0;
 }
 
@@ -177,48 +176,49 @@
                         1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 16;
-  for (i=0;i<LOOPCOUNT;i++) {
-    if (0 == i % 100)
-      fprintf(stderr, ".");
-    c = curl_easy_init ();
-    cbc.pos = 0;
-    buf[0] = '\0';
-    sprintf(url, "http://localhost:1081/hw%d";, i);
-    curl_easy_setopt (c, CURLOPT_URL, url);
-    curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
-    curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-    curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA);
-    curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA));
-    curl_easy_setopt (c, CURLOPT_POST, 1L);
-    curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
-    curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
-    if (oneone)
-      curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
-    else
-      curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
-    curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 2L);
-    // NOTE: use of CONNECTTIMEOUT without also
-    //   setting NOSIGNAL results in really weird
-    //   crashes on my system!
-    curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
-    if (CURLE_OK != (errornum = curl_easy_perform (c)))
-      {
-       fprintf (stderr,
-                "curl_easy_perform failed: `%s'\n",
-                curl_easy_strerror (errornum));
-       curl_easy_cleanup (c);
-       MHD_stop_daemon (d);
-       return 32;
-      }
-    curl_easy_cleanup (c);
-    if ( (buf[0] != 'O') ||
-        (buf[1] != 'K') ) {
-      MHD_stop_daemon (d);
-      return 64;
+  for (i = 0; i < LOOPCOUNT; i++)
+    {
+      if (0 == i % 100)
+        fprintf (stderr, ".");
+      c = curl_easy_init ();
+      cbc.pos = 0;
+      buf[0] = '\0';
+      sprintf (url, "http://localhost:1081/hw%d";, i);
+      curl_easy_setopt (c, CURLOPT_URL, url);
+      curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
+      curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
+      curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA);
+      curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA));
+      curl_easy_setopt (c, CURLOPT_POST, 1L);
+      curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
+      curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
+      if (oneone)
+        curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+      else
+        curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+      curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 2L);
+      // NOTE: use of CONNECTTIMEOUT without also
+      //   setting NOSIGNAL results in really weird
+      //   crashes on my system!
+      curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
+      if (CURLE_OK != (errornum = curl_easy_perform (c)))
+        {
+          fprintf (stderr,
+                   "curl_easy_perform failed: `%s'\n",
+                   curl_easy_strerror (errornum));
+          curl_easy_cleanup (c);
+          MHD_stop_daemon (d);
+          return 32;
+        }
+      curl_easy_cleanup (c);
+      if ((buf[0] != 'O') || (buf[1] != 'K'))
+        {
+          MHD_stop_daemon (d);
+          return 64;
+        }
     }
-  }
   MHD_stop_daemon (d);
-  fprintf(stderr, "\n");
+  fprintf (stderr, "\n");
   return 0;
 }
 
@@ -259,106 +259,109 @@
       MHD_stop_daemon (d);
       return 512;
     }
-  for (i=0;i<LOOPCOUNT;i++) {
-    if (0 == i % 100)
-      fprintf(stderr, ".");
-    c = curl_easy_init ();
-    cbc.pos = 0;
-    buf[0] = '\0';
-    sprintf(url, "http://localhost:1082/hw%d";, i);
-    curl_easy_setopt (c, CURLOPT_URL, url);
-    curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
-    curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-    curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA);
-    curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA));
-    curl_easy_setopt (c, CURLOPT_POST, 1L);
-    curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
-    curl_easy_setopt (c, CURLOPT_TIMEOUT, 5L);
-    if (oneone)
-      curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
-    else
-      curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
-    curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L);
-    // NOTE: use of CONNECTTIMEOUT without also
-    //   setting NOSIGNAL results in really weird
-    //   crashes on my system!
-    curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
-    mret = curl_multi_add_handle (multi, c);
-    if (mret != CURLM_OK)
-      {
-       curl_multi_cleanup (multi);
-       curl_easy_cleanup (c);
-       MHD_stop_daemon (d);
-       return 1024;
-      }
-    start = time (NULL);
-    while ((time (NULL) - start < 5) && (multi != NULL))
-      {
-       max = 0;
-       FD_ZERO (&rs);
-       FD_ZERO (&ws);
-       FD_ZERO (&es);
-       while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform (multi, 
&running));
-       mret = curl_multi_fdset (multi, &rs, &ws, &es, &max);
-       if (mret != CURLM_OK)
-         {
-           curl_multi_remove_handle (multi, c);
-           curl_multi_cleanup (multi);
-           curl_easy_cleanup (c);
-           MHD_stop_daemon (d);
-           return 2048;
-         }
-       if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
-         {
-           curl_multi_remove_handle (multi, c);
-           curl_multi_cleanup (multi);
-           curl_easy_cleanup (c);
-           MHD_stop_daemon (d);
-           return 4096;
-         }
-       if (MHD_NO == MHD_get_timeout(d, &timeout))
-         timeout = 1000000; /* 1000s == INFTY */
-       if ( (CURLM_OK == curl_multi_timeout(multi, &ctimeout)) &&
-            (ctimeout < timeout) &&
-            (ctimeout >= 0) )
-         timeout = ctimeout;
-       tv.tv_sec = timeout / 1000;
-       tv.tv_usec = (timeout % 1000) * 1000;
-       select (max + 1, &rs, &ws, &es, &tv);
-       while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform (multi, 
&running));
-       if (running == 0)
-         {
-           msg = curl_multi_info_read (multi, &running);
-           if (msg == NULL)
-             break;
-           if (msg->msg == CURLMSG_DONE)
-             {
-               if (msg->data.result != CURLE_OK)
-                 printf ("%s failed at %s:%d: `%s'\n",
-                         "curl_multi_perform",
-                         __FILE__,
-                         __LINE__, curl_easy_strerror (msg->data.result));
-               curl_multi_remove_handle (multi, c);
-               curl_easy_cleanup (c);
-               c = NULL;
-             }
-         }
-       MHD_run (d);
-      }
-    if (c != NULL) {
-      curl_multi_remove_handle (multi, c);
-      curl_easy_cleanup (c);
+  for (i = 0; i < LOOPCOUNT; i++)
+    {
+      if (0 == i % 100)
+        fprintf (stderr, ".");
+      c = curl_easy_init ();
+      cbc.pos = 0;
+      buf[0] = '\0';
+      sprintf (url, "http://localhost:1082/hw%d";, i);
+      curl_easy_setopt (c, CURLOPT_URL, url);
+      curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
+      curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
+      curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA);
+      curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA));
+      curl_easy_setopt (c, CURLOPT_POST, 1L);
+      curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
+      curl_easy_setopt (c, CURLOPT_TIMEOUT, 5L);
+      if (oneone)
+        curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+      else
+        curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+      curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L);
+      // NOTE: use of CONNECTTIMEOUT without also
+      //   setting NOSIGNAL results in really weird
+      //   crashes on my system!
+      curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
+      mret = curl_multi_add_handle (multi, c);
+      if (mret != CURLM_OK)
+        {
+          curl_multi_cleanup (multi);
+          curl_easy_cleanup (c);
+          MHD_stop_daemon (d);
+          return 1024;
+        }
+      start = time (NULL);
+      while ((time (NULL) - start < 5) && (multi != NULL))
+        {
+          max = 0;
+          FD_ZERO (&rs);
+          FD_ZERO (&ws);
+          FD_ZERO (&es);
+          while (CURLM_CALL_MULTI_PERFORM ==
+                 curl_multi_perform (multi, &running));
+          mret = curl_multi_fdset (multi, &rs, &ws, &es, &max);
+          if (mret != CURLM_OK)
+            {
+              curl_multi_remove_handle (multi, c);
+              curl_multi_cleanup (multi);
+              curl_easy_cleanup (c);
+              MHD_stop_daemon (d);
+              return 2048;
+            }
+          if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
+            {
+              curl_multi_remove_handle (multi, c);
+              curl_multi_cleanup (multi);
+              curl_easy_cleanup (c);
+              MHD_stop_daemon (d);
+              return 4096;
+            }
+          if (MHD_NO == MHD_get_timeout (d, &timeout))
+            timeout = 1000000;  /* 1000s == INFTY */
+          if ((CURLM_OK == curl_multi_timeout (multi, &ctimeout)) &&
+              (ctimeout < timeout) && (ctimeout >= 0))
+            timeout = ctimeout;
+          tv.tv_sec = timeout / 1000;
+          tv.tv_usec = (timeout % 1000) * 1000;
+          select (max + 1, &rs, &ws, &es, &tv);
+          while (CURLM_CALL_MULTI_PERFORM ==
+                 curl_multi_perform (multi, &running));
+          if (running == 0)
+            {
+              msg = curl_multi_info_read (multi, &running);
+              if (msg == NULL)
+                break;
+              if (msg->msg == CURLMSG_DONE)
+                {
+                  if (msg->data.result != CURLE_OK)
+                    printf ("%s failed at %s:%d: `%s'\n",
+                            "curl_multi_perform",
+                            __FILE__,
+                            __LINE__, curl_easy_strerror (msg->data.result));
+                  curl_multi_remove_handle (multi, c);
+                  curl_easy_cleanup (c);
+                  c = NULL;
+                }
+            }
+          MHD_run (d);
+        }
+      if (c != NULL)
+        {
+          curl_multi_remove_handle (multi, c);
+          curl_easy_cleanup (c);
+        }
+      if ((buf[0] != 'O') || (buf[1] != 'K'))
+        {
+          curl_multi_cleanup (multi);
+          MHD_stop_daemon (d);
+          return 8192;
+        }
     }
-    if ( (buf[0] != 'O') ||
-        (buf[1] != 'K') ) {
-      curl_multi_cleanup (multi);  
-      MHD_stop_daemon (d);
-      return 8192;
-    }  
-  }
-  curl_multi_cleanup (multi);  
+  curl_multi_cleanup (multi);
   MHD_stop_daemon (d);
-  fprintf(stderr, "\n");
+  fprintf (stderr, "\n");
   return 0;
 }
 

Modified: libmicrohttpd/src/daemon/daemontest_postform.c
===================================================================
--- libmicrohttpd/src/daemon/daemontest_postform.c      2007-12-16 10:27:29 UTC 
(rev 5926)
+++ libmicrohttpd/src/daemon/daemontest_postform.c      2007-12-16 10:28:22 UTC 
(rev 5927)
@@ -106,7 +106,7 @@
       eok = 0;
       pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok);
       if (pp == NULL)
-       abort();
+        abort ();
       *unused = pp;
     }
   MHD_post_process (pp, upload_data, *upload_data_size);
@@ -125,15 +125,16 @@
   return MHD_YES;
 }
 
-static struct curl_httppost * 
-make_form() {
-  struct curl_httppost* post = NULL;
-  struct curl_httppost* last = NULL;
- 
-  curl_formadd(&post, &last, CURLFORM_COPYNAME, "name",
-               CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END);
-  curl_formadd(&post, &last, CURLFORM_COPYNAME, "project",
-               CURLFORM_COPYCONTENTS, "curl", CURLFORM_END);
+static struct curl_httppost *
+make_form ()
+{
+  struct curl_httppost *post = NULL;
+  struct curl_httppost *last = NULL;
+
+  curl_formadd (&post, &last, CURLFORM_COPYNAME, "name",
+                CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END);
+  curl_formadd (&post, &last, CURLFORM_COPYNAME, "project",
+                CURLFORM_COPYCONTENTS, "curl", CURLFORM_END);
   return post;
 }
 
@@ -146,7 +147,7 @@
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  struct curl_httppost * pd;
+  struct curl_httppost *pd;
 
   cbc.buf = buf;
   cbc.size = 2048;
@@ -159,8 +160,8 @@
   curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world";);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-  pd = make_form();
-  curl_easy_setopt(c, CURLOPT_HTTPPOST, pd);
+  pd = make_form ();
+  curl_easy_setopt (c, CURLOPT_HTTPPOST, pd);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
   if (oneone)
@@ -178,12 +179,12 @@
                "curl_easy_perform failed: `%s'\n",
                curl_easy_strerror (errornum));
       curl_easy_cleanup (c);
-      curl_formfree(pd);
+      curl_formfree (pd);
       MHD_stop_daemon (d);
       return 2;
     }
   curl_easy_cleanup (c);
-  curl_formfree(pd);
+  curl_formfree (pd);
   MHD_stop_daemon (d);
   if (cbc.pos != strlen ("/hello_world"))
     return 4;
@@ -200,7 +201,7 @@
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  struct curl_httppost * pd;
+  struct curl_httppost *pd;
 
   cbc.buf = buf;
   cbc.size = 2048;
@@ -213,8 +214,8 @@
   curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world";);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-  pd = make_form();
-  curl_easy_setopt(c, CURLOPT_HTTPPOST, pd);
+  pd = make_form ();
+  curl_easy_setopt (c, CURLOPT_HTTPPOST, pd);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
   if (oneone)
@@ -232,12 +233,12 @@
                "curl_easy_perform failed: `%s'\n",
                curl_easy_strerror (errornum));
       curl_easy_cleanup (c);
-      curl_formfree(pd);
+      curl_formfree (pd);
       MHD_stop_daemon (d);
       return 32;
     }
   curl_easy_cleanup (c);
-  curl_formfree(pd);
+  curl_formfree (pd);
   MHD_stop_daemon (d);
   if (cbc.pos != strlen ("/hello_world"))
     return 64;
@@ -264,7 +265,7 @@
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  struct curl_httppost * pd;
+  struct curl_httppost *pd;
 
   multi = NULL;
   cbc.buf = buf;
@@ -278,8 +279,8 @@
   curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world";);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-  pd = make_form();
-  curl_easy_setopt(c, CURLOPT_HTTPPOST, pd);
+  pd = make_form ();
+  curl_easy_setopt (c, CURLOPT_HTTPPOST, pd);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 5L);
   if (oneone)
@@ -297,7 +298,7 @@
   if (multi == NULL)
     {
       curl_easy_cleanup (c);
-      curl_formfree(pd);
+      curl_formfree (pd);
       MHD_stop_daemon (d);
       return 512;
     }
@@ -305,7 +306,7 @@
   if (mret != CURLM_OK)
     {
       curl_multi_cleanup (multi);
-      curl_formfree(pd);
+      curl_formfree (pd);
       curl_easy_cleanup (c);
       MHD_stop_daemon (d);
       return 1024;
@@ -325,7 +326,7 @@
           curl_multi_cleanup (multi);
           curl_easy_cleanup (c);
           MHD_stop_daemon (d);
-         curl_formfree(pd);
+          curl_formfree (pd);
           return 2048;
         }
       if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
@@ -333,7 +334,7 @@
           curl_multi_remove_handle (multi, c);
           curl_multi_cleanup (multi);
           curl_easy_cleanup (c);
-         curl_formfree(pd);
+          curl_formfree (pd);
           MHD_stop_daemon (d);
           return 4096;
         }
@@ -368,7 +369,7 @@
       curl_easy_cleanup (c);
       curl_multi_cleanup (multi);
     }
-  curl_formfree(pd);      
+  curl_formfree (pd);
   MHD_stop_daemon (d);
   if (cbc.pos != strlen ("/hello_world"))
     return 8192;
@@ -388,10 +389,11 @@
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
   errorCount += testInternalPost ();
-  if (0) {
-    errorCount += testMultithreadedPost ();
-    errorCount += testExternalPost ();
-  }
+  if (0)
+    {
+      errorCount += testMultithreadedPost ();
+      errorCount += testExternalPost ();
+    }
   if (errorCount != 0)
     fprintf (stderr, "Error (code: %u)\n", errorCount);
   curl_global_cleanup ();

Modified: libmicrohttpd/src/daemon/daemontest_put_chunked.c
===================================================================
--- libmicrohttpd/src/daemon/daemontest_put_chunked.c   2007-12-16 10:27:29 UTC 
(rev 5926)
+++ libmicrohttpd/src/daemon/daemontest_put_chunked.c   2007-12-16 10:28:22 UTC 
(rev 5927)
@@ -53,7 +53,7 @@
   if (wrt > 8 - (*pos))
     wrt = 8 - (*pos);
   if (wrt > 4)
-    wrt = 4; /* only send half at first => force multiple chunks! */
+    wrt = 4;                    /* only send half at first => force multiple 
chunks! */
   memcpy (stream, &("Hello123"[*pos]), wrt);
   (*pos) += wrt;
   return wrt;
@@ -91,19 +91,17 @@
     {
       have = *upload_data_size;
       if (have + *done > 8)
-       {
+        {
           printf ("Invalid upload data `%8s'!\n", upload_data);
           return MHD_NO;
-       }
-      if (0 == memcmp(upload_data,
-                     &"Hello123"[*done],
-                     have))
-       {
-         *done += have;
-         *upload_data_size = 0;
-       }
+        }
+      if (0 == memcmp (upload_data, &"Hello123"[*done], have))
+        {
+          *done += have;
+          *upload_data_size = 0;
+        }
       else
-       {
+        {
           printf ("Invalid upload data `%8s'!\n", upload_data);
           return MHD_NO;
         }
@@ -144,9 +142,9 @@
   curl_easy_setopt (c, CURLOPT_READDATA, &pos);
   curl_easy_setopt (c, CURLOPT_UPLOAD, 1L);
   /*
-    // by not giving the file size, we force chunking!
-    curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L);
-  */
+     // by not giving the file size, we force chunking!
+     curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L);
+   */
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 15L);
   curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
@@ -200,9 +198,9 @@
   curl_easy_setopt (c, CURLOPT_READDATA, &pos);
   curl_easy_setopt (c, CURLOPT_UPLOAD, 1L);
   /*
-    // by not giving the file size, we force chunking!
-    curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L);
-  */
+     // by not giving the file size, we force chunking!
+     curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L);
+   */
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 15L);
   curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
@@ -268,9 +266,9 @@
   curl_easy_setopt (c, CURLOPT_READDATA, &pos);
   curl_easy_setopt (c, CURLOPT_UPLOAD, 1L);
   /*
-    // by not giving the file size, we force chunking!
-    curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L);
-  */
+     // by not giving the file size, we force chunking!
+     curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L);
+   */
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 15L);
   curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

Modified: libmicrohttpd/src/daemon/postprocessor.c
===================================================================
--- libmicrohttpd/src/daemon/postprocessor.c    2007-12-16 10:27:29 UTC (rev 
5926)
+++ libmicrohttpd/src/daemon/postprocessor.c    2007-12-16 10:28:22 UTC (rev 
5927)
@@ -164,7 +164,7 @@
   if ((0 != strcasecmp (MHD_HTTP_POST_ENCODING_FORM_URLENCODED,
                         encoding)) &&
       (0 != strncasecmp (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, encoding,
-                        strlen(MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))))
+                         strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))))
     return NULL;
   ret = malloc (sizeof (struct MHD_PostProcessor) + buffer_size + 1);
   if (ret == NULL)
@@ -430,7 +430,7 @@
               pp->state = PP_Headers;
               break;
             }
-          /* fall through! */    
+          /* fall through! */
         case PP_Headers:
           newline = 0;
           while ((newline + ioff < pp->buffer_pos) &&
@@ -476,8 +476,8 @@
           try_match_header ("Content-Type: ", &buf[ioff], &pp->content_type);
           try_match_header ("Content-Transfer-Encoding: ",
                             &buf[ioff], &pp->transfer_encoding);
-         ioff += newline + 1;
-         pp->state = PP_ExpectNewLineNOPT;
+          ioff += newline + 1;
+          pp->state = PP_ExpectNewLineNOPT;
           break;
         case PP_SkipRN:
           if (buf[ioff] == '\r')

Modified: libmicrohttpd/src/daemon/reason_phrase.c
===================================================================
--- libmicrohttpd/src/daemon/reason_phrase.c    2007-12-16 10:27:29 UTC (rev 
5926)
+++ libmicrohttpd/src/daemon/reason_phrase.c    2007-12-16 10:28:22 UTC (rev 
5927)
@@ -28,15 +28,15 @@
 
 #include "reason_phrase.h"
 
-static const char * invalid_hundred[] = { };
+static const char *invalid_hundred[] = { };
 
-static const char * one_hundred[] = {
+static const char *one_hundred[] = {
   "Continue",
   "Switching Protocols",
   "Processing"
 };
 
-static const char* two_hundred[] = {
+static const char *two_hundred[] = {
   "OK",
   "Created",
   "Accepted",
@@ -46,7 +46,7 @@
   "Partial Content"
 };
 
-static const char* three_hundred[] = {
+static const char *three_hundred[] = {
   "Multiple Choices",
   "Moved Permanently",
   "Moved Temporarily",
@@ -55,7 +55,7 @@
   "Use Proxy"
 };
 
-static const char* four_hundred[] = {
+static const char *four_hundred[] = {
   "Bad Request",
   "Unauthorized",
   "Payment Required",
@@ -74,7 +74,7 @@
   "Unsupported Media Type"
 };
 
-static const char* five_hundred[] = {
+static const char *five_hundred[] = {
   "Internal Server Error",
   "Bad Gateway",
   "Service Unavailable",
@@ -83,27 +83,27 @@
 };
 
 
-struct MHD_Reason_Block {
+struct MHD_Reason_Block
+{
   unsigned int max;
-  const char ** data;
+  const char **data;
 };
 
 #define BLOCK(m) { (sizeof(m) / sizeof(char*)), m }
 
 static const struct MHD_Reason_Block reasons[] = {
-  BLOCK(invalid_hundred),
-  BLOCK(one_hundred),
-  BLOCK(two_hundred),
-  BLOCK(three_hundred),
-  BLOCK(four_hundred),
-  BLOCK(five_hundred),
+  BLOCK (invalid_hundred),
+  BLOCK (one_hundred),
+  BLOCK (two_hundred),
+  BLOCK (three_hundred),
+  BLOCK (four_hundred),
+  BLOCK (five_hundred),
 };
 
-const char * 
-MHD_get_reason_phrase_for(unsigned int code)
+const char *
+MHD_get_reason_phrase_for (unsigned int code)
 {
-  if ( (code >= 100 && code < 600) &&
-       (reasons[code / 100].max > code % 100) )
+  if ((code >= 100 && code < 600) && (reasons[code / 100].max > code % 100))
     return reasons[code / 100].data[code % 100];
   return "Unknown";
 }

Modified: libmicrohttpd/src/daemon/reason_phrase.h
===================================================================
--- libmicrohttpd/src/daemon/reason_phrase.h    2007-12-16 10:27:29 UTC (rev 
5926)
+++ libmicrohttpd/src/daemon/reason_phrase.h    2007-12-16 10:28:22 UTC (rev 
5927)
@@ -32,7 +32,6 @@
  * If we don't have a string for a status code, we give the first
  * message in that status code class.
  */
-const char* 
-MHD_get_reason_phrase_for(unsigned int code);
+const char *MHD_get_reason_phrase_for (unsigned int code);
 
 #endif





reply via email to

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