This library contains a minimalistic implementation of HTTP 1.0 server for VxWorks targets. Also it provides XML RPC (server) interface via HTTP.

The latest version 1.1.0 can be downloaded via this link.

Supported features


All configuration parameters are in httpd.h header file. None of these parameters can be modified in runtime.
HTTPD_MAX_SESSIONS Specified number of clients' session the server may create. Each session is a separate task (thread) that handles HTTP communication with a client. Move sessions you allow, more clients can connect to the server at the same time. If you use CGI function that may cause some delay, it's better to allow several sessions.
HTTPD_REQUEST_TIMEOUT Number of milliseconds the server waits for the request from a just connected client. If this time expires, the server drops connection (see HTTPD_KEEPALIVE_TIMEOUT for keep-alive connections).
HTTPD_KEEP_ALIVE_TIMEOUT Number of 'wait cycles' the server waits for the request from a client. If keep-alive option is enabled, the server will wait in total for HTTPD_KEEP_ALIVE_TIMEOUT * HTTPD_REQUEST_TIMEOUT milliseconds for the request from a client. When this time expires, the server drops connection.
HTTPD_STDIO_REDIRECT Once this parameters is defined, all output to the stdio of CGI functions will be automatically redirected to a client. This concerns only those functions called from HTTP session tasks. All other functions will continue to output to stdio. If you want your CGI function to output in stdio, you have to disable this option. In this case you may use httpd_printf() that acts like printf() function but outputs to a client's socket. Please note, that output of logMsg() function will not be redirected since it's handled in a separate task (see vxWorks documentation).
HTTPD_MAX_INPUT_BUFFER_SIZE Number of bytes the server may receive from a client as a HTTP request. Normally HTTP requests are quite short, so you may want to change this value in order to save some memory. If an incoming request is longer than this value, the server will drop connection with an error.
HTTPD_MAX_OUTPUT_BUFFER_SIZE Size of a buffer used by httpd_printf() function. If you use stdio redirection you should not care about adjusting this value. Elsewhere you may want to change it in order to same some memory (that is allocated from session task stack).
HTTPD_MAIN_PRIORITY HTTP main task priority. Main task accepts incoming connections and create session tasks.
HTTPD_SESSION_PRIORITY Session tasks priority.
HTTPD_MAIN_STACK_SIZE Stack allocated for HTTP server main task. You do not need to change this value since CGI functions stack is allocated from sesstions tasks stack.
HTTPD_SESSION_STACK_SIZE Stack allocated for every session task. You may want to increase this value if your CGI function uses alot of local variables. Pay attantion to this elsewhere stack overflow may easily occured in while executing your CGI function.
HTTPD_ALLOW_FILES If this option is defined, the server may transfer files from local file system to a client (just like an ordinal web server).
HTTPD_DOC_ROOT If you allow file serving, this parameter should specify a location of files visible to a server.
HTTPD_INDEX_FILE Name of a file the server will try to forward to a client in case when requested URL does not cantain explicitely a name of a file (like http://server/). By default it's index.html If you have a CGI function that has been mapped on exactly the same file name, the server will execute a CGI function rather than forward a file.

Examples of usage

See an example of HTTP server usage in file example.c contained in httpd package, or follow this link to browse the source code.

For XML RPC example, please follow this link or take a look at example_xmlrpc.c file contained in httpd package.

©2009 by Arthur Benilov

Project Web Hosted by