Functions |
ssize_t | onion_http_write (onion_request *req, const char *data, size_t len) |
onion_connection_status | onion_shortcut_response (const char *response, int code, onion_request *req, onion_response *res) |
| Shortcut for fast responses, like errors.Prepares a fast response. You pass only the request, the text and the code, and it do the full response object and sends the data.
|
onion_connection_status | onion_shortcut_response_extra_headers (const char *response, int code, onion_request *req, onion_response *res,...) |
| Shortcut for fast responses, like errors, with extra headersPrepares a fast response. You pass only the request, the text and the code, and it do the full response object and sends the data.
|
onion_connection_status | onion_shortcut_redirect (const char *newurl, onion_request *req, onion_response *res) |
| Shortcut to ease a redirect.It can be used directly as a handler, or be called from a handler.
|
onion_connection_status | onion_shortcut_internal_redirect (const char *newurl, onion_request *req, onion_response *res) |
| Shortcut for fast internal redirect. It returns what the server would return with the new address.
|
onion_connection_status | onion_shortcut_response_file (const char *filename, onion_request *request, onion_response *res) |
| This shortcut returns the given file contents.This is the recomended way to send static files; it even can use sendfile Linux call if suitable.
|
onion_connection_status | onion_shortcut_response_json (onion_dict *d, onion_request *req, onion_response *res) |
| Shortcut to answer some json dataIt converts to json the passed dict and returns it. The dict is freed before returning.
|
void | onion_shortcut_date_string (time_t t, char *dest) |
| Transforms a time_t to a RFC 822 date stringThis date format is the standard in HTTP protocol as RFC 2616, section 3.3.1.
|
void | onion_shortcut_date_string_iso (time_t t, char *dest) |
| Transforms a time_t to a ISO date stringThe dest pointer must be at least 21 bytes long as thats the maximum size of the date.
|
void | onion_shortcut_etag (struct stat *st, char etag[32]) |
| Unifies the creation of etags.Just now its a very simple one, based on the size and date.
|
int | onion_shortcut_rename (const char *orig, const char *dest) |
| Moves a file to another locationIt takes care if it can be a simple rename or must copy and remove old.
|