This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
HTTPD -- add autostart option
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: 09 Mar 2004 10:34:54 +0000
- Subject: HTTPD -- add autostart option
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/httpd/current/ChangeLog,v
retrieving revision 1.10
diff -u -5 -r1.10 ChangeLog
--- ChangeLog 2 Mar 2004 10:27:26 -0000 1.10
+++ ChangeLog 9 Mar 2004 10:32:05 -0000
@@ -1,8 +1,19 @@
+2004-03-09 Nick Garnett <nickg@calivar.com>
+
+ * include/httpd.h:
+ * src/init.cxx:
+ * src/httpd.c:
+ * src/init.cxx:
+ Added option to enable auto-starting of HTTPD. This is set by
+ default so the current behaviour is retained. When this is
+ disabled the application has to call cyg_httpd_startup() to get
+ the server going.
+
2004-02-23 Jeff Duncan <jeffd@magtek.com>
- * src/httpd.c (cyg_httpd_server): Fix http header by adding
+ * src/httpd.c (cyg_httpd_server): Fix http header by adding
newline after server name.
2003-10-21 Eric Doenges <Eric.Doenges@DynaPel.com>
* src/monitor.c (cyg_monitor_memory): Check if the request
Index: cdl/httpd.cdl
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/httpd/current/cdl/httpd.cdl,v
retrieving revision 1.4
diff -u -5 -r1.4 httpd.cdl
--- cdl/httpd.cdl 12 May 2003 10:24:23 -0000 1.4
+++ cdl/httpd.cdl 9 Mar 2004 10:32:08 -0000
@@ -68,11 +68,11 @@
interface. It is NOT intended to be a general purpose server for
delivering arbitrary web content."
compile httpd.c
compile -library=libextras.a init.cxx
-
+
cdl_option CYGNUM_HTTPD_SERVER_PORT {
display "HTTP port"
flavor data
default_value 80
description "HTTP port to which browsers will connect.
@@ -127,10 +127,19 @@
flavor data
default_value 256
description "This defines the size of the buffer used to receive the first
line of each HTTP request. If you expect to use particularly
long URLs or have very complex forms, this should be increased."
+ }
+
+ cdl_option CYGNUM_HTTPD_SERVER_AUTO_START {
+ display "Autostart HTTPD"
+ default_value 1
+ description "This option causes the HTTP Daemon to be started
+ automatically during system initialization. If this option
+ is not set then the application must start the daemon
+ explicitly by calling cyg_httpd_startup()."
}
cdl_option CYGNUM_HTTPD_SERVER_DELAY {
display "HTTPD server startup delay"
flavor data
Index: include/httpd.h
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/httpd/current/include/httpd.h,v
retrieving revision 1.3
diff -u -5 -r1.3 httpd.h
--- include/httpd.h 23 Sep 2003 11:40:15 -0000 1.3
+++ include/httpd.h 9 Mar 2004 10:32:11 -0000
@@ -62,10 +62,20 @@
#include <cyg/hal/hal_tables.h>
#include <stdio.h>
/* ================================================================= */
+/* Start daemon explicitly
+ */
+
+#ifndef CYGNUM_HTTPD_SERVER_AUTO_START
+
+__externC void cyg_httpd_startup(void);
+
+#endif
+
+/* ================================================================= */
/* Lookup Table
*
*
*/
Index: src/httpd.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/httpd/current/src/httpd.c,v
retrieving revision 1.5
diff -u -5 -r1.5 httpd.c
--- src/httpd.c 2 Mar 2004 10:27:27 -0000 1.5
+++ src/httpd.c 9 Mar 2004 10:32:17 -0000
@@ -235,10 +235,11 @@
{
HTTPD_DIAG("try %08x: %s\n", entry, entry->pattern);
if( match( filename, entry->pattern ) )
{
+ HTTPD_DIAG("calling %08x: %s\n", entry, entry->pattern);
if( (success = entry->handler( client, filename, formdata, entry->arg )) )
break;
}
entry++;
@@ -248,11 +249,14 @@
* found" response.
* TODO: add an optional fallback to go look for files in
* some filesystem, somewhere.
*/
if( !success )
+ {
+ HTTPD_DIAG("Not found %s\n",filename);
cyg_httpd_send_html( client, NULL, NULL, cyg_httpd_not_found );
+ }
fclose(client);
}
/* ================================================================= */
@@ -380,11 +384,13 @@
/* ================================================================= */
/* System initializer
*
* This is called from the static constructor in init.cxx. It spawns
- * the main server thread and makes it ready to run.
+ * the main server thread and makes it ready to run. It can also be
+ * called explicitly by the application if the auto start option is
+ * disabled.
*/
__externC void cyg_httpd_startup(void)
{
cyg_thread_create( CYGNUM_HTTPD_THREAD_PRIORITY,
Index: src/init.cxx
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/httpd/current/src/init.cxx,v
retrieving revision 1.1
diff -u -5 -r1.1 init.cxx
--- src/init.cxx 22 Dec 2002 11:09:02 -0000 1.1
+++ src/init.cxx 9 Mar 2004 10:32:27 -0000
@@ -55,10 +55,12 @@
#include <pkgconf/system.h>
#include <pkgconf/isoinfra.h>
#include <pkgconf/httpd.h>
+#ifdef CYGNUM_HTTPD_SERVER_AUTO_START
+
#include <cyg/infra/cyg_trac.h> // tracing macros
#include <cyg/infra/cyg_ass.h> // assertion macros
/* ================================================================= */
@@ -86,8 +88,10 @@
Cyg_Httpd_Init_Class::Cyg_Httpd_Init_Class()
{
cyg_httpd_startup();
}
+
+#endif // CYGNUM_HTTPD_SERVER_AUTO_START
/* ----------------------------------------------------------------- */
/* end of httpd.c */
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com The eCos and RedBoot experts