summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.h.in7
-rw-r--r--configure.ac302
-rwxr-xr-xcsoap-config.in6
-rw-r--r--examples/csoap/Makefile.am2
-rwxr-xr-xexamples/csoap/echoattachments-client.c6
-rwxr-xr-xexamples/csoap/echoattachments-server.c6
-rw-r--r--examples/csoap/simpleclient.c4
-rw-r--r--examples/csoap/simpleserver.c5
-rw-r--r--examples/csoap/soapclient.c2
-rw-r--r--examples/nanohttp/Makefile.am2
-rw-r--r--examples/nanohttp/http_client.c5
-rw-r--r--examples/nanohttp/http_server.c5
-rw-r--r--libcsoap/soap-client.c3
-rwxr-xr-xlibcsoap/soap-ctx.c4
-rw-r--r--libcsoap/soap-env.c10
-rw-r--r--libcsoap/soap-fault.c4
-rw-r--r--libcsoap/soap-router.c4
-rw-r--r--libcsoap/soap-server.c3
-rw-r--r--libcsoap/soap-service.c3
-rw-r--r--libcsoap/soap-xml.c4
-rw-r--r--nanohttp/Makefile.am4
-rw-r--r--nanohttp/nanohttp-client.c5
-rw-r--r--nanohttp/nanohttp-common.c158
-rw-r--r--nanohttp/nanohttp-common.h140
-rwxr-xr-xnanohttp/nanohttp-mime.c3
-rwxr-xr-xnanohttp/nanohttp-request.c19
-rwxr-xr-xnanohttp/nanohttp-response.c3
-rw-r--r--nanohttp/nanohttp-server.c3
-rw-r--r--nanohttp/nanohttp-socket.c3
-rw-r--r--nanohttp/nanohttp-ssl.c3
-rwxr-xr-xnanohttp/nanohttp-stream.c3
31 files changed, 417 insertions, 314 deletions
diff --git a/config.h.in b/config.h.in
index c6b7662..4d19f60 100644
--- a/config.h.in
+++ b/config.h.in
@@ -64,6 +64,9 @@
/* Define to 1 if you have the <openssl/rand.h> header file. */
#undef HAVE_OPENSSL_RAND_H
+/* Define if you have POSIX threads libraries and header files. */
+#undef HAVE_PTHREAD
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
@@ -163,6 +166,10 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+#undef PTHREAD_CREATE_JOINABLE
+
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
diff --git a/configure.ac b/configure.ac
index 850942a..8f60075 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,40 +1,51 @@
-dnl
-dnl release information
-dnl
-AC_INIT(csoap, 1.1.0)
-dnl
-dnl version information
-dnl
-csoap_version=1:1:0
-nanohttp_version=1:1:0
+AC_INIT(csoap, 1.1.0)
AC_CONFIG_SRCDIR([nanohttp/nanohttp-server.c])
AC_CONFIG_SRCDIR([libcsoap/soap-server.c])
AM_INIT_AUTOMAKE
-csoap_release=`echo $VERSION | awk -F. '{print $1"."$2}'`
-AC_SUBST(csoap_release)
-AC_SUBST(csoap_version)
-csoap_version_dotted=`echo $csoap_version | sed 's/:/./g'`
-AC_SUBST(csoap_version_dotted)
-
-nanohttp_release=$csoap_release
-AC_SUBST(nanohttp_release)
-AC_SUBST(nanohttp_version)
-
AM_CONFIG_HEADER(config.h)
+dnl
+dnl checks for programs
+dnl
AC_LANG_C
AC_PROG_CC
+AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LIBTOOL
+dnl
+dnl release and version information
+dnl
+csoap_major=`echo $VERSION | $AWK -F. '{print $1}'`
+csoap_minor=`echo $VERSION | $AWK -F. '{print $2}'`
+csoap_patch=`echo $VERSION | $AWK -F. '{print $3}'`
+AC_SUBST(csoap_major)
+AC_SUBST(csoap_minor)
+AC_SUBST(csoap_patch)
+
+csoap_release="$csoap_major.$csoap_minor"
+csoap_version=`expr $csoap_major + $csoap_minor`":$csoap_patch:$csoap_minor"
+AC_SUBST(csoap_release)
+AC_SUBST(csoap_version)
+
+nanohttp_release=$csoap_release
+nanohttp_version=$csoap_version
+AC_SUBST(nanohttp_release)
+AC_SUBST(nanohttp_version)
+
+dnl
+dnl checks for headers
+dnl
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h malloc.h netdb.h netinet/in.h stdint.h stdlib.h signal.h pthread.h string.h sys/socket.h sys/time.h unistd.h io.h stdio.h stdarg.h errno.h ctype.h openssl/rand.h openssl/err.h])
-# Checks for typedefs, structures, and compiler characteristics.
+dnl
+dnl Checks for typedefs, structures, and compiler characteristics.
+dnl
AC_C_CONST
AC_STRUCT_TM
@@ -43,15 +54,259 @@ AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
+dnl
+dnl check for functions
+dnl
AC_FUNC_MALLOC
AC_FUNC_VPRINTF
AC_FUNC_STRFTIME
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([gethostbyname inet_ntoa memmove memset mkdir select socket strchr strdup strncasecmp strpbrk strspn strstr strtol])
-if test x_$build_os = x_solaris2.8; then
- CFLAGS="$CFLAGS -D_REENTRANT"
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl @summary figure out how to build C programs using POSIX threads
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl LIBS="$PTHREAD_LIBS $LIBS"
+dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2006-05-29
+dnl @license GPLWithACException
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test x"$acx_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+ ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+ if test x"$acx_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [acx_pthread_ok=yes])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test "x$acx_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+ [attr_name=$attr; break])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host_cpu}-${host_os}" in
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+ :
+else
+ acx_pthread_ok=no
+ $2
fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
+
+ACX_PTHREAD(LIBS="$PTHREAD_LIBS $LIBS"; CFLAGS="$PTHREAD_CFLAGS $CFLAGS",)
AC_CHECK_FUNCS([localtime_r strtok_r])
@@ -118,3 +373,6 @@ examples/csoap/Makefile
libcsoap.pc
csoap-config)
+echo "Configured cSOAP $csoap_major.$csoap_minor.$csoap_patch for installation in $prefix";
+
+
diff --git a/csoap-config.in b/csoap-config.in
index 98a73cb..6d4dcc3 100755
--- a/csoap-config.in
+++ b/csoap-config.in
@@ -59,7 +59,7 @@ while test $# -gt 0; do
;;
--version)
- echo @csoap_version_dotted@
+ echo @csoap_major@.@csoap_minor@.@csoap_patch@
exit 0
;;
@@ -68,11 +68,11 @@ while test $# -gt 0; do
;;
--cflags)
- echo @XML_CPPFLAGS@ -I${includedir}/libcsoap-$relcsoap -I${includedir}/nanohttp-$relnanohttp
+ echo -I${includedir}/libcsoap-$relcsoap -I${includedir}/nanohttp-$relnanohttp @XML_CPPFLAGS@ @PTHREAD_CFLAGS@
;;
--libs)
- echo -L${libdir} -lcsoap -lnanohttp @XML_LIBS@
+ echo -L${libdir} -lcsoap -lnanohttp @XML_LIBS@ @PTHREAD_LIBS@
;;
*)
usage
diff --git a/examples/csoap/Makefile.am b/examples/csoap/Makefile.am
index f44f62c..556dd95 100644
--- a/examples/csoap/Makefile.am
+++ b/examples/csoap/Makefile.am
@@ -1,4 +1,4 @@
-LDADD=../../nanohttp/libnanohttp.la ../../libcsoap/libcsoap.la -lpthread
+LDADD=../../nanohttp/libnanohttp.la ../../libcsoap/libcsoap.la
INCLUDES=-I${top_srcdir}
noinst_PROGRAMS=simpleclient simpleserver echoattachments-client echoattachments-server
diff --git a/examples/csoap/echoattachments-client.c b/examples/csoap/echoattachments-client.c
index b3dd3f8..6f07253 100755
--- a/examples/csoap/echoattachments-client.c
+++ b/examples/csoap/echoattachments-client.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: echoattachments-client.c,v 1.10 2006/01/10 11:29:04 snowdrop Exp $
+ * $Id: echoattachments-client.c,v 1.11 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -21,9 +21,9 @@
* Email: ferhatayaz@yahoo.com
******************************************************************/
-#include <libcsoap/soap-client.h>
-
+#include <nanohttp/nanohttp-logging.h>
+#include <libcsoap/soap-client.h>
static const char *urn = "urn:examples";
diff --git a/examples/csoap/echoattachments-server.c b/examples/csoap/echoattachments-server.c
index 4b37aa8..0beb56f 100755
--- a/examples/csoap/echoattachments-server.c
+++ b/examples/csoap/echoattachments-server.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: echoattachments-server.c,v 1.7 2006/01/10 11:29:04 snowdrop Exp $
+ * $Id: echoattachments-server.c,v 1.8 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -21,6 +21,8 @@
* Email: ferhatayaz@yahoo.com
******************************************************************/
+#include <nanohttp/nanohttp-logging.h>
+
#include <libcsoap/soap-server.h>
@@ -64,7 +66,7 @@ main(int argc, char *argv[])
herror_t err;
SoapRouter *router;
- log_set_level(HLOG_VERBOSE);
+ hlog_set_level(HLOG_VERBOSE);
err = soap_server_init_args(argc, argv);
if (err != H_OK)
diff --git a/examples/csoap/simpleclient.c b/examples/csoap/simpleclient.c
index 6ae206b..6468113 100644
--- a/examples/csoap/simpleclient.c
+++ b/examples/csoap/simpleclient.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: simpleclient.c,v 1.11 2006/01/10 11:29:04 snowdrop Exp $
+ * $Id: simpleclient.c,v 1.12 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -21,6 +21,8 @@
* Email: ferhatayaz@yahoo.com
******************************************************************/
+#include <nanohttp/nanohttp-logging.h>
+
#include <libcsoap/soap-client.h>
diff --git a/examples/csoap/simpleserver.c b/examples/csoap/simpleserver.c
index cde4e79..6b076f6 100644
--- a/examples/csoap/simpleserver.c
+++ b/examples/csoap/simpleserver.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: simpleserver.c,v 1.18 2006/02/27 22:26:01 snowdrop Exp $
+ * $Id: simpleserver.c,v 1.19 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -21,6 +21,7 @@
* Email: ferhatayaz@yahoo.com
******************************************************************/
+#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-server.h>
@@ -66,7 +67,7 @@ main(int argc, char *argv[])
herror_t err;
SoapRouter *router;
- log_set_level(HLOG_INFO);
+ hlog_set_level(HLOG_INFO);
err = soap_server_init_args(argc, argv);
if (err != H_OK)
diff --git a/examples/csoap/soapclient.c b/examples/csoap/soapclient.c
index f1b054d..c7ece72 100644
--- a/examples/csoap/soapclient.c
+++ b/examples/csoap/soapclient.c
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+
+#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-client.h>
#define MAX_LINE_LENGTH 65535
diff --git a/examples/nanohttp/Makefile.am b/examples/nanohttp/Makefile.am
index ae5e6a7..d0a6be7 100644
--- a/examples/nanohttp/Makefile.am
+++ b/examples/nanohttp/Makefile.am
@@ -1,4 +1,4 @@
-LDADD=../../nanohttp/libnanohttp.la -lpthread
+LDADD=../../nanohttp/libnanohttp.la
INCLUDES=-I${top_srcdir}
noinst_PROGRAMS=http_server http_client
diff --git a/examples/nanohttp/http_client.c b/examples/nanohttp/http_client.c
index 8d827ba..c454fd7 100644
--- a/examples/nanohttp/http_client.c
+++ b/examples/nanohttp/http_client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: http_client.c,v 1.1 2006/03/06 13:30:30 m0gg Exp $
+* $Id: http_client.c,v 1.2 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C (example)
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
+#include <nanohttp/nanohttp-logging.h>
#include <nanohttp/nanohttp-client.h>
#define MAX_BUFFER_SIZE 1024
@@ -103,7 +104,7 @@ int main(int argc, char **argv) {
}
/* Set log level to see more information written by the library */
- log_set_level(HLOG_INFO);
+ hlog_set_level(HLOG_INFO);
/* Initialize httpc module */
if (httpc_init(argc, argv)) {
diff --git a/examples/nanohttp/http_server.c b/examples/nanohttp/http_server.c
index 33e60ce..348a1d7 100644
--- a/examples/nanohttp/http_server.c
+++ b/examples/nanohttp/http_server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: http_server.c,v 1.3 2006/04/21 08:40:37 m0gg Exp $
+* $Id: http_server.c,v 1.4 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C (example)
* Copyright (C) 2003 Ferhat Ayaz
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
+#include <nanohttp/nanohttp-logging.h>
#include <nanohttp/nanohttp-server.h>
static int simple_authenticator(hrequest_t *req, const char *user, const char *password)
@@ -141,7 +142,7 @@ static void root_service(httpd_conn_t *conn, hrequest_t *req)
int main(int argc, char *argv[])
{
- log_set_level(HLOG_INFO);
+ hlog_set_level(HLOG_INFO);
if (httpd_init(argc, argv)) {
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c
index cdf4d55..67b7681 100644
--- a/libcsoap/soap-client.c
+++ b/libcsoap/soap-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-client.c,v 1.26 2006/03/07 16:21:47 m0gg Exp $
+* $Id: soap-client.c,v 1.27 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -33,6 +33,7 @@
#include <stdio.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
#include <nanohttp/nanohttp-client.h>
#include "soap-client.h"
diff --git a/libcsoap/soap-ctx.c b/libcsoap/soap-ctx.c
index a06b897..393dceb 100755
--- a/libcsoap/soap-ctx.c
+++ b/libcsoap/soap-ctx.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.c,v 1.9 2006/02/27 22:26:02 snowdrop Exp $
+ * $Id: soap-ctx.c,v 1.10 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -37,6 +37,8 @@
#include <errno.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
+
#include "soap-ctx.h"
SoapCtx *
diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c
index b16a1f3..0536065 100644
--- a/libcsoap/soap-env.c
+++ b/libcsoap/soap-env.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-env.c,v 1.19 2006/03/15 15:11:47 m0gg Exp $
+* $Id: soap-env.c,v 1.20 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -41,9 +41,6 @@
#include <errno.h>
#endif
-#include "soap-xml.h"
-#include "soap-env.h"
-
#ifdef WIN32
#define USE_XMLSTRING
#endif
@@ -52,6 +49,11 @@
#include <libxml/xmlstring.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
+
+#include "soap-xml.h"
+#include "soap-env.h"
+
/*
Parameters:
1- soap_env_ns
diff --git a/libcsoap/soap-fault.c b/libcsoap/soap-fault.c
index 9de1e2b..c4768e6 100644
--- a/libcsoap/soap-fault.c
+++ b/libcsoap/soap-fault.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-fault.c,v 1.10 2006/03/06 13:37:38 m0gg Exp $
+* $Id: soap-fault.c,v 1.11 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -29,6 +29,8 @@
#include <string.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
+
#include "soap-fault.h"
#include "soap-xml.h"
diff --git a/libcsoap/soap-router.c b/libcsoap/soap-router.c
index ad8edd3..cd0cca4 100644
--- a/libcsoap/soap-router.c
+++ b/libcsoap/soap-router.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-router.c,v 1.9 2006/05/15 06:41:33 m0gg Exp $
+* $Id: soap-router.c,v 1.10 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -33,6 +33,8 @@
#include <errno.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
+
#include "soap-router.h"
SoapRouter *
diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c
index 9c77070..5448de7 100644
--- a/libcsoap/soap-server.c
+++ b/libcsoap/soap-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-server.c,v 1.25 2006/05/24 15:18:52 mrcsys Exp $
+* $Id: soap-server.c,v 1.26 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -37,6 +37,7 @@
#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
#endif
+#include <nanohttp/nanohttp-logging.h>
#include <nanohttp/nanohttp-server.h>
#include "soap-admin.h"
diff --git a/libcsoap/soap-service.c b/libcsoap/soap-service.c
index fd72ce6..e2a486a 100644
--- a/libcsoap/soap-service.c
+++ b/libcsoap/soap-service.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-service.c,v 1.7 2006/02/27 22:26:02 snowdrop Exp $
+* $Id: soap-service.c,v 1.8 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -29,6 +29,7 @@
#include <string.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
#include <nanohttp/nanohttp-common.h>
#include "soap-service.h"
diff --git a/libcsoap/soap-xml.c b/libcsoap/soap-xml.c
index 37487d3..801bdd1 100644
--- a/libcsoap/soap-xml.c
+++ b/libcsoap/soap-xml.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-xml.c,v 1.10 2006/02/27 22:26:02 snowdrop Exp $
+* $Id: soap-xml.c,v 1.11 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,6 +25,8 @@
#include <config.h>
#endif
+#include <nanohttp/nanohttp-logging.h>
+
#include "soap-xml.h"
xmlNodePtr
diff --git a/nanohttp/Makefile.am b/nanohttp/Makefile.am
index fc05a84..b585026 100644
--- a/nanohttp/Makefile.am
+++ b/nanohttp/Makefile.am
@@ -5,12 +5,12 @@ libnanohttp_ladir=$(includedir)/nanohttp-@nanohttp_release@/nanohttp
libnanohttp_la_SOURCES=nanohttp-common.c nanohttp-socket.c nanohttp-client.c \
nanohttp-server.c nanohttp-stream.c nanohttp-mime.c \
nanohttp-request.c nanohttp-response.c \
- nanohttp-base64.c nanohttp-ssl.c
+ nanohttp-base64.c nanohttp-ssl.c nanohttp-logging.c
libnanohttp_la_HEADERS=nanohttp-common.h nanohttp-socket.h nanohttp-client.h \
nanohttp-server.h nanohttp-stream.h nanohttp-mime.h \
nanohttp-request.h nanohttp-response.h \
- nanohttp-base64.h nanohttp-ssl.h
+ nanohttp-base64.h nanohttp-ssl.h nanohttp-logging.h
libnanohttp_la_LDFLAGS= -version-info @nanohttp_version@ -release @nanohttp_release@
libnanohttp_la_CFLAGS=-I${top_srcdir}
diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c
index 32df75f..7b9376f 100644
--- a/nanohttp/nanohttp-client.c
+++ b/nanohttp/nanohttp-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-client.c,v 1.40 2006/03/06 13:37:38 m0gg Exp $
+* $Id: nanohttp-client.c,v 1.41 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -52,6 +52,7 @@
#include "nanohttp-client.h"
#include "nanohttp-socket.h"
#include "nanohttp-base64.h"
+#include "nanohttp-logging.h"
/*--------------------------------------------------
FUNCTION: httpc_init
@@ -94,7 +95,7 @@ httpc_new(void)
if ((status = hsocket_init(&res->sock)) != H_OK)
{
- log_warn("hsocket_init failed (%s)", herror_message(status));
+ log_warn2("hsocket_init failed (%s)", herror_message(status));
return NULL;
}
diff --git a/nanohttp/nanohttp-common.c b/nanohttp/nanohttp-common.c
index b6f0e40..0784684 100644
--- a/nanohttp/nanohttp-common.c
+++ b/nanohttp/nanohttp-common.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-common.c,v 1.29 2006/03/06 13:37:38 m0gg Exp $
+* $Id: nanohttp-common.c,v 1.30 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -54,6 +54,7 @@
#endif
#include "nanohttp-common.h"
+#include "nanohttp-logging.h"
static int
strcmpigcase(const char *s1, const char *s2)
@@ -78,24 +79,6 @@ strcmpigcase(const char *s1, const char *s2)
return 1;
}
-#ifdef WIN32
-#ifndef __MINGW32__
-
-/* not thread safe!*/
-char *
-VisualC_funcname(const char *file, int line)
-{
- static char buffer[256];
- int i = strlen(file) - 1;
- while (i > 0 && file[i] != '\\')
- i--;
- sprintf(buffer, "%s:%d", (file[i] != '\\') ? file : (file + i + 1), line);
- return buffer;
-}
-
-#endif
-#endif
-
typedef struct _herror_impl_t
{
int errcode;
@@ -156,143 +139,6 @@ herror_release(herror_t err)
}
-
-static log_level_t loglevel = HLOG_DEBUG;
-static char logfile[75] = { '\0' };
-static int log_background = 0;
-
-log_level_t
-log_set_level(log_level_t level)
-{
- log_level_t old = loglevel;
- loglevel = level;
- return old;
-}
-
-
-log_level_t
-log_get_level()
-{
- return loglevel;
-}
-
-
-void
-log_set_file(const char *filename)
-{
- if (filename)
- strncpy(logfile, filename, 75);
- else
- logfile[0] = '\0';
-}
-
-void
-log_set_background(int state)
-{
- log_background = state;
-}
-
-char *
-log_get_file()
-{
- if (logfile[0] == '\0')
- return NULL;
- return logfile;
-}
-
-static void
-log_write(log_level_t level, const char *prefix,
- const char *func, const char *format, va_list ap)
-{
- char buffer[1054];
- char buffer2[1054];
- FILE *f;
-
- if (level < loglevel)
- return;
-
- if (!log_background || log_get_file())
- {
-#ifdef WIN32
- sprintf(buffer, "*%s*: [%s] %s\n", prefix, func, format);
-#else
- sprintf(buffer, "*%s*:(%ld) [%s] %s\n",
- prefix, pthread_self(), func, format);
-#endif
- vsprintf(buffer2, buffer, ap);
- if (!log_background)
- {
- printf(buffer2);
- fflush(stdout);
- }
-
- if (log_get_file())
- {
- f = fopen(log_get_file(), "a");
- if (!f)
- f = fopen(log_get_file(), "w");
- if (f)
- {
- fprintf(f, buffer2);
- fflush(f);
- fclose(f);
- }
- }
- }
-}
-
-void
-log_verbose(const char *FUNC, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- log_write(HLOG_VERBOSE, "VERBOSE", FUNC, format, ap);
- va_end(ap);
-}
-
-void
-log_debug(const char *FUNC, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- log_write(HLOG_DEBUG, "DEBUG", FUNC, format, ap);
- va_end(ap);
-}
-
-void
-log_info(const char *FUNC, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- log_write(HLOG_INFO, "INFO", FUNC, format, ap);
- va_end(ap);
-}
-
-void
-log_warn(const char *FUNC, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- log_write(HLOG_WARN, "WARN", FUNC, format, ap);
- va_end(ap);
-}
-
-void
-log_error(const char *FUNC, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- log_write(HLOG_ERROR, "ERROR", FUNC, format, ap);
- va_end(ap);
-}
-
-
-
hpair_t *
hpairnode_new(const char *key, const char *value, hpair_t * next)
{
diff --git a/nanohttp/nanohttp-common.h b/nanohttp/nanohttp-common.h
index c018d45..2cd4bb8 100644
--- a/nanohttp/nanohttp-common.h
+++ b/nanohttp/nanohttp-common.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-common.h,v 1.30 2006/05/01 07:30:34 m0gg Exp $
+ * $Id: nanohttp-common.h,v 1.31 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -29,7 +29,7 @@
#define HEADER_CONTENT_ID "Content-Id"
#define HEADER_CONTENT_TRANSFER_ENCODING "Content-Transfer-Encoding"
-#define TRANSFER_ENCODING_CHUNKED "chunked"
+#define TRANSFER_ENCODING_CHUNKED "chunked"
/**
*
@@ -38,6 +38,7 @@
* There are a few header fields which have general applicability for both
* request and response messages, but which do not apply to the entity being
* transferred. These header fields apply only to the message being transmitted.
+ * (see RFC2616)
*
*/
#define HEADER_CACHE_CONTROL "Cache-Control"
@@ -126,13 +127,16 @@
#define HEADER_TRANSFER_EXTENSION "TE"
#define HEADER_USER_AGENT "User-Agent"
+/**
+ *
+ * nanohttp command line flags
+ *
+ */
#define NHTTPD_ARG_PORT "-NHTTPport"
#define NHTTPD_ARG_TERMSIG "-NHTTPtsig"
#define NHTTPD_ARG_MAXCONN "-NHTTPmaxconn"
#define NHTTPD_ARG_TIMEOUT "-NHTTPtimeout"
-#define NHTTP_ARG_LOGFILE "-NHTTPlog"
-
#define NHTTP_ARG_CERT "-NHTTPcert"
#define NHTTP_ARG_CERTPASS "-NHTTPcertpass"
#define NHTTP_ARG_CA "-NHTTPCA"
@@ -180,49 +184,49 @@
#define FILE_ERROR_READ 8001
/* Socket errors */
-#define HSOCKET_ERROR_CREATE 1001
-#define HSOCKET_ERROR_GET_HOSTNAME 1002
-#define HSOCKET_ERROR_CONNECT 1003
-#define HSOCKET_ERROR_SEND 1004
-#define HSOCKET_ERROR_RECEIVE 1005
-#define HSOCKET_ERROR_BIND 1006
-#define HSOCKET_ERROR_LISTEN 1007
-#define HSOCKET_ERROR_ACCEPT 1008
-#define HSOCKET_ERROR_NOT_INITIALIZED 1009
-#define HSOCKET_ERROR_IOCTL 1010
-#define HSOCKET_ERROR_SSLCLOSE 1011
-#define HSOCKET_ERROR_SSLCTX 1011
+#define HSOCKET_ERROR_CREATE 1001
+#define HSOCKET_ERROR_GET_HOSTNAME 1002
+#define HSOCKET_ERROR_CONNECT 1003
+#define HSOCKET_ERROR_SEND 1004
+#define HSOCKET_ERROR_RECEIVE 1005
+#define HSOCKET_ERROR_BIND 1006
+#define HSOCKET_ERROR_LISTEN 1007
+#define HSOCKET_ERROR_ACCEPT 1008
+#define HSOCKET_ERROR_NOT_INITIALIZED 1009
+#define HSOCKET_ERROR_IOCTL 1010
+#define HSOCKET_ERROR_SSLCLOSE 1011
+#define HSOCKET_ERROR_SSLCTX 1011
/* URL errors */
-#define URL_ERROR_UNKNOWN_PROTOCOL 1101
-#define URL_ERROR_NO_PROTOCOL 1102
-#define URL_ERROR_NO_HOST 1103
+#define URL_ERROR_UNKNOWN_PROTOCOL 1101
+#define URL_ERROR_NO_PROTOCOL 1102
+#define URL_ERROR_NO_HOST 1103
/* Stream errors */
-#define STREAM_ERROR_INVALID_TYPE 1201
-#define STREAM_ERROR_SOCKET_ERROR 1202
-#define STREAM_ERROR_NO_CHUNK_SIZE 1203
-#define STREAM_ERROR_WRONG_CHUNK_SIZE 1204
+#define STREAM_ERROR_INVALID_TYPE 1201
+#define STREAM_ERROR_SOCKET_ERROR 1202
+#define STREAM_ERROR_NO_CHUNK_SIZE 1203
+#define STREAM_ERROR_WRONG_CHUNK_SIZE 1204
/* MIME errors */
-#define MIME_ERROR_NO_BOUNDARY_PARAM 1301
-#define MIME_ERROR_NO_START_PARAM 1302
-#define MIME_ERROR_PARSE_ERROR 1303
-#define MIME_ERROR_NO_ROOT_PART 1304
-#define MIME_ERROR_NOT_MIME_MESSAGE 1305
+#define MIME_ERROR_NO_BOUNDARY_PARAM 1301
+#define MIME_ERROR_NO_START_PARAM 1302
+#define MIME_ERROR_PARSE_ERROR 1303
+#define MIME_ERROR_NO_ROOT_PART 1304
+#define MIME_ERROR_NOT_MIME_MESSAGE 1305
/* General errors */
-#define GENERAL_INVALID_PARAM 1400
+#define GENERAL_INVALID_PARAM 1400
#define GENERAL_HEADER_PARSE_ERROR 1401
/* Thread errors */
-#define THREAD_BEGIN_ERROR 1500
+#define THREAD_BEGIN_ERROR 1500
/* XML Errors */
-#define XML_ERROR_EMPTY_DOCUMENT 1600
-#define XML_ERROR_PARSE 1601
+#define XML_ERROR_EMPTY_DOCUMENT 1600
+#define XML_ERROR_PARSE 1601
/* SSL Errors */
#define HSSL_ERROR_CA_LIST 1710
@@ -259,7 +263,14 @@ typedef enum _http_version
typedef enum _hreq_method
{
HTTP_REQUEST_POST,
- HTTP_REQUEST_GET
+ HTTP_REQUEST_GET,
+ HTTP_REQUEST_OPTIONS,
+ HTTP_REQUEST_HEAD,
+ HTTP_REQUEST_PUT,
+ HTTP_REQUEST_DELETE,
+ HTTP_REQUEST_TRACE,
+ HTTP_REQUEST_CONNECT,
+ HTTP_REQUEST_UNKOWN
} hreq_method_t;
@@ -547,69 +558,6 @@ attachments_t *attachments_new(); /* should be used internally */
void attachments_free(attachments_t * message);
void attachments_add_part(attachments_t * attachments, part_t * part);
-
-/* logging stuff */
-typedef enum log_level
-{
- HLOG_VERBOSE,
- HLOG_DEBUG,
- HLOG_INFO,
- HLOG_WARN,
- HLOG_ERROR,
- HLOG_FATAL
-} log_level_t;
-
-
-
-log_level_t log_set_level(log_level_t level);
-log_level_t log_get_level();
-
-void log_set_file(const char *filename);
-char *log_get_file();
-
-#ifdef WIN32
-#if defined(_MSC_VER) && _MSC_VER <= 1200
-char *VisualC_funcname(const char *file, int line); /* not thread safe! */
-#define __FUNCTION__ VisualC_funcname(__FILE__, __LINE__)
-#endif
-#endif
-
-#define log_verbose1(a1) log_verbose(__FUNCTION__, a1)
-#define log_verbose2(a1,a2) log_verbose(__FUNCTION__, a1,a2)
-#define log_verbose3(a1,a2,a3) log_verbose(__FUNCTION__, a1,a2,a3)
-#define log_verbose4(a1,a2,a3,a4) log_verbose(__FUNCTION__, a1,a2,a3,a4)
-#define log_verbose5(a1,a2,a3,a4,a5) log_verbose(__FUNCTION__, a1,a2,a3,a4,a5)
-
-#define log_debug1(a1) log_debug(__FUNCTION__, a1)
-#define log_debug2(a1,a2) log_debug(__FUNCTION__, a1,a2)
-#define log_debug3(a1,a2,a3) log_debug(__FUNCTION__, a1,a2,a3)
-#define log_debug4(a1,a2,a3,a4) log_debug(__FUNCTION__, a1,a2,a3,a4)
-#define log_debug5(a1,a2,a3,a4,a5) log_debug(__FUNCTION__, a1,a2,a3,a4,a5)
-
-#define log_info1(a1) log_info(__FUNCTION__, a1)
-#define log_info2(a1,a2) log_info(__FUNCTION__, a1,a2)
-#define log_info3(a1,a2,a3) log_info(__FUNCTION__, a1,a2,a3)
-#define log_info4(a1,a2,a3,a4) log_info(__FUNCTION__, a1,a2,a3,a4)
-#define log_info5(a1,a2,a3,a4,a5) log_info(__FUNCTION__, a1,a2,a3,a4,a5)
-
-#define log_warn1(a1) log_warn(__FUNCTION__, a1)
-#define log_warn2(a1,a2) log_warn(__FUNCTION__, a1,a2)
-#define log_warn3(a1,a2,a3) log_warn(__FUNCTION__, a1,a2,a3)
-#define log_warn4(a1,a2,a3,a4) log_warn(__FUNCTION__, a1,a2,a3,a4)
-#define log_warn5(a1,a2,a3,a4,a5) log_warn(__FUNCTION__, a1,a2,a3,a4,a5)
-
-#define log_error1(a1) log_error(__FUNCTION__, a1)
-#define log_error2(a1,a2) log_error(__FUNCTION__, a1,a2)
-#define log_error3(a1,a2,a3) log_error(__FUNCTION__, a1,a2,a3)
-#define log_error4(a1,a2,a3,a4) log_error(__FUNCTION__, a1,a2,a3,a4)
-#define log_error5(a1,a2,a3,a4,a5) log_error(__FUNCTION__, a1,a2,a3,a4,a5)
-
-void log_verbose(const char *FUNC, const char *format, ...);
-void log_debug(const char *FUNC, const char *format, ...);
-void log_info(const char *FUNC, const char *format, ...);
-void log_warn(const char *FUNC, const char *format, ...);
-void log_error(const char *FUNC, const char *format, ...);
-
#ifdef __cplusplus
}
#endif
diff --git a/nanohttp/nanohttp-mime.c b/nanohttp/nanohttp-mime.c
index 4733dff..6a2e6d7 100755
--- a/nanohttp/nanohttp-mime.c
+++ b/nanohttp/nanohttp-mime.c
@@ -3,7 +3,7 @@
* | \/ | | | | \/ | | _/
* |_''_| |_| |_''_| |_'/ PARSER
*
-* $Id: nanohttp-mime.c,v 1.12 2006/03/06 13:37:38 m0gg Exp $
+* $Id: nanohttp-mime.c,v 1.13 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -45,6 +45,7 @@ Buffered Reader. A helper object to read bytes from a source
#include <utils/alloc.h>
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-mime.h"
diff --git a/nanohttp/nanohttp-request.c b/nanohttp/nanohttp-request.c
index 04adf00..8350848 100755
--- a/nanohttp/nanohttp-request.c
+++ b/nanohttp/nanohttp-request.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-request.c,v 1.13 2006/03/07 16:20:37 m0gg Exp $
+* $Id: nanohttp-request.c,v 1.14 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -41,6 +41,7 @@
#include <utils/alloc.h>
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-common.h"
#include "nanohttp-request.h"
@@ -108,8 +109,22 @@ _hrequest_parse_header(char *data)
{
if (!strcmp(key, "POST"))
req->method = HTTP_REQUEST_POST;
- else
+ else if (!strcmp(key, "GET"))
req->method = HTTP_REQUEST_GET;
+ else if (!strcmp(key, "OPTIONS"))
+ req->method = HTTP_REQUEST_OPTIONS;
+ else if (!strcmp(key, "HEAD"))
+ req->method = HTTP_REQUEST_HEAD;
+ else if (!strcmp(key, "PUT"))
+ req->method = HTTP_REQUEST_PUT;
+ else if (!strcmp(key, "DELETE"))
+ req->method = HTTP_REQUEST_DELETE;
+ else if (!strcmp(key, "TRACE"))
+ req->method = HTTP_REQUEST_TRACE;
+ else if (!strcmp(key, "CONNECT"))
+ req->method = HTTP_REQUEST_CONNECT;
+ else
+ req->method = HTTP_REQUEST_UNKOWN;
}
/* below is key the path and tmp2 the spec */
key = (char *) strtok_r(tmp2, " ", &saveptr2);
diff --git a/nanohttp/nanohttp-response.c b/nanohttp/nanohttp-response.c
index cb24d10..879fd6c 100755
--- a/nanohttp/nanohttp-response.c
+++ b/nanohttp/nanohttp-response.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-response.c,v 1.10 2006/03/06 13:37:38 m0gg Exp $
+* $Id: nanohttp-response.c,v 1.11 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -41,6 +41,7 @@
#include <utils/alloc.h>
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-common.h"
#include "nanohttp-response.h"
diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c
index 4995723..d5d77dd 100644
--- a/nanohttp/nanohttp-server.c
+++ b/nanohttp/nanohttp-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-server.c,v 1.61 2006/05/31 19:39:34 mrcsys Exp $
+* $Id: nanohttp-server.c,v 1.62 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -77,6 +77,7 @@
#include <utils/alloc.h>
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-server.h"
#include "nanohttp-base64.h"
#include "nanohttp-ssl.h"
diff --git a/nanohttp/nanohttp-socket.c b/nanohttp/nanohttp-socket.c
index 7ce9a25..dbb79c7 100644
--- a/nanohttp/nanohttp-socket.c
+++ b/nanohttp/nanohttp-socket.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-socket.c,v 1.60 2006/05/01 17:51:50 mrcsys Exp $
+* $Id: nanohttp-socket.c,v 1.61 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -85,6 +85,7 @@ typedef int ssize_t;
#include <utils/alloc.h>
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-socket.h"
#include "nanohttp-common.h"
#include "nanohttp-ssl.h"
diff --git a/nanohttp/nanohttp-ssl.c b/nanohttp/nanohttp-ssl.c
index 5a08486..a1f4ffb 100644
--- a/nanohttp/nanohttp-ssl.c
+++ b/nanohttp/nanohttp-ssl.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-ssl.c,v 1.27 2006/05/15 13:54:25 mrcsys Exp $
+* $Id: nanohttp-ssl.c,v 1.28 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2001-2005 Rochester Institute of Technology
@@ -71,6 +71,7 @@
#endif
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-common.h"
#include "nanohttp-socket.h"
#include "nanohttp-ssl.h"
diff --git a/nanohttp/nanohttp-stream.c b/nanohttp/nanohttp-stream.c
index ba36725..bda1a2c 100755
--- a/nanohttp/nanohttp-stream.c
+++ b/nanohttp/nanohttp-stream.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-stream.c,v 1.12 2006/03/06 13:37:38 m0gg Exp $
+* $Id: nanohttp-stream.c,v 1.13 2006/07/09 16:24:19 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -41,6 +41,7 @@
#include <utils/alloc.h>
#endif
+#include "nanohttp-logging.h"
#include "nanohttp-stream.h"
/*