#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include "url.h"
#include "wwwhandler.h"
Data Structures | |
| struct | cmd_dispatch_t |
Defines | |
| #define | DEFAULT_TIMEOUT (10*AW_TIMESTAMP_PER_SEC) |
| #define | HTTP_CMD(cmd, tcd, handler) { cmd, sizeof(cmd)-1, tcd, handler } |
| #define | HTTP_HEADER(result_code, keywordblock) result_code "Server: " AW_WWWHANDLER_SERVER "\r\n" keywordblock "\r\n" |
| #define | MIME_TYPE(_suffix, _mime_type) |
Functions | |
| aw_wwwhandler_t * | aw_create_wwwhandler (u_int32_t port, byte_t *docroot, aw_wwwhandler_options_t *options, aw_logger_t *logger) |
| Create a www handler. | |
| void | aw_free_wwwhandler (aw_wwwhandler_t *h) |
| Free handler and all associated resources. | |
| int32_t | aw_init_wwwhandler (aw_wwwhandler_t *h, u_int32_t port, byte_t *docroot, aw_wwwhandler_options_t *options, aw_logger_t *logger) |
| Init a www handler. | |
| int32_t | aw_wwwhandler_append_cgipage (aw_wwwhandler_xtn_t *xtn, void *data, u_int32_t nbytes) |
| Append to xtn->cgi.page.data. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_do_cgi (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn, byte_t *prog) |
| aw_wwwhandler_io_code_t | aw_wwwhandler_do_exec (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn, const byte_t *prog, const byte_t *prog_argv[], const byte_t *httpheader) |
| Run prog rebinding stdout to socket. | |
| const byte_t * | aw_wwwhandler_find_cgiheader_line (aw_wwwhandler_xtn_t *xtn, byte_t *key) |
| Find string value associated with key from header in cgi GET or POST. | |
| const byte_t * | aw_wwwhandler_get_cgiarg (aw_wwwhandler_xtn_t *xtn, const byte_t *key) |
| Find string value associated with key from form. | |
| const byte_t * | aw_wwwhandler_get_multi_cgiarg (aw_wwwhandler_xtn_t *xtn, const byte_t *key, const byte_t *last) |
| Find string value associated with key from form for mutli select. | |
| int32_t | aw_wwwhandler_printf_cgipage (aw_wwwhandler_xtn_t *xtn, const char *fmt,...) |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_200 (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn, time_t lastmod, u_int64_t size, int32_t max_age, byte_t *mime_type, byte_t *charset, byte_t *hdrs) |
| Send a 200 response. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_cgi200 (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn, byte_t *hdrs) |
| Send 200 reponse for cgi page. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_cgipage (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn) |
| Write xtn->cgi.page.data to socket and free at end of xtn. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_error (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn, u_int32_t code, byte_t *message) |
| Reply w/http error code. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_file (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn) |
| Write file as content. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_header (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn) |
| Write xtn->buffer to socket. | |
| aw_wwwhandler_io_code_t | aw_wwwhandler_tx_metadata (aw_handler_args_t *args, aw_wwwhandler_xtn_t *xtn, u_int32_t dir) |
| Write metadata for file as HEAD response. | |
|
|
|
|
|
|
|
|
|
|
|
Value: { \
.suffix = _suffix, .suffixlen = sizeof(_suffix)-1, .mime_type = _mime_type \
}
|
|
||||||||||||||||||||
|
Create a www handler. aw_create_wwwhandler
|
|
|
Free handler and all associated resources. aw_free_wwwhandler
|
|
||||||||||||||||||||||||
|
Init a www handler. aw_init_wwwhandler
|
|
||||||||||||||||
|
Append to xtn->cgi.page.data. aw_wwwhandler_append_cgipage
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
Run prog rebinding stdout to socket. aw_wwwhandler_do_exec
|
|
||||||||||||
|
Find string value associated with key from header in cgi GET or POST. aw_wwwhandler_find_cgiheader_line
|
|
||||||||||||
|
Find string value associated with key from form. aw_wwwhandler_get_cgiarg
|
|
||||||||||||||||
|
Find string value associated with key from form for mutli select. aw_wwwhandler_get_multi_cgiarg
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
Send a 200 response. aw_wwwhandler_tx_200
|
|
||||||||||||||||
|
Send 200 reponse for cgi page. aw_wwwhandler_tx_cgi200
|
|
||||||||||||
|
Write xtn->cgi.page.data to socket and free at end of xtn. aw_wwwhandler_tx_cgibuffer
|
|
||||||||||||||||||||
|
Reply w/http error code. aw_wwwhandler_tx_error
|
|
||||||||||||
|
Write file as content. aw_wwwhandler_tx_file
|
|
||||||||||||
|
Write xtn->buffer to socket. aw_wwwhandler_tx_header
|
|
||||||||||||||||
|
Write metadata for file as HEAD response. aw_wwwhandler_tx_metadata
|