#include "civetweb.h"
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdint.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <dirent.h>
#include <grp.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <pthread.h>
#include <pwd.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <dlfcn.h>
#include "md5.inl"
#include "openssl_dl.inl"
#include "response.inl"
#include "handle_form.inl"
Classes | |
struct | ah |
struct | cgi_environment |
struct | de |
struct | dir_scan_data |
struct | mg_connection |
struct | mg_context |
struct | mg_domain_context |
struct | mg_file |
struct | mg_file_access |
struct | mg_file_stat |
struct | mg_handler_info |
struct | mg_http_method_info |
struct | mg_workerTLS |
struct | process_control_data |
struct | read_auth_file_struct |
struct | socket |
union | usa |
struct | vec |
struct | websocket_client_thread_data |
Macros | |
#define | __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
#define | __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ |
#define | _DARWIN_UNLIMITED_SELECT |
#define | _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ |
#define | _GNU_SOURCE /* for setgroups(), pthread_setname_np() */ |
#define | _LARGEFILE_SOURCE /* For fseeko(), ftello() */ |
#define | ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) |
#define | calloc DO_NOT_USE_THIS_FUNCTION__USE_mg_calloc |
#define | CGI_ENVIRONMENT_SIZE (4096) /* in bytes */ |
#define | closesocket(a) (close(a)) |
#define | CRYPTO_LIB "libcrypto.so" |
#define | DEBUG_ASSERT(cond) |
#define | DEBUG_TRACE(fmt, ...) |
#define | ERRNO (errno) |
#define | ERROR_TRY_AGAIN(err) (((err) == EAGAIN) || ((err) == EWOULDBLOCK) || ((err) == EINTR)) |
#define | free DO_NOT_USE_THIS_FUNCTION__USE_mg_free |
#define | FUNCTION_MAY_BE_UNUSED |
#define | HEXTOI(x) (isdigit(x) ? (x - '0') : (x - 'W')) |
#define | HTTP1_only |
#define | IGNORE_UNUSED_RESULT(a) ((void)((a) && 1)) |
#define | INITIAL_DEPTH 9 |
#define | INT64_FMT PRId64 |
#define | INT64_MAX (9223372036854775807) |
#define | INVALID_SOCKET (-1) |
#define | IP_ADDR_STR_LEN (50) /* IPv6 hex string is 46 chars */ |
#define | malloc DO_NOT_USE_THIS_FUNCTION__USE_mg_malloc |
#define | MAX_CGI_ENVIR_VARS (256) /* in variables (count) */ |
#define | MAX_WORKER_THREADS (1024 * 64) /* in threads (count) */ |
#define | MD5_STATIC static |
#define | MG_BUF_LEN (1024 * 8) |
#define | mg_calloc_ctx(a, b, c) mg_calloc(a, b) |
#define | mg_closedir(x) (closedir(x)) |
#define | mg_cry DO_NOT_USE_THIS_FUNCTION__USE_mg_cry_internal |
#define | mg_cry_ctx_internal(ctx, fmt, ...) mg_cry_internal_wrap(NULL, ctx, __func__, __LINE__, fmt, __VA_ARGS__) |
#define | mg_cry_internal(conn, fmt, ...) mg_cry_internal_wrap(conn, NULL, __func__, __LINE__, fmt, __VA_ARGS__) |
#define | MG_FILE_COMPRESSION_SIZE_LIMIT (1024) /* in bytes */ |
#define | MG_FOPEN_MODE_APPEND (4) |
#define | MG_FOPEN_MODE_NONE (0) |
#define | MG_FOPEN_MODE_READ (1) |
#define | MG_FOPEN_MODE_WRITE (2) |
#define | mg_free_ctx(a, c) mg_free(a) |
#define | mg_get_option DO_NOT_USE_THIS_FUNCTION_INTERNALLY__access_directly |
#define | mg_malloc_ctx(a, c) mg_malloc(a) |
#define | mg_mkdir(conn, path, mode) (mkdir(path, mode)) |
#define | mg_opendir(conn, x) (opendir(x)) |
#define | mg_pollfd pollfd |
#define | mg_readdir(x) (readdir(x)) |
#define | mg_realloc_ctx(a, b, c) mg_realloc(a, b) |
#define | mg_remove(conn, x) (remove(x)) |
#define | mg_sleep(x) (usleep((x)*1000)) |
#define | mg_static_assert(cond, txt) extern char static_assert_replacement[(cond) ? 1 : -1] |
#define | MSG_NOSIGNAL (0) |
#define | NO_ALTERNATIVE_QUEUE |
#define | O_BINARY (0) |
#define | PASSWORDS_FILE_NAME ".htpasswd" |
#define | realloc DO_NOT_USE_THIS_FUNCTION__USE_mg_realloc |
#define | SHUTDOWN_BOTH (2) |
#define | SHUTDOWN_RD (0) |
#define | SHUTDOWN_WR (1) |
#define | snprintf DO_NOT_USE_THIS_FUNCTION__USE_mg_snprintf |
#define | SOCKET_TIMEOUT_QUANTUM (2000) /* in ms */ |
#define | SSL_LIB "libssl.so" |
#define | STOP_FLAG_ASSIGN(f, v) ((*(f)) = (v)) |
#define | STOP_FLAG_IS_TWO(f) ((*(f)) == 2) |
#define | STOP_FLAG_IS_ZERO(f) ((*(f)) == 0) |
#define | STRUCT_FILE_INITIALIZER |
#define | UINT64_FMT PRIu64 |
#define | USA_IN_PORT_UNSAFE(s) ((s)->sin.sin_port) |
#define | UTF8_PATH_MAX (PATH_MAX) |
#define | va_copy(x, y) ((x) = (y)) |
#define | vsnprintf_impl vsnprintf |
#define | WIN32_LEAN_AND_MEAN |
#define | WINCDECL |
Typedefs | |
typedef const void * | SOCK_OPT_TYPE |
typedef int | SOCKET |
typedef int volatile | stop_flag_t |
Functions | |
static int | abort_cgi_process (void *data) |
static void | accept_new_connection (const struct socket *listener, struct mg_context *ctx) |
static void | addenv (struct cgi_environment *env, const char *fmt,...) |
static int | alloc_vprintf (char **out_buf, char *prealloc_buf, size_t prealloc_size, const char *fmt, va_list ap) |
static int | alloc_vprintf2 (char **buf, const char *fmt, va_list ap) |
static int | authorize (struct mg_connection *conn, struct mg_file *filep, const char *realm) |
static void | bin2str (char *to, const unsigned char *p, size_t len) |
static int | check_acl (struct mg_context *phys_ctx, const union usa *sa) |
static int | check_authorization (struct mg_connection *conn, const char *path) |
static int | check_password (const char *method, const char *ha1, const char *uri, const char *nonce, const char *nc, const char *cnonce, const char *qop, const char *response) |
static void | close_all_listening_sockets (struct mg_context *ctx) |
static void | close_connection (struct mg_connection *conn) |
static void | close_socket_gracefully (struct mg_connection *conn) |
static int | compare_dir_entries (const void *p1, const void *p2) |
static int | connect_socket (struct mg_context *ctx, const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, SOCKET *sock, union usa *sa) |
static void | construct_etag (char *buf, size_t buf_len, const struct mg_file_stat *filestat) |
static int | consume_socket (struct mg_context *ctx, struct socket *sp, int thread_index) |
static void | delete_file (struct mg_connection *conn, const char *path) |
static int | dir_scan_callback (struct de *de, void *data) |
static void | discard_unread_request_data (struct mg_connection *conn) |
static void | do_ssi_exec (struct mg_connection *conn, char *tag) |
static void | do_ssi_include (struct mg_connection *conn, const char *ssi, char *tag, int include_level) |
static int | extention_matches_script (struct mg_connection *conn, const char *filename) |
static int | extention_matches_template_text (struct mg_connection *conn, const char *filename) |
static struct mg_connection * | fake_connection (struct mg_connection *fc, struct mg_context *ctx) |
static void | fclose_on_exec (struct mg_file_access *filep, struct mg_connection *conn) |
static int | forward_body_data (struct mg_connection *conn, FILE *fp, SOCKET sock, SSL *ssl) |
static void | free_context (struct mg_context *ctx) |
static int | get_first_ssl_listener_index (const struct mg_context *ctx) |
static const char * | get_header (const struct mg_header *hdr, int num_hdr, const char *name) |
static void | get_host_from_request_info (struct vec *host, const struct mg_request_info *ri) |
static int | get_http_header_len (const char *buf, int buflen) |
static const struct mg_http_method_info * | get_http_method_info (const char *method) |
static const char * | get_http_version (const struct mg_connection *conn) |
static int | get_message (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) |
static void | get_mime_type (struct mg_connection *conn, const char *path, struct vec *vec) |
static int | get_month_index (const char *s) |
static int | get_option_index (const char *name) |
static const char * | get_proto_name (const struct mg_connection *conn) |
static uint64_t | get_random (void) |
static const char * | get_rel_url_at_current_server (const char *uri, const struct mg_connection *conn) |
static int | get_request (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) |
static int | get_request_handler (struct mg_connection *conn, int handler_type, mg_request_handler *handler, struct mg_websocket_subprotocols **subprotocols, mg_websocket_connect_handler *connect_handler, mg_websocket_ready_handler *ready_handler, mg_websocket_data_handler *data_handler, mg_websocket_close_handler *close_handler, mg_authorization_handler *auth_handler, void **cbdata, struct mg_handler_info **handler_info) |
static int | get_response (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) |
static void | get_system_name (char **sysName) |
static int | get_uri_type (const char *uri) |
static void | gmt_time_string (char *buf, size_t buf_len, time_t *t) |
static void | handle_cgi_request (struct mg_connection *conn, const char *prog, unsigned char cgi_config_idx) |
static void | handle_directory_request (struct mg_connection *conn, const char *dir) |
static void | handle_file_based_request (struct mg_connection *conn, const char *path, struct mg_file *filep) |
static void | handle_not_modified_static_file_request (struct mg_connection *conn, struct mg_file *filep) |
static void | handle_propfind (struct mg_connection *conn, const char *path, struct mg_file_stat *filep) |
static void | handle_request (struct mg_connection *) |
static void | handle_request_stat_log (struct mg_connection *conn) |
static void | handle_ssi_file_request (struct mg_connection *conn, const char *path, struct mg_file *filep) |
static void | handle_static_file_request (struct mg_connection *conn, const char *path, struct mg_file *filep, const char *mime_type, const char *additional_headers) |
static int | header_has_option (const char *header, const char *option) |
static const char * | header_val (const struct mg_connection *conn, const char *header) |
static int | hexdump2string (void *mem, int memlen, char *buf, int buflen) |
static void | init_connection (struct mg_connection *conn) |
static int | init_ssl_ctx (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx) |
static int | init_ssl_ctx_impl (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx, const char *pem, const char *chain) |
static int | initialize_openssl (char *ebuf, size_t ebuf_len) |
static void | interpret_uri (struct mg_connection *conn, char *filename, size_t filename_buf_len, struct mg_file_stat *filestat, int *is_found, int *is_script_resource, int *is_websocket_request, int *is_put_or_delete_request, int *is_template_text) |
static int | is_authorized_for_put (struct mg_connection *conn) |
static int | is_file_opened (const struct mg_file_access *fileacc) |
static int | is_in_script_path (const struct mg_connection *conn, const char *path) |
static int | is_not_modified (const struct mg_connection *conn, const struct mg_file_stat *filestat) |
static int | is_put_or_delete_method (const struct mg_connection *conn) |
static int | is_ssl_port_used (const char *ports) |
static int | is_valid_http_method (const char *method) |
static int | is_valid_port (unsigned long port) |
static void | legacy_init (const char **options) |
static void * | load_tls_dll (char *ebuf, size_t ebuf_len, const char *dll_name, struct ssl_func *sw, int *feature_missing) |
static void | log_access (const struct mg_connection *) |
static int | lowercase (const char *s) |
static void * | master_thread (void *thread_func_param) |
static void | master_thread_run (struct mg_context *ctx) |
static ptrdiff_t | match_prefix (const char *pattern, size_t pattern_len, const char *str) |
static ptrdiff_t | match_prefix_strlen (const char *pattern, const char *str) |
static ptrdiff_t | mg_atomic_dec (volatile ptrdiff_t *addr) |
static ptrdiff_t | mg_atomic_inc (volatile ptrdiff_t *addr) |
static __inline void * | mg_calloc (size_t a, size_t b) |
int | mg_check_digest_access_authentication (struct mg_connection *conn, const char *realm, const char *filename) |
unsigned | mg_check_feature (unsigned feature) |
void | mg_close_connection (struct mg_connection *conn) |
struct mg_connection * | mg_connect_client (const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size) |
static struct mg_connection * | mg_connect_client_impl (const struct mg_client_options *client_options, int use_ssl, char *ebuf, size_t ebuf_len) |
struct mg_connection * | mg_connect_client_secure (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size) |
struct mg_connection * | mg_connect_websocket_client (const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
struct mg_connection * | mg_connect_websocket_client_extensions (const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, const char *extensions, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
static struct mg_connection * | mg_connect_websocket_client_impl (const struct mg_client_options *client_options, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, const char *extensions, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
struct mg_connection * | mg_connect_websocket_client_secure (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
struct mg_connection * | mg_connect_websocket_client_secure_extensions (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, const char *extensions, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
static int | mg_construct_local_link (const struct mg_connection *conn, char *buf, size_t buflen, const char *define_proto, int define_port, const char *define_uri) |
void | mg_cry (const struct mg_connection *conn, const char *fmt,...) |
static void | mg_cry_internal_impl (const struct mg_connection *conn, const char *func, unsigned line, const char *fmt, va_list ap) |
static void | mg_cry_internal_wrap (const struct mg_connection *conn, struct mg_context *ctx, const char *func, unsigned line, const char *fmt,...) |
static unsigned long | mg_current_thread_id (void) |
static double | mg_difftimespec (const struct timespec *ts_now, const struct timespec *ts_before) |
void | mg_disable_connection_keep_alive (struct mg_connection *conn) |
struct mg_connection * | mg_download (const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, const char *fmt,...) |
unsigned | mg_exit_library (void) |
static int | mg_fclose (struct mg_file_access *fileacc) |
static int | mg_fgetc (struct mg_file *filep) |
static const char * | mg_fgets (char *buf, size_t size, struct mg_file *filep) |
static int | mg_fopen (const struct mg_connection *conn, const char *path, int mode, struct mg_file *filep) |
static __inline void | mg_free (void *a) |
const char * | mg_get_builtin_mime_type (const char *path) |
struct mg_context * | mg_get_context (const struct mg_connection *conn) |
int | mg_get_context_info (const struct mg_context *ctx, char *buffer, int buflen) |
int | mg_get_cookie (const char *cookie_header, const char *var_name, char *dst, size_t dst_size) |
static uint64_t | mg_get_current_time_ns (void) |
const char * | mg_get_header (const struct mg_connection *conn, const char *name) |
const char * | mg_get_option (const struct mg_context *ctx, const char *name) |
const struct mg_request_info * | mg_get_request_info (const struct mg_connection *conn) |
int | mg_get_request_link (const struct mg_connection *conn, char *buf, size_t buflen) |
int | mg_get_response (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int timeout) |
const char * | mg_get_response_code_text (const struct mg_connection *conn, int response_code) |
const struct mg_response_info * | mg_get_response_info (const struct mg_connection *conn) |
int | mg_get_server_ports (const struct mg_context *ctx, int size, struct mg_server_port *ports) |
int | mg_get_system_info (char *buffer, int buflen) |
void * | mg_get_thread_pointer (const struct mg_connection *conn) |
void * | mg_get_user_connection_data (const struct mg_connection *conn) |
void * | mg_get_user_context_data (const struct mg_connection *conn) |
void * | mg_get_user_data (const struct mg_context *ctx) |
const struct mg_option * | mg_get_valid_options (void) |
int | mg_get_var (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len) |
int | mg_get_var2 (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len, size_t occurrence) |
static void | mg_global_lock (void) |
static void | mg_global_unlock (void) |
static int | mg_inet_pton (int af, const char *src, void *dst, size_t dstlen, int resolve_src) |
unsigned | mg_init_library (unsigned features) |
static int | mg_join_thread (pthread_t threadid) |
void | mg_lock_connection (struct mg_connection *conn) |
void | mg_lock_context (struct mg_context *ctx) |
static __inline void * | mg_malloc (size_t a) |
char * | mg_md5 (char buf[33],...) |
int | mg_modify_passwords_file (const char *fname, const char *domain, const char *user, const char *pass) |
int | mg_modify_passwords_file_ha1 (const char *fname, const char *domain, const char *user, const char *ha1) |
static int | mg_path_suspicious (const struct mg_connection *conn, const char *path) |
static int | mg_poll (struct pollfd *pfd, unsigned int n, int milliseconds, const stop_flag_t *stop_flag) |
int | mg_printf (struct mg_connection *conn, const char *fmt,...) |
int | mg_read (struct mg_connection *conn, void *buf, size_t len) |
static int | mg_read_inner (struct mg_connection *conn, void *buf, size_t len) |
static __inline void * | mg_realloc (void *a, size_t b) |
int | mg_send_chunk (struct mg_connection *conn, const char *chunk, unsigned int chunk_len) |
int | mg_send_digest_access_authentication_request (struct mg_connection *conn, const char *realm) |
void | mg_send_file (struct mg_connection *conn, const char *path) |
int | mg_send_file_body (struct mg_connection *conn, const char *path) |
int | mg_send_http_error (struct mg_connection *conn, int status, const char *fmt,...) |
static int | mg_send_http_error_impl (struct mg_connection *conn, int status, const char *fmt, va_list args) |
int | mg_send_http_ok (struct mg_connection *conn, const char *mime_type, long long content_length) |
int | mg_send_http_redirect (struct mg_connection *conn, const char *target_url, int redirect_code) |
void | mg_send_mime_file (struct mg_connection *conn, const char *path, const char *mime_type) |
void | mg_send_mime_file2 (struct mg_connection *conn, const char *path, const char *mime_type, const char *additional_headers) |
void | mg_set_auth_handler (struct mg_context *ctx, const char *uri, mg_authorization_handler handler, void *cbdata) |
static void | mg_set_handler_type (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx, const char *uri, int handler_type, int is_delete_request, mg_request_handler handler, struct mg_websocket_subprotocols *subprotocols, mg_websocket_connect_handler connect_handler, mg_websocket_ready_handler ready_handler, mg_websocket_data_handler data_handler, mg_websocket_close_handler close_handler, mg_authorization_handler auth_handler, void *cbdata) |
void | mg_set_request_handler (struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata) |
static void | mg_set_thread_name (const char *name) |
void | mg_set_user_connection_data (const struct mg_connection *const_conn, void *data) |
void | mg_set_websocket_handler (struct mg_context *ctx, const char *uri, mg_websocket_connect_handler connect_handler, mg_websocket_ready_handler ready_handler, mg_websocket_data_handler data_handler, mg_websocket_close_handler close_handler, void *cbdata) |
void | mg_set_websocket_handler_with_subprotocols (struct mg_context *ctx, const char *uri, struct mg_websocket_subprotocols *subprotocols, mg_websocket_connect_handler connect_handler, mg_websocket_ready_handler ready_handler, mg_websocket_data_handler data_handler, mg_websocket_close_handler close_handler, void *cbdata) |
static void | mg_snprintf (const struct mg_connection *conn, int *truncated, char *buf, size_t buflen, const char *fmt,...) |
int | mg_split_form_urlencoded (char *data, struct mg_header *form_fields, unsigned num_form_fields) |
struct mg_context * | mg_start (const struct mg_callbacks *callbacks, void *user_data, const char **options) |
struct mg_context * | mg_start2 (struct mg_init_data *init, struct mg_error_data *error) |
int | mg_start_domain (struct mg_context *ctx, const char **options) |
int | mg_start_domain2 (struct mg_context *ctx, const char **options, struct mg_error_data *error) |
int | mg_start_thread (mg_thread_func_t func, void *param) |
static int | mg_start_thread_with_id (mg_thread_func_t func, void *param, pthread_t *threadidptr) |
static int | mg_stat (const struct mg_connection *conn, const char *path, struct mg_file_stat *filep) |
void | mg_stop (struct mg_context *ctx) |
long long | mg_store_body (struct mg_connection *conn, const char *path) |
static size_t | mg_str_append (char **dst, char *end, const char *src) |
int | mg_strcasecmp (const char *s1, const char *s2) |
static const char * | mg_strcasestr (const char *big_str, const char *small_str) |
static char * | mg_strdup (const char *str) |
static char * | mg_strdup_ctx (const char *str, struct mg_context *ctx) |
static void | mg_strlcpy (char *dst, const char *src, size_t n) |
int | mg_strncasecmp (const char *s1, const char *s2, size_t len) |
static char * | mg_strndup_ctx (const char *ptr, size_t len, struct mg_context *ctx) |
void | mg_unlock_connection (struct mg_connection *conn) |
void | mg_unlock_context (struct mg_context *ctx) |
int | mg_url_decode (const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded) |
int | mg_url_encode (const char *src, char *dst, size_t dst_len) |
const char * | mg_version (void) |
static int | mg_vprintf (struct mg_connection *conn, const char *fmt, va_list ap) |
static void | mg_vsnprintf (const struct mg_connection *conn, int *truncated, char *buf, size_t buflen, const char *fmt, va_list ap) |
int | mg_write (struct mg_connection *conn, const void *buf, size_t len) |
static void | mkcol (struct mg_connection *conn, const char *path) |
static int | modify_passwords_file (const char *fname, const char *domain, const char *user, const char *pass, const char *ha1) |
static int | must_hide_file (struct mg_connection *conn, const char *path) |
static const char * | next_option (const char *list, struct vec *val, struct vec *eq_val) |
static void | open_auth_file (struct mg_connection *conn, const char *path, struct mg_file *filep) |
static int | parse_auth_header (struct mg_connection *conn, char *buf, size_t buf_size, struct ah *ah) |
static time_t | parse_date_string (const char *datetime) |
static int | parse_http_headers (char **buf, struct mg_header hdr[(64)]) |
static int | parse_http_request (char *buf, int len, struct mg_request_info *ri) |
static int | parse_http_response (char *buf, int len, struct mg_response_info *ri) |
static int | parse_match_net (const struct vec *vec, const union usa *sa, int no_strict) |
static int | parse_port_string (const struct vec *vec, struct socket *so, int *ip_version) |
static int | parse_range_header (const char *header, int64_t *a, int64_t *b) |
static int | prepare_cgi_environment (struct mg_connection *conn, const char *prog, struct cgi_environment *env, unsigned char cgi_config_idx) |
static int | print_dav_dir_entry (struct de *de, void *data) |
static int | print_dir_entry (struct de *de) |
static int | print_props (struct mg_connection *conn, const char *uri, const char *name, struct mg_file_stat *filep) |
static void | process_new_connection (struct mg_connection *conn) |
static void | produce_socket (struct mg_context *ctx, const struct socket *sp) |
static int | pull_all (FILE *fp, struct mg_connection *conn, char *buf, int len) |
static int | pull_inner (FILE *fp, struct mg_connection *conn, char *buf, int len, double timeout) |
static int | push_all (struct mg_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int len) |
static int | push_inner (struct mg_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int len, double timeout) |
static int | put_dir (struct mg_connection *conn, const char *path) |
static void | put_file (struct mg_connection *conn, const char *path) |
static int | read_auth_file (struct mg_file *filep, struct read_auth_file_struct *workdata, int depth) |
static int | read_message (FILE *fp, struct mg_connection *conn, char *buf, int bufsiz, int *nread) |
static void | redirect_to_https_port (struct mg_connection *conn, int port) |
static int | refresh_trust (struct mg_connection *conn) |
static void | release_handler_ref (struct mg_connection *conn, struct mg_handler_info *handler_info) |
static void | remove_bad_file (const struct mg_connection *conn, const char *path) |
static int | remove_directory (struct mg_connection *conn, const char *dir) |
static void | remove_dot_segments (char *inout) |
static void | reset_per_request_attributes (struct mg_connection *conn) |
static int | scan_directory (struct mg_connection *conn, const char *dir, void *data, int(*cb)(struct de *, void *)) |
static void | send_additional_header (struct mg_connection *conn) |
static void | send_authorization_request (struct mg_connection *conn, const char *realm) |
static void | send_file_data (struct mg_connection *conn, struct mg_file *filep, int64_t offset, int64_t len) |
static void | send_no_cache_header (struct mg_connection *conn) |
static void | send_options (struct mg_connection *conn) |
static void | send_ssi_file (struct mg_connection *, const char *, struct mg_file *, int) |
static void | send_static_cache_header (struct mg_connection *conn) |
static int | set_acl_option (struct mg_context *phys_ctx) |
static int | set_blocking_mode (SOCKET sock) |
static void | set_close_on_exec (int fd, const struct mg_connection *conn, struct mg_context *ctx) |
static int | set_gpass_option (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx) |
static int | set_non_blocking_mode (SOCKET sock) |
static int | set_ports_option (struct mg_context *phys_ctx) |
static int | set_tcp_nodelay (const struct socket *so, int nodelay_on) |
static int | set_throttle (const char *spec, const union usa *rsa, const char *uri) |
static int | set_uid_option (struct mg_context *phys_ctx) |
static int | should_decode_query_string (const struct mg_connection *conn) |
static int | should_decode_url (const struct mg_connection *conn) |
static int | should_keep_alive (const struct mg_connection *conn) |
static int | should_switch_to_protocol (const struct mg_connection *conn) |
static char * | skip_quoted (char **buf, const char *delimiters, const char *whitespace, char quotechar) |
static int | skip_to_end_of_word_and_terminate (char **ppw, int eol) |
static void | sockaddr_to_string (char *buf, size_t len, const union usa *usa) |
static pid_t | spawn_process (struct mg_connection *conn, const char *prog, char *envblk, char *envp[], int fdin[2], int fdout[2], int fderr[2], const char *dir, unsigned char cgi_config_idx) |
static const char * | ssl_error (void) |
static int | ssl_get_client_cert_info (const struct mg_connection *conn, struct mg_client_cert *client_cert) |
static long | ssl_get_protocol (int version_id) |
static void | ssl_info_callback (const SSL *ssl, int what, int ret) |
static void | ssl_locking_callback (int mode, int mutex_num, const char *file, int line) |
static int | ssl_servername_callback (SSL *ssl, int *ad, void *arg) |
static int | ssl_use_pem_file (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx, const char *pem, const char *chain) |
static int | sslize (struct mg_connection *conn, int(*func)(SSL *), const struct mg_client_options *client_options) |
static int | substitute_index_file (struct mg_connection *conn, char *path, size_t path_len, struct mg_file_stat *filestat) |
static const char * | suggest_connection_header (const struct mg_connection *conn) |
static int | switch_domain_context (struct mg_connection *conn) |
static void | tls_dtor (void *key) |
static void | uninitialize_openssl (void) |
static void | url_decode_in_place (char *buf) |
static void * | worker_thread (void *thread_func_param) |
static void | worker_thread_run (struct mg_connection *conn) |
Variables | ||
struct { | ||
unsigned default_port | ||
const char * proto | ||
size_t proto_len | ||
} | abs_uri_protocols [] | |
struct { | ||
size_t ext_len | ||
const char * extension | ||
const char * mime_type | ||
} | builtin_mime_types [] | |
static const struct mg_option | config_options [] | |
static void * | cryptolib_dll_handle | |
static volatile ptrdiff_t | cryptolib_users | |
static pthread_mutex_t | global_lock_mutex | |
static const struct mg_http_method_info | http_methods [] | |
static int | mg_init_library_called = 0 | |
static const char | month_names [][4] | |
static pthread_mutexattr_t | pthread_mutex_attr | |
static pthread_mutex_t * | ssl_mutexes | |
static void * | ssllib_dll_handle | |
char | static_assert_replacement [1] | |
static pthread_key_t | sTlsKey | |
static volatile ptrdiff_t | thread_idx_max = 0 | |
#define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
Definition at line 73 of file civetweb.c.
Definition at line 76 of file civetweb.c.
#define _DARWIN_UNLIMITED_SELECT |
Definition at line 79 of file civetweb.c.
#define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ |
Definition at line 70 of file civetweb.c.
#define _GNU_SOURCE /* for setgroups(), pthread_setname_np() */ |
Definition at line 57 of file civetweb.c.
#define _LARGEFILE_SOURCE /* For fseeko(), ftello() */ |
Definition at line 67 of file civetweb.c.
#define ARRAY_SIZE | ( | array | ) | (sizeof(array) / sizeof(array[0])) |
Definition at line 504 of file civetweb.c.
#define calloc DO_NOT_USE_THIS_FUNCTION__USE_mg_calloc |
Definition at line 1537 of file civetweb.c.
#define CGI_ENVIRONMENT_SIZE (4096) /* in bytes */ |
Definition at line 486 of file civetweb.c.
Definition at line 914 of file civetweb.c.
#define CRYPTO_LIB "libcrypto.so" |
Definition at line 908 of file civetweb.c.
#define DEBUG_ASSERT | ( | cond | ) |
Definition at line 260 of file civetweb.c.
#define DEBUG_TRACE | ( | fmt, | |
... | |||
) |
Definition at line 242 of file civetweb.c.
#define ERRNO (errno) |
Definition at line 921 of file civetweb.c.
#define ERROR_TRY_AGAIN | ( | err | ) | (((err) == EAGAIN) || ((err) == EWOULDBLOCK) || ((err) == EINTR)) |
Definition at line 445 of file civetweb.c.
#define free DO_NOT_USE_THIS_FUNCTION__USE_mg_free |
Definition at line 1539 of file civetweb.c.
#define FUNCTION_MAY_BE_UNUSED |
Definition at line 316 of file civetweb.c.
#define HTTP1_only |
Definition at line 6581 of file civetweb.c.
Definition at line 291 of file civetweb.c.
#define INITIAL_DEPTH 9 |
Definition at line 8486 of file civetweb.c.
#define INT64_FMT PRId64 |
Definition at line 923 of file civetweb.c.
#define INT64_MAX (9223372036854775807) |
Definition at line 511 of file civetweb.c.
#define INVALID_SOCKET (-1) |
Definition at line 922 of file civetweb.c.
#define IP_ADDR_STR_LEN (50) /* IPv6 hex string is 46 chars */ |
Definition at line 1724 of file civetweb.c.
#define malloc DO_NOT_USE_THIS_FUNCTION__USE_mg_malloc |
Definition at line 1536 of file civetweb.c.
#define MAX_CGI_ENVIR_VARS (256) /* in variables (count) */ |
Definition at line 491 of file civetweb.c.
#define MAX_WORKER_THREADS (1024 * 64) /* in threads (count) */ |
Definition at line 463 of file civetweb.c.
#define MD5_STATIC static |
Definition at line 1716 of file civetweb.c.
#define MG_BUF_LEN (1024 * 8) |
Definition at line 496 of file civetweb.c.
Definition at line 919 of file civetweb.c.
#define mg_cry DO_NOT_USE_THIS_FUNCTION__USE_mg_cry_internal |
Definition at line 3475 of file civetweb.c.
#define mg_cry_ctx_internal | ( | ctx, | |
fmt, | |||
... | |||
) | mg_cry_internal_wrap(NULL, ctx, __func__, __LINE__, fmt, __VA_ARGS__) |
Definition at line 2549 of file civetweb.c.
#define mg_cry_internal | ( | conn, | |
fmt, | |||
... | |||
) | mg_cry_internal_wrap(conn, NULL, __func__, __LINE__, fmt, __VA_ARGS__) |
Definition at line 2546 of file civetweb.c.
#define MG_FILE_COMPRESSION_SIZE_LIMIT (1024) /* in bytes */ |
Definition at line 476 of file civetweb.c.
#define MG_FOPEN_MODE_APPEND (4) |
Definition at line 2812 of file civetweb.c.
#define MG_FOPEN_MODE_NONE (0) |
Definition at line 2803 of file civetweb.c.
#define MG_FOPEN_MODE_READ (1) |
Definition at line 2806 of file civetweb.c.
#define MG_FOPEN_MODE_WRITE (2) |
Definition at line 2809 of file civetweb.c.
#define mg_get_option DO_NOT_USE_THIS_FUNCTION_INTERNALLY__access_directly |
Definition at line 3148 of file civetweb.c.
Definition at line 915 of file civetweb.c.
Definition at line 918 of file civetweb.c.
#define mg_pollfd pollfd |
Definition at line 945 of file civetweb.c.
Definition at line 920 of file civetweb.c.
Definition at line 1496 of file civetweb.c.
Definition at line 916 of file civetweb.c.
Definition at line 917 of file civetweb.c.
#define mg_static_assert | ( | cond, | |
txt | |||
) | extern char static_assert_replacement[(cond) ? 1 : -1] |
Definition at line 124 of file civetweb.c.
#define MSG_NOSIGNAL (0) |
Definition at line 1727 of file civetweb.c.
#define NO_ALTERNATIVE_QUEUE |
Definition at line 150 of file civetweb.c.
#define O_BINARY (0) |
Definition at line 912 of file civetweb.c.
#define PASSWORDS_FILE_NAME ".htpasswd" |
Definition at line 480 of file civetweb.c.
#define realloc DO_NOT_USE_THIS_FUNCTION__USE_mg_realloc |
Definition at line 1538 of file civetweb.c.
#define SHUTDOWN_BOTH (2) |
Definition at line 516 of file civetweb.c.
#define SHUTDOWN_RD (0) |
Definition at line 514 of file civetweb.c.
#define SHUTDOWN_WR (1) |
Definition at line 515 of file civetweb.c.
#define snprintf DO_NOT_USE_THIS_FUNCTION__USE_mg_snprintf |
Definition at line 1540 of file civetweb.c.
#define SOCKET_TIMEOUT_QUANTUM (2000) /* in ms */ |
Definition at line 471 of file civetweb.c.
#define SSL_LIB "libssl.so" |
Definition at line 905 of file civetweb.c.
Definition at line 2304 of file civetweb.c.
Definition at line 2303 of file civetweb.c.
#define STRUCT_FILE_INITIALIZER |
Definition at line 1883 of file civetweb.c.
#define UINT64_FMT PRIu64 |
Definition at line 924 of file civetweb.c.
#define USA_IN_PORT_UNSAFE | ( | s | ) | ((s)->sin.sin_port) |
Definition at line 1852 of file civetweb.c.
#define UTF8_PATH_MAX (PATH_MAX) |
Definition at line 858 of file civetweb.c.
#define vsnprintf_impl vsnprintf |
Definition at line 894 of file civetweb.c.
#define WIN32_LEAN_AND_MEAN |
Definition at line 173 of file civetweb.c.
#define WINCDECL |
Definition at line 926 of file civetweb.c.
typedef const void* SOCK_OPT_TYPE |
Definition at line 860 of file civetweb.c.
Definition at line 925 of file civetweb.c.
typedef int volatile stop_flag_t |
Definition at line 2302 of file civetweb.c.
anonymous enum |
Definition at line 1910 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
REQUEST_HANDLER | |
WEBSOCKET_HANDLER | |
AUTH_HANDLER |
Definition at line 2206 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
CONTEXT_INVALID | |
CONTEXT_SERVER | |
CONTEXT_HTTP_CLIENT | |
CONTEXT_WS_CLIENT |
Definition at line 2242 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
CONNECTION_TYPE_INVALID | |
CONNECTION_TYPE_REQUEST | |
CONNECTION_TYPE_RESPONSE |
Definition at line 2421 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
PROTOCOL_TYPE_HTTP1 | |
PROTOCOL_TYPE_WEBSOCKET | |
PROTOCOL_TYPE_HTTP2 |
Definition at line 2427 of file civetweb.c.
|
static |
Definition at line 11230 of file civetweb.c.
|
static |
Definition at line 19072 of file civetweb.c.
|
static |
Definition at line 10962 of file civetweb.c.
|
static |
Definition at line 6854 of file civetweb.c.
|
static |
Definition at line 6821 of file civetweb.c.
|
static |
Definition at line 8614 of file civetweb.c.
|
static |
Definition at line 8191 of file civetweb.c.
|
static |
Definition at line 15409 of file civetweb.c.
|
static |
Definition at line 8667 of file civetweb.c.
|
static |
Definition at line 8229 of file civetweb.c.
|
static |
Definition at line 14644 of file civetweb.c.
|
static |
Definition at line 17045 of file civetweb.c.
|
static |
Definition at line 16920 of file civetweb.c.
|
static |
Definition at line 9398 of file civetweb.c.
|
static |
Definition at line 8993 of file civetweb.c.
|
static |
Definition at line 9843 of file civetweb.c.
|
static |
Definition at line 18739 of file civetweb.c.
|
static |
Definition at line 11784 of file civetweb.c.
Definition at line 9584 of file civetweb.c.
|
static |
Definition at line 6457 of file civetweb.c.
|
static |
Definition at line 11932 of file civetweb.c.
|
static |
Definition at line 11847 of file civetweb.c.
|
static |
Definition at line 7318 of file civetweb.c.
|
static |
Definition at line 7364 of file civetweb.c.
|
static |
Definition at line 3435 of file civetweb.c.
|
static |
Definition at line 9858 of file civetweb.c.
|
static |
Definition at line 10862 of file civetweb.c.
|
static |
Definition at line 19363 of file civetweb.c.
|
static |
Definition at line 13404 of file civetweb.c.
|
static |
Definition at line 3763 of file civetweb.c.
|
static |
Definition at line 13419 of file civetweb.c.
Definition at line 7754 of file civetweb.c.
|
static |
Definition at line 10557 of file civetweb.c.
|
static |
Definition at line 3821 of file civetweb.c.
|
static |
Definition at line 17693 of file civetweb.c.
|
static |
Definition at line 8156 of file civetweb.c.
|
static |
Definition at line 7791 of file civetweb.c.
|
static |
Definition at line 3122 of file civetweb.c.
|
static |
Definition at line 3539 of file civetweb.c.
|
static |
Definition at line 5878 of file civetweb.c.
|
static |
Definition at line 17589 of file civetweb.c.
|
static |
Definition at line 17769 of file civetweb.c.
|
static |
Definition at line 13843 of file civetweb.c.
|
static |
Definition at line 17861 of file civetweb.c.
|
static |
Definition at line 19503 of file civetweb.c.
|
static |
Definition at line 17519 of file civetweb.c.
|
static |
Definition at line 3305 of file civetweb.c.
|
static |
Definition at line 11265 of file civetweb.c.
|
static |
Definition at line 9616 of file civetweb.c.
|
static |
Definition at line 14542 of file civetweb.c.
|
static |
Definition at line 10165 of file civetweb.c.
|
static |
Definition at line 12236 of file civetweb.c.
|
static |
Definition at line 13987 of file civetweb.c.
|
static |
Definition at line 6535 of file civetweb.c.
|
static |
Definition at line 12077 of file civetweb.c.
|
static |
Definition at line 9882 of file civetweb.c.
|
static |
Definition at line 3901 of file civetweb.c.
|
static |
Definition at line 15234 of file civetweb.c.
Definition at line 15774 of file civetweb.c.
|
static |
Definition at line 18445 of file civetweb.c.
|
static |
Definition at line 16665 of file civetweb.c.
|
static |
Definition at line 16419 of file civetweb.c.
|
static |
Definition at line 16001 of file civetweb.c.
|
static |
Definition at line 7436 of file civetweb.c.
|
static |
Definition at line 8784 of file civetweb.c.
|
static |
Definition at line 2816 of file civetweb.c.
|
static |
Definition at line 13928 of file civetweb.c.
|
static |
Definition at line 10150 of file civetweb.c.
|
static |
Definition at line 7304 of file civetweb.c.
|
static |
Definition at line 14867 of file civetweb.c.
|
static |
Definition at line 10576 of file civetweb.c.
|
static |
Definition at line 8945 of file civetweb.c.
|
static |
Definition at line 19551 of file civetweb.c.
|
static |
Definition at line 15895 of file civetweb.c.
|
static |
Definition at line 15251 of file civetweb.c.
|
static |
Definition at line 2975 of file civetweb.c.
|
static |
Definition at line 19345 of file civetweb.c.
|
static |
Definition at line 19159 of file civetweb.c.
|
static |
Definition at line 3920 of file civetweb.c.
|
static |
Definition at line 3965 of file civetweb.c.
|
static |
Definition at line 1141 of file civetweb.c.
|
static |
Definition at line 1118 of file civetweb.c.
|
static |
Definition at line 1477 of file civetweb.c.
int mg_check_digest_access_authentication | ( | struct mg_connection * | conn, |
const char * | realm, | ||
const char * | filename | ||
) |
Definition at line 8642 of file civetweb.c.
unsigned mg_check_feature | ( | unsigned | feature | ) |
Definition at line 20463 of file civetweb.c.
void mg_close_connection | ( | struct mg_connection * | conn | ) |
Definition at line 17120 of file civetweb.c.
struct mg_connection * mg_connect_client | ( | const char * | host, |
int | port, | ||
int | use_ssl, | ||
char * | error_buffer, | ||
size_t | error_buffer_size | ||
) |
Definition at line 17392 of file civetweb.c.
|
static |
Definition at line 17183 of file civetweb.c.
struct mg_connection * mg_connect_client_secure | ( | const struct mg_client_options * | client_options, |
char * | error_buffer, | ||
size_t | error_buffer_size | ||
) |
Definition at line 17380 of file civetweb.c.
struct mg_connection * mg_connect_websocket_client | ( | const char * | host, |
int | port, | ||
int | use_ssl, | ||
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data | ||
) |
Definition at line 18331 of file civetweb.c.
struct mg_connection * mg_connect_websocket_client_extensions | ( | const char * | host, |
int | port, | ||
int | use_ssl, | ||
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
const char * | extensions, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data | ||
) |
Definition at line 18387 of file civetweb.c.
|
static |
Definition at line 18121 of file civetweb.c.
struct mg_connection * mg_connect_websocket_client_secure | ( | const struct mg_client_options * | client_options, |
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data | ||
) |
Definition at line 18361 of file civetweb.c.
struct mg_connection * mg_connect_websocket_client_secure_extensions | ( | const struct mg_client_options * | client_options, |
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
const char * | extensions, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data | ||
) |
Definition at line 18417 of file civetweb.c.
|
static |
Definition at line 3566 of file civetweb.c.
void mg_cry | ( | const struct mg_connection * | conn, |
const char * | fmt, | ||
... | |||
) |
Definition at line 3466 of file civetweb.c.
|
static |
Definition at line 3347 of file civetweb.c.
|
static |
Definition at line 3446 of file civetweb.c.
|
static |
Definition at line 1618 of file civetweb.c.
|
static |
Definition at line 3329 of file civetweb.c.
void mg_disable_connection_keep_alive | ( | struct mg_connection * | conn | ) |
Definition at line 21076 of file civetweb.c.
struct mg_connection * mg_download | ( | const char * | host, |
int | port, | ||
int | use_ssl, | ||
char * | ebuf, | ||
size_t | ebuf_len, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 17998 of file civetweb.c.
unsigned mg_exit_library | ( | void | ) |
Definition at line 21444 of file civetweb.c.
|
static |
Definition at line 2949 of file civetweb.c.
Definition at line 11956 of file civetweb.c.
|
static |
Definition at line 8467 of file civetweb.c.
|
static |
Definition at line 2878 of file civetweb.c.
|
static |
Definition at line 1489 of file civetweb.c.
const char * mg_get_builtin_mime_type | ( | const char * | path | ) |
Definition at line 8134 of file civetweb.c.
struct mg_context * mg_get_context | ( | const struct mg_connection * | conn | ) |
Definition at line 3151 of file civetweb.c.
int mg_get_context_info | ( | const struct mg_context * | ctx, |
char * | buffer, | ||
int | buflen | ||
) |
Definition at line 20877 of file civetweb.c.
int mg_get_cookie | ( | const char * | cookie_header, |
const char * | var_name, | ||
char * | dst, | ||
size_t | dst_size | ||
) |
Definition at line 7157 of file civetweb.c.
|
static |
Definition at line 1668 of file civetweb.c.
const char * mg_get_header | ( | const struct mg_connection * | conn, |
const char * | name | ||
) |
Definition at line 3800 of file civetweb.c.
const char * mg_get_option | ( | const struct mg_context * | ctx, |
const char * | name | ||
) |
Definition at line 3136 of file civetweb.c.
const struct mg_request_info * mg_get_request_info | ( | const struct mg_connection * | conn | ) |
Definition at line 3486 of file civetweb.c.
int mg_get_request_link | ( | const struct mg_connection * | conn, |
char * | buf, | ||
size_t | buflen | ||
) |
Definition at line 3687 of file civetweb.c.
int mg_get_response | ( | struct mg_connection * | conn, |
char * | ebuf, | ||
size_t | ebuf_len, | ||
int | timeout | ||
) |
Definition at line 17946 of file civetweb.c.
const char * mg_get_response_code_text | ( | const struct mg_connection * | conn, |
int | response_code | ||
) |
Definition at line 4150 of file civetweb.c.
const struct mg_response_info * mg_get_response_info | ( | const struct mg_connection * | conn | ) |
Definition at line 3526 of file civetweb.c.
int mg_get_server_ports | ( | const struct mg_context * | ctx, |
int | size, | ||
struct mg_server_port * | ports | ||
) |
Definition at line 3211 of file civetweb.c.
Definition at line 20545 of file civetweb.c.
void * mg_get_thread_pointer | ( | const struct mg_connection * | conn | ) |
Definition at line 3172 of file civetweb.c.
void * mg_get_user_connection_data | ( | const struct mg_connection * | conn | ) |
Definition at line 3201 of file civetweb.c.
void * mg_get_user_context_data | ( | const struct mg_connection * | conn | ) |
Definition at line 3165 of file civetweb.c.
void * mg_get_user_data | ( | const struct mg_context * | ctx | ) |
Definition at line 3158 of file civetweb.c.
const struct mg_option * mg_get_valid_options | ( | void | ) |
Definition at line 2796 of file civetweb.c.
int mg_get_var | ( | const char * | data, |
size_t | data_len, | ||
const char * | name, | ||
char * | dst, | ||
size_t | dst_len | ||
) |
Definition at line 6989 of file civetweb.c.
int mg_get_var2 | ( | const char * | data, |
size_t | data_len, | ||
const char * | name, | ||
char * | dst, | ||
size_t | dst_len, | ||
size_t | occurrence | ||
) |
Definition at line 7000 of file civetweb.c.
|
static |
Definition at line 1091 of file civetweb.c.
|
static |
Definition at line 1099 of file civetweb.c.
|
static |
Definition at line 8952 of file civetweb.c.
unsigned mg_init_library | ( | unsigned | features | ) |
Definition at line 21340 of file civetweb.c.
|
static |
Definition at line 5726 of file civetweb.c.
void mg_lock_connection | ( | struct mg_connection * | conn | ) |
Definition at line 12281 of file civetweb.c.
void mg_lock_context | ( | struct mg_context * | ctx | ) |
Definition at line 12297 of file civetweb.c.
|
static |
Definition at line 1471 of file civetweb.c.
char * mg_md5 | ( | char | buf[33], |
... | |||
) |
Definition at line 8206 of file civetweb.c.
int mg_modify_passwords_file | ( | const char * | fname, |
const char * | domain, | ||
const char * | user, | ||
const char * | pass | ||
) |
Definition at line 8925 of file civetweb.c.
int mg_modify_passwords_file_ha1 | ( | const char * | fname, |
const char * | domain, | ||
const char * | user, | ||
const char * | ha1 | ||
) |
Definition at line 8935 of file civetweb.c.
|
static |
Definition at line 2834 of file civetweb.c.
|
static |
Definition at line 5907 of file civetweb.c.
int mg_printf | ( | struct mg_connection * | conn, |
const char * | fmt, | ||
... | |||
) |
Definition at line 6935 of file civetweb.c.
int mg_read | ( | struct mg_connection * | conn, |
void * | buf, | ||
size_t | len | ||
) |
Definition at line 6586 of file civetweb.c.
|
static |
Definition at line 6467 of file civetweb.c.
|
static |
Definition at line 1483 of file civetweb.c.
int mg_send_chunk | ( | struct mg_connection * | conn, |
const char * | chunk, | ||
unsigned int | chunk_len | ||
) |
Definition at line 6775 of file civetweb.c.
int mg_send_digest_access_authentication_request | ( | struct mg_connection * | conn, |
const char * | realm | ||
) |
Definition at line 8771 of file civetweb.c.
void mg_send_file | ( | struct mg_connection * | conn, |
const char * | path | ||
) |
Definition at line 10192 of file civetweb.c.
int mg_send_file_body | ( | struct mg_connection * | conn, |
const char * | path | ||
) |
Definition at line 10133 of file civetweb.c.
int mg_send_http_error | ( | struct mg_connection * | conn, |
int | status, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 4535 of file civetweb.c.
|
static |
Definition at line 4349 of file civetweb.c.
int mg_send_http_ok | ( | struct mg_connection * | conn, |
const char * | mime_type, | ||
long long | content_length | ||
) |
Definition at line 4549 of file civetweb.c.
int mg_send_http_redirect | ( | struct mg_connection * | conn, |
const char * | target_url, | ||
int | redirect_code | ||
) |
Definition at line 4590 of file civetweb.c.
void mg_send_mime_file | ( | struct mg_connection * | conn, |
const char * | path, | ||
const char * | mime_type | ||
) |
Definition at line 10199 of file civetweb.c.
void mg_send_mime_file2 | ( | struct mg_connection * | conn, |
const char * | path, | ||
const char * | mime_type, | ||
const char * | additional_headers | ||
) |
Definition at line 10208 of file civetweb.c.
void mg_set_auth_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_authorization_handler | handler, | ||
void * | cbdata | ||
) |
Definition at line 13821 of file civetweb.c.
|
static |
Definition at line 13563 of file civetweb.c.
void mg_set_request_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_request_handler | handler, | ||
void * | cbdata | ||
) |
Definition at line 13749 of file civetweb.c.
|
static |
Definition at line 2743 of file civetweb.c.
void mg_set_user_connection_data | ( | const struct mg_connection * | const_conn, |
void * | data | ||
) |
Definition at line 3188 of file civetweb.c.
void mg_set_websocket_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_websocket_connect_handler | connect_handler, | ||
mg_websocket_ready_handler | ready_handler, | ||
mg_websocket_data_handler | data_handler, | ||
mg_websocket_close_handler | close_handler, | ||
void * | cbdata | ||
) |
Definition at line 13771 of file civetweb.c.
void mg_set_websocket_handler_with_subprotocols | ( | struct mg_context * | ctx, |
const char * | uri, | ||
struct mg_websocket_subprotocols * | subprotocols, | ||
mg_websocket_connect_handler | connect_handler, | ||
mg_websocket_ready_handler | ready_handler, | ||
mg_websocket_data_handler | data_handler, | ||
mg_websocket_close_handler | close_handler, | ||
void * | cbdata | ||
) |
Definition at line 13791 of file civetweb.c.
|
static |
Definition at line 3106 of file civetweb.c.
int mg_split_form_urlencoded | ( | char * | data, |
struct mg_header * | form_fields, | ||
unsigned | num_form_fields | ||
) |
Definition at line 7058 of file civetweb.c.
struct mg_context * mg_start | ( | const struct mg_callbacks * | callbacks, |
void * | user_data, | ||
const char ** | options | ||
) |
Definition at line 20251 of file civetweb.c.
struct mg_context * mg_start2 | ( | struct mg_init_data * | init, |
struct mg_error_data * | error | ||
) |
Definition at line 19579 of file civetweb.c.
int mg_start_domain | ( | struct mg_context * | ctx, |
const char ** | options | ||
) |
Definition at line 20455 of file civetweb.c.
int mg_start_domain2 | ( | struct mg_context * | ctx, |
const char ** | options, | ||
struct mg_error_data * | error | ||
) |
Definition at line 20266 of file civetweb.c.
int mg_start_thread | ( | mg_thread_func_t | func, |
void * | param | ||
) |
Definition at line 5669 of file civetweb.c.
|
static |
Definition at line 5695 of file civetweb.c.
|
static |
Definition at line 5619 of file civetweb.c.
void mg_stop | ( | struct mg_context * | ctx | ) |
Definition at line 19460 of file civetweb.c.
long long mg_store_body | ( | struct mg_connection * | conn, |
const char * | path | ||
) |
Definition at line 10304 of file civetweb.c.
|
static |
Definition at line 20526 of file civetweb.c.
int mg_strcasecmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Definition at line 2997 of file civetweb.c.
|
static |
Definition at line 3038 of file civetweb.c.
|
static |
Definition at line 3031 of file civetweb.c.
|
static |
Definition at line 3025 of file civetweb.c.
|
static |
Definition at line 2965 of file civetweb.c.
int mg_strncasecmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | len | ||
) |
Definition at line 2982 of file civetweb.c.
|
static |
Definition at line 3010 of file civetweb.c.
void mg_unlock_connection | ( | struct mg_connection * | conn | ) |
Definition at line 12289 of file civetweb.c.
void mg_unlock_context | ( | struct mg_context * | ctx | ) |
Definition at line 12305 of file civetweb.c.
int mg_url_decode | ( | const char * | src, |
int | src_len, | ||
char * | dst, | ||
int | dst_len, | ||
int | is_form_url_encoded | ||
) |
Definition at line 6949 of file civetweb.c.
int mg_url_encode | ( | const char * | src, |
char * | dst, | ||
size_t | dst_len | ||
) |
Definition at line 9260 of file civetweb.c.
const char * mg_version | ( | void | ) |
Definition at line 3479 of file civetweb.c.
|
static |
Definition at line 6917 of file civetweb.c.
|
static |
Definition at line 3057 of file civetweb.c.
int mg_write | ( | struct mg_connection * | conn, |
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 6694 of file civetweb.c.
|
static |
Definition at line 11588 of file civetweb.c.
|
static |
Definition at line 8805 of file civetweb.c.
|
static |
Definition at line 9434 of file civetweb.c.
Definition at line 3844 of file civetweb.c.
|
static |
Definition at line 8274 of file civetweb.c.
|
static |
Definition at line 8354 of file civetweb.c.
|
static |
Definition at line 7807 of file civetweb.c.
Definition at line 10407 of file civetweb.c.
|
static |
Definition at line 10592 of file civetweb.c.
|
static |
Definition at line 10678 of file civetweb.c.
Definition at line 13249 of file civetweb.c.
|
static |
Definition at line 14689 of file civetweb.c.
|
static |
Definition at line 9831 of file civetweb.c.
|
static |
Definition at line 11032 of file civetweb.c.
Definition at line 12222 of file civetweb.c.
Definition at line 9288 of file civetweb.c.
|
static |
Definition at line 12165 of file civetweb.c.
|
static |
Definition at line 18483 of file civetweb.c.
|
static |
Definition at line 18776 of file civetweb.c.
|
static |
Definition at line 6412 of file civetweb.c.
|
static |
Definition at line 6183 of file civetweb.c.
|
static |
Definition at line 6135 of file civetweb.c.
|
static |
Definition at line 5969 of file civetweb.c.
|
static |
Definition at line 10254 of file civetweb.c.
|
static |
Definition at line 11657 of file civetweb.c.
|
static |
Definition at line 8504 of file civetweb.c.
|
static |
Definition at line 10785 of file civetweb.c.
|
static |
Definition at line 13518 of file civetweb.c.
|
static |
Definition at line 15557 of file civetweb.c.
|
static |
Definition at line 13970 of file civetweb.c.
|
static |
Definition at line 10291 of file civetweb.c.
|
static |
Definition at line 9508 of file civetweb.c.
|
static |
Definition at line 7871 of file civetweb.c.
|
static |
Definition at line 16856 of file civetweb.c.
|
static |
Definition at line 9448 of file civetweb.c.
|
static |
Definition at line 4116 of file civetweb.c.
|
static |
Definition at line 8723 of file civetweb.c.
|
static |
Definition at line 9727 of file civetweb.c.
|
static |
Definition at line 4050 of file civetweb.c.
|
static |
Definition at line 12134 of file civetweb.c.
|
static |
Definition at line 11971 of file civetweb.c.
|
static |
Definition at line 4068 of file civetweb.c.
|
static |
Definition at line 16842 of file civetweb.c.
Definition at line 5859 of file civetweb.c.
|
static |
Definition at line 5646 of file civetweb.c.
|
static |
Definition at line 16816 of file civetweb.c.
Definition at line 5845 of file civetweb.c.
|
static |
Definition at line 14924 of file civetweb.c.
Definition at line 16898 of file civetweb.c.
Definition at line 13358 of file civetweb.c.
|
static |
Definition at line 15447 of file civetweb.c.
|
static |
Definition at line 4028 of file civetweb.c.
|
static |
Definition at line 4017 of file civetweb.c.
|
static |
Definition at line 3978 of file civetweb.c.
|
static |
Definition at line 13205 of file civetweb.c.
|
static |
Definition at line 3699 of file civetweb.c.
Definition at line 10362 of file civetweb.c.
|
static |
Definition at line 3255 of file civetweb.c.
|
static |
Definition at line 5737 of file civetweb.c.
|
static |
Definition at line 15765 of file civetweb.c.
|
static |
Definition at line 15800 of file civetweb.c.
|
static |
Definition at line 16197 of file civetweb.c.
Definition at line 16230 of file civetweb.c.
Definition at line 15877 of file civetweb.c.
Definition at line 16246 of file civetweb.c.
|
static |
Definition at line 16120 of file civetweb.c.
|
static |
Definition at line 15635 of file civetweb.c.
|
static |
Definition at line 7388 of file civetweb.c.
|
static |
Definition at line 4040 of file civetweb.c.
|
static |
Definition at line 13457 of file civetweb.c.
|
static |
Definition at line 15501 of file civetweb.c.
|
static |
Definition at line 16774 of file civetweb.c.
|
static |
Definition at line 6981 of file civetweb.c.
|
static |
Definition at line 19052 of file civetweb.c.
|
static |
Definition at line 18819 of file civetweb.c.
const struct { ... } abs_uri_protocols[] |
const struct { ... } builtin_mime_types[] |
|
static |
Definition at line 2049 of file civetweb.c.
|
static |
Definition at line 15986 of file civetweb.c.
|
static |
Definition at line 15995 of file civetweb.c.
unsigned default_port |
Definition at line 17504 of file civetweb.c.
size_t ext_len |
Definition at line 8025 of file civetweb.c.
const char* extension |
Definition at line 8024 of file civetweb.c.
|
static |
Definition at line 1086 of file civetweb.c.
|
static |
Definition at line 10495 of file civetweb.c.
|
static |
Definition at line 1549 of file civetweb.c.
const char* mime_type |
Definition at line 8026 of file civetweb.c.
|
static |
Definition at line 1807 of file civetweb.c.
const char* proto |
Definition at line 17502 of file civetweb.c.
size_t proto_len |
Definition at line 17503 of file civetweb.c.
|
static |
Definition at line 1071 of file civetweb.c.
|
static |
Definition at line 15631 of file civetweb.c.
|
static |
Definition at line 15985 of file civetweb.c.
char static_assert_replacement |
Definition at line 123 of file civetweb.c.
|
static |
Definition at line 1572 of file civetweb.c.
|
static |
Definition at line 1573 of file civetweb.c.