From c3fd98b25607d0f7f5977586d188f88ab226a9b8 Mon Sep 17 00:00:00 2001
From: m0gg
Date: Tue, 21 Nov 2006 20:58:59 +0000
Subject: decoupling of nanohttp/libcsoap
---
nanohttp/Makefile.am | 2 +-
nanohttp/nanohttp-admin.c | 4 ++--
nanohttp/nanohttp-request.c | 6 +++++-
nanohttp/nanohttp-request.h | 4 +++-
nanohttp/nanohttp-server.c | 9 ++++-----
nanohttp/nanohttp-server.h | 4 +++-
6 files changed, 18 insertions(+), 11 deletions(-)
(limited to 'nanohttp')
diff --git a/nanohttp/Makefile.am b/nanohttp/Makefile.am
index 311f1f1..18ccaf6 100644
--- a/nanohttp/Makefile.am
+++ b/nanohttp/Makefile.am
@@ -15,5 +15,5 @@ libnanohttp_la_HEADERS=nanohttp-common.h nanohttp-socket.h nanohttp-client.h
nanohttp-admin.h
libnanohttp_la_LDFLAGS= -version-info @nanohttp_version@ -release @nanohttp_release@
-libnanohttp_la_CFLAGS=-I${top_srcdir}
+libnanohttp_la_CFLAGS=-I${top_srcdir} -D__NHTTP_INTERNAL=1
diff --git a/nanohttp/nanohttp-admin.c b/nanohttp/nanohttp-admin.c
index 6ca9255..83c2931 100644
--- a/nanohttp/nanohttp-admin.c
+++ b/nanohttp/nanohttp-admin.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-admin.c,v 1.2 2006/11/21 08:34:34 m0gg Exp $
+* $Id: nanohttp-admin.c,v 1.3 2006/11/21 20:59:02 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -86,7 +86,7 @@ _httpd_admin_list_services(httpd_conn_t *conn)
http_output_stream_write_string(conn->out, "
");
for (node = httpd_get_services(); node; node = node->next)
{
- sprintf(buffer, "- %s
", node->ctx, node->ctx);
+ sprintf(buffer, "- %s [Statistics]
", node->ctx, node->ctx, node->ctx);
http_output_stream_write_string(conn->out, buffer);
}
http_output_stream_write_string(conn->out, "
");
diff --git a/nanohttp/nanohttp-request.c b/nanohttp/nanohttp-request.c
index 449bb7a..30c79df 100755
--- a/nanohttp/nanohttp-request.c
+++ b/nanohttp/nanohttp-request.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-request.c,v 1.16 2006/11/21 08:34:34 m0gg Exp $
+* $Id: nanohttp-request.c,v 1.17 2006/11/21 20:59:02 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -33,6 +33,10 @@
#include
#endif
+#ifdef HAVE_STDLIB_H
+#include
+#endif
+
#ifdef HAVE_STRING_H
#include
#endif
diff --git a/nanohttp/nanohttp-request.h b/nanohttp/nanohttp-request.h
index d34466a..ba1b907 100755
--- a/nanohttp/nanohttp-request.h
+++ b/nanohttp/nanohttp-request.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-request.h,v 1.8 2006/11/19 09:40:14 m0gg Exp $
+ * $Id: nanohttp-request.h,v 1.9 2006/11/21 20:59:02 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -24,12 +24,14 @@
#ifndef NANO_HTTP_REQUEST_H
#define NANO_HTTP_REQUEST_H
+#ifdef __NHTTP_INTERNAL
struct request_statistics
{
unsigned long bytes_transmitted;
unsigned long bytes_received;
struct timeval time;
};
+#endif
/*
request object
diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c
index c75eacf..269e741 100644
--- a/nanohttp/nanohttp-server.c
+++ b/nanohttp/nanohttp-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-server.c,v 1.63 2006/11/19 09:40:14 m0gg Exp $
+* $Id: nanohttp-server.c,v 1.64 2006/11/21 20:59:03 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -259,7 +259,7 @@ httpd_register_secure(const char *ctx, httpd_service func, httpd_auth auth)
service->func = func;
strcpy(service->ctx, ctx);
- log_verbose3("register service:t(%p):%s", service, SAVE_STR(ctx));
+ log_verbose3("register service (%p) for \"%s\"", service, SAVE_STR(ctx));
if (_httpd_services_head == NULL)
{
_httpd_services_head = _httpd_services_tail = service;
@@ -280,8 +280,7 @@ httpd_register(const char *ctx, httpd_service service)
}
int
-httpd_register_default_secure(const char *ctx, httpd_service service,
- httpd_auth auth)
+httpd_register_default_secure(const char *ctx, httpd_service service, httpd_auth auth)
{
int ret;
@@ -648,7 +647,7 @@ httpd_session_main(void *data)
done = 0;
while (!done)
{
- log_verbose3("starting HTTP request on socket %p (%d)", conn->sock, conn->sock.sock);
+ log_verbose3("starting HTTP request on socket %d (%p)", conn->sock, conn->sock.sock);
/* XXX: only used in WSAreaper */
conn->atime = time(NULL);
diff --git a/nanohttp/nanohttp-server.h b/nanohttp/nanohttp-server.h
index f132285..eb3a06b 100644
--- a/nanohttp/nanohttp-server.h
+++ b/nanohttp/nanohttp-server.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-server.h,v 1.22 2006/11/19 09:40:14 m0gg Exp $
+ * $Id: nanohttp-server.h,v 1.23 2006/11/21 20:59:03 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -42,6 +42,7 @@ typedef void (*httpd_service) (httpd_conn_t *, hrequest_t *);
typedef int (*httpd_auth) (hrequest_t * req, const char *user,
const char *password);
+#ifdef __NHTTP_INTERNAL
struct service_statistics {
unsigned long requests;
unsigned long bytes_transmitted;
@@ -49,6 +50,7 @@ struct service_statistics {
struct timeval time;
pthread_rwlock_t lock;
};
+#endif
/*
* Service representation object
--
cgit v1.1-32-gdbae