#include <httpd.h>
Inheritance diagram for SimpleHttpDaemon:
Public Methods | |
SimpleHttpDaemon (int max_childs, int flags) | |
virtual | ~SimpleHttpDaemon () |
virtual int | reinit () |
void | kill_running () |
Protected Methods | |
virtual void | http_common_headers (std::ostream &os) |
Contains parsed http header. | |
virtual void | http_server_sign (std::ostream &os) |
int | outfile (const char *fname, size_t size, const char *mime_type) |
int | autoindex (const char *dirname) |
virtual void | vhost_setup (dsStrstream &src) |
virtual int | process_request (dsStrstream &src) |
virtual int | child_work () |
virtual int | init_globals () |
virtual pid_t | fork_child () |
virtual void | shutdown_child () |
void | http_request_headers (dsStrstream &src) |
int | end_of_header (dsStrstream &req) |
bool | parse_first_line (dsStrstream &src) |
bool | parse_header_line (dsStrstream &src) |
virtual int | http_500 (const char *message=0) |
virtual int | http_501 (const char *method, const char *implemented="GET") |
virtual int | http_400 (const char *req_url) |
virtual int | http_403 (const char *req_url) |
virtual int | http_404 (const char *req_url) |
virtual int | http_200 (const char *mime_type, dsStrstream &body) |
virtual int | http_200 (const char *mime_type, int cont_length) |
virtual const char * | content_type (const char *url) |
void | processPidFile () |
void | addChild (pid_t npid) |
void | removeChild (pid_t npid) |
int | waitForFreeSlot (pid_t pid) |
Protected Attributes | |
dsServerSocket * | _ss |
char * | _server_root |
Chroot path. | |
int | _bind_port |
Port to bind to. | |
dsHashTable * | _ht |
Friends | |
void | daemonize (dsDaemon *sd, int options=0) |
void | dsSafeSleep (int secs, int nsecs=0) |
int | DaemonFlags (char *str) |
void | SIGCHLD_hdl (int sig) |
void | SIGANY_hdl (int sig) |
void | SIGINT_hdl (int sig) |
|
|
|
|
|
|
|
|
|
This function does per child actions Reimplemented from dsDaemon. |
|
Extract url suffx and attempt to map it to content type |
|
|
|
fork child. Default function increase child counter and then fork. It's better to call return dsDaemon::fork_child() at the end of overloaded function. if overloaded function returns -1 (fork error) child will not be intialised. Reimplemented from dsDaemon. |
|
This function place daemon sign to bottom of error messages Reimplemented from dsHttpDaemon. |
|
|
|
This function add common headers to every response default implementation add local date only. Polite daemon should also add its name. Reimplemented from dsHttpDaemon. |
|
Perform tasks after daemon detach, but before first fork all file handlers is closed to this point. Reimplemented from dsDaemon. |
|
read pid file and kill running instance |
|
|
|
|
|
|
|
Do per-request work. All found http headers placed into hashtable two meta-headers added METHOD and URL Argument src points to start of data block Reimplemented from dsHttpDaemon. |
|
|
|
Function to call from SIGHUP handler. Week point use it with care. |
|
|
|
This function called when child terminated wether by SIGTERM or normally Reimplemented from dsDaemon. |
|
Do additional initialisation just after request header parsed. Reimplemented from dsHttpDaemon. |
|
Waits for free slot in child array, and returns number of found slot |
|
Convert text reperesentation of daemon file into binary flags |
|
Perform basic system tasks to become a daemon: close all handlers, allocate new process group and detach
|
|
safe sleep: implement sleep by nanosleep or select timer (TODO), instead of using SIGALARM or sleep() to avoid possible interference with user application |
|
|
|
|
|
|
|
|
|
|
|
|
|
|