summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-06-13 07:03:22 +0000
committerChristian Grothoff <christian@grothoff.org>2007-06-13 07:03:22 +0000
commite0f5ecea32dca11c979687fac128c7f2badfb198 (patch)
treea16c4c787dfcb714c3df24064397198c369b04ca
parentd05460508fadfe8bc7370c3e2d5b23facf686e0e (diff)
cleanup
-rw-r--r--src/daemon/Makefile.am2
-rw-r--r--src/daemon/daemon.c37
-rw-r--r--src/daemon/internal.c47
-rw-r--r--src/daemon/internal.h10
-rw-r--r--src/daemon/response.c4
-rw-r--r--src/daemon/session.c4
6 files changed, 69 insertions, 35 deletions
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 892d0506..f41d39ee 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -11,7 +11,7 @@ libmicrohttpd_la_LDFLAGS = \
# -lm
libmicrohttpd_la_SOURCES = \
daemon.c \
- internal.h \
+ internal.c internal.h \
response.c response.h \
session.c session.h
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 4b743aad..ac0a7398 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -26,33 +26,14 @@
* @version 0.1.0
*/
-#include "microhttpd.h"
#include "internal.h"
#include "response.h"
#include "session.h"
-#include "config.h"
#define MHD_MAX_CONNECTIONS FD_SETSIZE -4
/**
- * fprintf-like helper function for logging debug
- * messages.
- */
-static void DLOG(const struct MHD_Daemon * daemon,
- const char * format,
- ...) {
- va_list va;
-
- if ( (daemon->options & MHD_USE_DEBUG) == 0)
- return;
- va_start(va, format);
- vfprintf(stderr, format, va);
- va_end(va);
-}
-
-
-/**
* Register an access handler for all URIs beginning with uri_prefix.
*
* @param uri_prefix
@@ -234,9 +215,9 @@ MHD_accept_connection(struct MHD_Daemon * daemon) {
&addr,
&addrlen))) ||
(addrlen <= 0) ) {
- DLOG(daemon,
- "Error accepting connection: %s\n",
- strerror(errno));
+ MHD_DLOG(daemon,
+ "Error accepting connection: %s\n",
+ strerror(errno));
return MHD_NO;
}
if (MHD_NO == daemon->apc(daemon->apc_cls,
@@ -261,9 +242,9 @@ MHD_accept_connection(struct MHD_Daemon * daemon) {
NULL,
&MHD_handle_connection,
session)) ) {
- DLOG(daemon,
- "Failed to create a thread: %s\n",
- strerror(errno));
+ MHD_DLOG(daemon,
+ "Failed to create a thread: %s\n",
+ strerror(errno));
free(session->addr);
close(s);
free(session);
@@ -354,9 +335,9 @@ MHD_select(struct MHD_Daemon * daemon) {
if (num_ready < 0) {
if (errno == EINTR)
return MHD_YES;
- DLOG(daemon,
- "Select failed: %s\n",
- strerror(errno));
+ MHD_DLOG(daemon,
+ "Select failed: %s\n",
+ strerror(errno));
return MHD_NO;
}
if (FD_ISSET(daemon->socket_fd,
diff --git a/src/daemon/internal.c b/src/daemon/internal.c
new file mode 100644
index 00000000..ce06e2c6
--- /dev/null
+++ b/src/daemon/internal.c
@@ -0,0 +1,47 @@
+/*
+ This file is part of libmicrohttpd
+ (C) 2007 Daniel Pittman
+
+ libmicrohttpd is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ libmicrohttpd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libmicrohttpd; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file internal.h
+ * @brief internal shared structures
+ * @author Daniel Pittman
+ * @author Christian Grothoff
+ * @version 0.1.0
+ */
+
+#include "internal.h"
+
+
+/**
+ * fprintf-like helper function for logging debug
+ * messages.
+ */
+void MHD_DLOG(const struct MHD_Daemon * daemon,
+ const char * format,
+ ...) {
+ va_list va;
+
+ if ( (daemon->options & MHD_USE_DEBUG) == 0)
+ return;
+ va_start(va, format);
+ vfprintf(stderr, format, va);
+ va_end(va);
+}
+
diff --git a/src/daemon/internal.h b/src/daemon/internal.h
index 4beff728..9a3ec5a2 100644
--- a/src/daemon/internal.h
+++ b/src/daemon/internal.h
@@ -48,6 +48,16 @@
#define MAX(a,b) ((a)<(b)) ? (b) : (a)
+
+/**
+ * fprintf-like helper function for logging debug
+ * messages.
+ */
+void MHD_DLOG(const struct MHD_Daemon * daemon,
+ const char * format,
+ ...);
+
+
/**
* Header or cookie in HTTP request or response.
*/
diff --git a/src/daemon/response.c b/src/daemon/response.c
index 1584dbfd..7fae9f90 100644
--- a/src/daemon/response.c
+++ b/src/daemon/response.c
@@ -26,10 +26,8 @@
* @version 0.1.0
*/
-#include "microhttpd.h"
-#include "response.h"
#include "internal.h"
-#include "config.h"
+#include "response.h"
/**
* Add a header line to the response.
diff --git a/src/daemon/session.c b/src/daemon/session.c
index a719c51a..9e8afa83 100644
--- a/src/daemon/session.c
+++ b/src/daemon/session.c
@@ -26,11 +26,9 @@
* @version 0.1.0
*/
-#include "microhttpd.h"
+#include "internal.h"
#include "session.h"
#include "response.h"
-#include "internal.h"
-#include "config.h"
/**