Cygnumhttpdthreadstacksize, Cygnumhttpdserverbuffersize, Cygnumhttpdserverdelay – Comtrol eCos User Manual
Page 635: Support functions and macros, Http support, Cygnum_httpd_server_buffer_size, Cygnum_httpd_server_delay

Chapter 48. Embedded HTTP Server
CYGNUM_HTTPD_THREAD_STACK_SIZE
This is the amount of stack to be allocated for each of the HTTPD threads. The actual stack size allocated will be
this value plus the values of
CYGNUM_HAL_STACK_SIZE_MINIMUM
and
CYGNUM_HTTPD_SERVER_BUFFER_SIZE
.
CYGNUM_HTTPD_SERVER_BUFFER_SIZE
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.
CYGNUM_HTTPD_SERVER_DELAY
This defines the number of system clock ticks that the HTTP server will wait before initializing itself and spawning
any extra server threads. This is to give the application a chance to initialize properly without any interference from
the HTTPD.
Support Functions and Macros
The emphasis of this server is on dynamically generated content, rather than fetching it from a filesystem. To do
this the handler functions make calls to
fprintf()
and
fputs()
. Such handler functions would end up a mass
of print calls, with the actual structure of the HTML page hidden in the format strings and arguments, making
maintenance and debugging very difficult. Such an approach would also result in the definition of many, often only
slightly different, format strings, leading to unnecessary bloat.
In an effort to expose the structure of the HTML in the structure of the C code, and to maximize the sharing of
string constants, the
cyg/httpd/httpd.h
header file defines a set of helper functions and macros. Most of these
are wrappers for predefined print calls on the
client
stream passed to the hander function. For examples of their
use, see the System Monitor example.
Note: All arguments to macros are pointers to strings, unless otherwise stated. In general, wherever a function
or macro has an
attr
or
__attr
parameter, then the contents of this string will be inserted into the tag being
defined as HTML attributes. If it is a NULL or empty string it will be ignored.
HTTP Support
void cyg_http_start( FILE *client, char *content_type, int content_length );
void cyg_http_finish( FILE *client );
#define html_begin(__client)
#define html_end( __client )
The function
cyg_http_start()
generates a simple HTTP response header containing the value of
CYGDAT_HTTPD_SERVER_ID
in the "Server" field, and the values of
content_type
and
content_length
in the "Content-type" and "Content-length" field respectively. The function
cyg_http_finish()
just adds an
extra newline to the end of the output and then flushes it to force the data out to the client.
531