libonion
|
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <regex.h>
#include <onion/handler.h>
#include <onion/response.h>
#include <onion/low.h>
#include "static.h"
Data Structures | |
struct | onion_handler_static_data_t |
Typedefs | |
typedef struct onion_handler_static_data_t | onion_handler_static_data |
Functions | |
int | onion_handler_static_handler (onion_handler_static_data *d, onion_request *request, onion_response *res) |
Performs the real request: set the code and write data. | |
void | onion_handler_static_delete (onion_handler_static_data *d) |
Removes internal data for this handler. | |
onion_handler * | onion_handler_static (const char *text, int code) |
Creates a static handler that just writes some static data. |
typedef struct onion_handler_static_data_t onion_handler_static_data |
onion_handler* onion_handler_static | ( | const char * | text, |
int | code | ||
) |
Creates a static handler that just writes some static data.
Creates an static handler. Returns some content from memory, like an error html.
Path is a regex for the url, as arrived here.
References onion_handler_static_data_t::code, onion_handler_static_data_t::data, onion_handler_t::onion_handler_new(), onion_handler_static_delete(), onion_handler_static_handler(), onion_low_malloc(), and onion_low_strdup().
void onion_handler_static_delete | ( | onion_handler_static_data * | d | ) |
Removes internal data for this handler.
References onion_handler_static_data_t::data, and onion_low_free().
Referenced by onion_handler_static().
int onion_handler_static_handler | ( | onion_handler_static_data * | d, |
onion_request * | request, | ||
onion_response * | res | ||
) |
Performs the real request: set the code and write data.
References onion_handler_static_data_t::code, onion_handler_static_data_t::data, OCS_PROCESSED, onion_response_t::onion_response_set_code(), onion_response_t::onion_response_set_length(), onion_response_t::onion_response_write(), and onion_response_t::onion_response_write_headers().
Referenced by onion_handler_static().