Logo ROOT  
Reference Guide
civetweb.c File Reference
#include "civetweb.h"
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <arpa/inet.h>
#include <inttypes.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <dirent.h>
#include <grp.h>
#include <pwd.h>
#include <unistd.h>
#include <dlfcn.h>
#include <pthread.h>
#include "md5.inl"
#include "handle_form.inl"
Include dependency graph for civetweb.c:

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 ALTERNATIVE_QUEUE
 
#define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
 
#define ASN1_INTEGER_to_BN    (*(BIGNUM * (*)(const ASN1_INTEGER *ai, BIGNUM *bn)) crypto_sw[21].ptr)
 
#define BN_bn2hex   (*(char *(*)(const BIGNUM *a))crypto_sw[20].ptr)
 
#define BN_free   (*(void (*)(const BIGNUM *a))crypto_sw[22].ptr)
 
#define calloc   DO_NOT_USE_THIS_FUNCTION__USE_mg_calloc
 
#define CGI_ENVIRONMENT_SIZE   (4096) /* in bytes */
 
#define closesocket(a)   (close(a))
 
#define CONF_modules_unload   (*(void (*)(int))crypto_sw[8].ptr)
 
#define CRYPTO_cleanup_all_ex_data   (*(void (*)(void))crypto_sw[9].ptr)
 
#define CRYPTO_free   (*(void (*)(void *addr))crypto_sw[23].ptr)
 
#define CRYPTO_LIB   "libcrypto.so"
 
#define CRYPTO_num_locks   (*(int (*)(void))crypto_sw[0].ptr)
 
#define CRYPTO_set_id_callback    (*(void (*)(unsigned long (*)(void)))crypto_sw[2].ptr)
 
#define CRYPTO_set_locking_callback    (*(void (*)(void (*)(int, int, const char *, int)))crypto_sw[1].ptr)
 
#define DEBUG_ASSERT(cond)
 
#define DEBUG_TRACE(fmt, ...)
 
#define ENGINE_cleanup   (*(void (*)(void))crypto_sw[7].ptr)
 
#define ERR_error_string   (*(char *(*)(unsigned long, char *))crypto_sw[4].ptr)
 
#define ERR_free_strings   (*(void (*)(void))crypto_sw[6].ptr)
 
#define ERR_get_error   (*(unsigned long (*)(void))crypto_sw[3].ptr)
 
#define ERR_remove_state   (*(void (*)(unsigned long))crypto_sw[5].ptr)
 
#define ERRNO   (errno)
 
#define EVP_cleanup   (*(void (*)(void))crypto_sw[10].ptr)
 
#define EVP_Digest
 
#define EVP_get_digestbyname    (*(const EVP_MD *(*)(const char *))crypto_sw[17].ptr)
 
#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 i2c_ASN1_INTEGER    (*(int (*)(ASN1_INTEGER *, unsigned char **))crypto_sw[16].ptr)
 
#define i2d_X509   (*(int (*)(X509 *, unsigned char **))crypto_sw[19].ptr)
 
#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 is_websocket_protocol(conn)   (0)
 
#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_internal(conn, fmt, ...)    mg_cry_internal_wrap(conn, __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_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 MGSQLEN   (20) /* count */
 
#define MSG_NOSIGNAL   (0)
 
#define O_BINARY   (0)
 
#define OPENSSL_free(a)   CRYPTO_free(a)
 
#define OPENSSL_INIT_LOAD_CRYPTO_STRINGS   0x00000002L
 
#define OPENSSL_INIT_LOAD_SSL_STRINGS   0x00200000L
 
#define OPENSSL_INIT_NO_LOAD_SSL_STRINGS   0x00100000L
 
#define OPENSSL_REMOVE_THREAD_STATE()   ERR_remove_state(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 SOMAXCONN   (100) /* in pending connections (count) */
 
#define SSL_accept   (*(int (*)(SSL *))ssl_sw[1].ptr)
 
#define SSL_CB_HANDSHAKE_DONE   (0x20)
 
#define SSL_CB_HANDSHAKE_START   (0x10)
 
#define SSL_CIPHER_get_name    (*(const char *(*)(const SSL_CIPHER *))ssl_sw[27].ptr)
 
#define SSL_connect   (*(int (*)(SSL *))ssl_sw[2].ptr)
 
#define SSL_ctrl   (*(long (*)(SSL *, int, long, void *))ssl_sw[38].ptr)
 
#define SSL_CTRL_CLEAR_OPTIONS   (77)
 
#define SSL_CTRL_OPTIONS   (32)
 
#define SSL_CTRL_SET_ECDH_AUTO   (94)
 
#define SSL_CTRL_SET_TLSEXT_HOSTNAME   55
 
#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG   54
 
#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB   53
 
#define SSL_CTX_callback_ctrl    (*(long (*)(SSL_CTX *, int, void (*)(void)))ssl_sw[35].ptr)
 
#define SSL_CTX_check_private_key   (*(int (*)(SSL_CTX *))ssl_sw[28].ptr)
 
#define SSL_CTX_clear_options(ctx, op)    SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_OPTIONS, (op), NULL)
 
#define SSL_CTX_ctrl   (*(long (*)(SSL_CTX *, int, long, void *))ssl_sw[30].ptr)
 
#define SSL_CTX_free   (*(void (*)(SSL_CTX *))ssl_sw[14].ptr)
 
#define SSL_CTX_load_verify_locations    (*(int (*)(SSL_CTX *, const char *, const char *))ssl_sw[21].ptr)
 
#define SSL_CTX_new   (*(SSL_CTX * (*)(SSL_METHOD *)) ssl_sw[8].ptr)
 
#define SSL_CTX_set_cipher_list    (*(int (*)(SSL_CTX *, const char *))ssl_sw[31].ptr)
 
#define SSL_CTX_set_default_passwd_cb    (*(void (*)(SSL_CTX *, mg_callback_t))ssl_sw[13].ptr)
 
#define SSL_CTX_set_default_verify_paths   (*(int (*)(SSL_CTX *))ssl_sw[22].ptr)
 
#define SSL_CTX_set_ecdh_auto(ctx, onoff)    SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff, NULL)
 
#define SSL_CTX_set_info_callback
 
#define SSL_CTX_set_options(ctx, op)    SSL_CTX_ctrl((ctx), SSL_CTRL_OPTIONS, (op), NULL)
 
#define SSL_CTX_set_session_id_context    (*(int (*)(SSL_CTX *, const unsigned char *, unsigned int))ssl_sw[29].ptr)
 
#define SSL_CTX_set_tlsext_servername_arg(ctx, arg)    SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG, 0, (void *)arg)
 
#define SSL_CTX_set_tlsext_servername_callback(ctx, cb)
 
#define SSL_CTX_set_verify
 
#define SSL_CTX_set_verify_depth   (*(void (*)(SSL_CTX *, int))ssl_sw[23].ptr)
 
#define SSL_CTX_use_certificate_chain_file    (*(int (*)(SSL_CTX *, const char *))ssl_sw[16].ptr)
 
#define SSL_CTX_use_certificate_file    (*(int (*)(SSL_CTX *, const char *, int))ssl_sw[12].ptr)
 
#define SSL_CTX_use_PrivateKey_file    (*(int (*)(SSL_CTX *, const char *, int))ssl_sw[11].ptr)
 
#define SSL_ERROR_NONE   (0)
 
#define SSL_ERROR_SSL   (1)
 
#define SSL_ERROR_SYSCALL   (5) /* see errno */
 
#define SSL_ERROR_WANT_ACCEPT   (8)
 
#define SSL_ERROR_WANT_CONNECT   (7)
 
#define SSL_ERROR_WANT_READ   (2)
 
#define SSL_ERROR_WANT_WRITE   (3)
 
#define SSL_ERROR_WANT_X509_LOOKUP   (4)
 
#define SSL_ERROR_ZERO_RETURN   (6)
 
#define SSL_free   (*(void (*)(SSL *))ssl_sw[0].ptr)
 
#define SSL_get_app_data(s)   (SSL_get_ex_data(s, 0))
 
#define SSL_get_current_cipher   (*(SSL_CIPHER * (*)(SSL *)) ssl_sw[26].ptr)
 
#define SSL_get_error   (*(int (*)(SSL *, int))ssl_sw[5].ptr)
 
#define SSL_get_ex_data   (*(char *(*)(const SSL *, int))ssl_sw[33].ptr)
 
#define SSL_get_peer_certificate   (*(X509 * (*)(SSL *)) ssl_sw[24].ptr)
 
#define SSL_get_servername    (*(const char *(*)(const SSL *, int type))ssl_sw[36].ptr)
 
#define SSL_get_version   (*(const char *(*)(SSL *))ssl_sw[25].ptr)
 
#define SSL_LIB   "libssl.so"
 
#define SSL_library_init   (*(int (*)(void))ssl_sw[10].ptr)
 
#define SSL_load_error_strings   (*(void (*)(void))ssl_sw[15].ptr)
 
#define SSL_new   (*(SSL * (*)(SSL_CTX *)) ssl_sw[7].ptr)
 
#define SSL_OP_ALL   ((long)(0x80000BFFUL))
 
#define SSL_OP_CIPHER_SERVER_PREFERENCE   (0x00400000L)
 
#define SSL_OP_NO_COMPRESSION   (0x00020000L)
 
#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION   (0x00010000L)
 
#define SSL_OP_NO_SSLv2   (0x01000000L)
 
#define SSL_OP_NO_SSLv3   (0x02000000L)
 
#define SSL_OP_NO_TLSv1   (0x04000000L)
 
#define SSL_OP_NO_TLSv1_1   (0x10000000L)
 
#define SSL_OP_NO_TLSv1_2   (0x08000000L)
 
#define SSL_OP_SINGLE_DH_USE   (0x00100000L)
 
#define SSL_pending   (*(int (*)(SSL *))ssl_sw[18].ptr)
 
#define SSL_read   (*(int (*)(SSL *, void *, int))ssl_sw[3].ptr)
 
#define SSL_set_app_data(s, arg)   (SSL_set_ex_data(s, 0, (char *)arg))
 
#define SSL_set_ex_data   (*(void (*)(SSL *, int, char *))ssl_sw[34].ptr)
 
#define SSL_set_fd   (*(int (*)(SSL *, SOCKET))ssl_sw[6].ptr)
 
#define SSL_set_SSL_CTX   (*(SSL_CTX * (*)(SSL *, SSL_CTX *)) ssl_sw[37].ptr)
 
#define SSL_set_tlsext_host_name(ctx, arg)    SSL_ctrl(ctx, SSL_CTRL_SET_TLSEXT_HOSTNAME, 0, (void *)arg)
 
#define SSL_shutdown   (*(int (*)(SSL *))ssl_sw[20].ptr)
 
#define SSL_TLSEXT_ERR_ALERT_FATAL   (2)
 
#define SSL_TLSEXT_ERR_ALERT_WARNING   (1)
 
#define SSL_TLSEXT_ERR_NOACK   (3)
 
#define SSL_TLSEXT_ERR_OK   (0)
 
#define SSL_VERIFY_CLIENT_ONCE   (4)
 
#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT   (2)
 
#define SSL_VERIFY_NONE   (0)
 
#define SSL_VERIFY_PEER   (1)
 
#define SSL_write   (*(int (*)(SSL *, const void *, int))ssl_sw[4].ptr)
 
#define SSLv23_client_method   (*(SSL_METHOD * (*)(void)) ssl_sw[17].ptr)
 
#define SSLv23_server_method   (*(SSL_METHOD * (*)(void)) ssl_sw[9].ptr)
 
#define strcat0(a, b)
 
#define STRUCT_FILE_INITIALIZER
 
#define TLSEXT_NAMETYPE_host_name   (0)
 
#define TLSEXT_TYPE_server_name   (0)
 
#define UINT64_FMT   PRIu64
 
#define va_copy(x, y)   ((x) = (y))
 
#define vsnprintf_impl   vsnprintf
 
#define WIN32_LEAN_AND_MEAN
 
#define WINCDECL
 
#define X509_free   (*(void (*)(X509 *))crypto_sw[11].ptr)
 
#define X509_get_issuer_name   (*(X509_NAME * (*)(X509 *)) crypto_sw[13].ptr)
 
#define X509_get_notAfter(x)   ((x)->cert_info->validity->notAfter)
 
#define X509_get_notBefore(x)   ((x)->cert_info->validity->notBefore)
 
#define X509_get_serialNumber   (*(ASN1_INTEGER * (*)(X509 *)) crypto_sw[15].ptr)
 
#define X509_get_subject_name   (*(X509_NAME * (*)(X509 *)) crypto_sw[12].ptr)
 
#define X509_NAME_oneline    (*(char *(*)(X509_NAME *, char *, int))crypto_sw[14].ptr)
 

Typedefs

typedef struct asn1_integer ASN1_INTEGER
 
typedef struct bignum BIGNUM
 
typedef struct evp_md EVP_MD
 
typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS
 
typedef const voidSOCK_OPT_TYPE
 
typedef int SOCKET
 
typedef struct ssl_st SSL
 
typedef struct ssl_ctx_st SSL_CTX
 
typedef struct ssl_method_st SSL_METHOD
 
typedef struct x509 X509
 
typedef struct x509_name X509_NAME
 
typedef struct x509_store_ctx_st X509_STORE_CTX
 

Enumerations

enum  {
  LISTENING_PORTS , NUM_THREADS , RUN_AS_USER , CONFIG_TCP_NODELAY ,
  MAX_REQUEST_SIZE , LINGER_TIMEOUT , THROTTLE , ACCESS_LOG_FILE ,
  ERROR_LOG_FILE , ENABLE_KEEP_ALIVE , REQUEST_TIMEOUT , KEEP_ALIVE_TIMEOUT ,
  DECODE_URL , DOCUMENT_ROOT , CGI_EXTENSIONS , CGI_ENVIRONMENT ,
  PUT_DELETE_PASSWORDS_FILE , CGI_INTERPRETER , PROTECT_URI , AUTHENTICATION_DOMAIN ,
  ENABLE_AUTH_DOMAIN_CHECK , SSI_EXTENSIONS , ENABLE_DIRECTORY_LISTING , GLOBAL_PASSWORDS_FILE ,
  INDEX_FILES , ACCESS_CONTROL_LIST , EXTRA_MIME_TYPES , SSL_CERTIFICATE ,
  SSL_CERTIFICATE_CHAIN , URL_REWRITE_PATTERN , HIDE_FILES , SSL_DO_VERIFY_PEER ,
  SSL_CA_PATH , SSL_CA_FILE , SSL_VERIFY_DEPTH , SSL_DEFAULT_VERIFY_PATHS ,
  SSL_CIPHER_LIST , SSL_PROTOCOL_VERSION , SSL_SHORT_TRUST , ACCESS_CONTROL_ALLOW_ORIGIN ,
  ACCESS_CONTROL_ALLOW_METHODS , ACCESS_CONTROL_ALLOW_HEADERS , ERROR_PAGES , STATIC_FILE_MAX_AGE ,
  STRICT_HTTPS_MAX_AGE , ADDITIONAL_HEADER , ALLOW_INDEX_SCRIPT_SUB_RES , NUM_OPTIONS
}
 
enum  { REQUEST_HANDLER , WEBSOCKET_HANDLER , AUTH_HANDLER }
 
enum  { CONTEXT_INVALID , CONTEXT_SERVER , CONTEXT_HTTP_CLIENT , CONTEXT_WS_CLIENT }
 
enum  { CONNECTION_TYPE_INVALID , CONNECTION_TYPE_REQUEST , CONNECTION_TYPE_RESPONSE }
 

Functions

static int abort_process (void *data)
 
static void accept_new_connection (const struct socket *listener, struct mg_context *ctx)
 
static void static void addenv (struct cgi_environment *env, const char *fmt,...)
 
static void addenv (struct cgi_environment *env, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2
 
static const char * alloc_get_host (struct mg_connection *conn)
 
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, uint32_t remote_ip)
 
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 WINCDECL 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 voidevent_create (void)
 
static void event_destroy (void *eventhdl)
 
static int event_signal (void *eventhdl)
 
static int event_wait (void *eventhdl)
 
static int extention_matches_script (struct mg_connection *conn, const char *filename)
 
static 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 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 uint32_t get_remote_ip (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)
 
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 *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 void handler_info_acquire (struct mg_handler_info *handler_info)
 
static void handler_info_release (struct mg_handler_info *handler_info)
 
static void handler_info_wait_unused (struct mg_handler_info *handler_info)
 
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_ssl (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)
 
static int is_authorized_for_put (struct mg_connection *conn)
 
static int is_file_in_memory (const struct mg_connection *conn, const char *path)
 
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 int isbyte (int n)
 
static voidload_dll (char *ebuf, size_t ebuf_len, const char *dll_name, struct ssl_func *sw)
 
static void log_access (const struct mg_connection *conn)
 
static int lowercase (const char *s)
 
static voidmaster_thread (void *thread_func_param)
 
static void master_thread_run (void *thread_func_param)
 
static ptrdiff_t match_prefix (const char *pattern, size_t pattern_len, const char *str)
 
static FUNCTION_MAY_BE_UNUSED int mg_atomic_dec (volatile int *addr)
 
static FUNCTION_MAY_BE_UNUSED int mg_atomic_inc (volatile int *addr)
 
static __inline voidmg_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)
 
CIVETWEB_API 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)
 
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, const char *func, unsigned line, const char *fmt,...) PRINTF_ARGS(4
 
static FUNCTION_MAY_BE_UNUSED unsigned long mg_current_thread_id (void)
 
static double mg_difftimespec (const struct timespec *ts_now, const struct timespec *ts_before)
 
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, int offset)
 
static const char * mg_fgets (char *buf, size_t size, struct mg_file *filep, char **p)
 
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 FUNCTION_MAY_BE_UNUSED 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_infomg_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_infomg_get_response_info (const struct mg_connection *conn)
 
int mg_get_server_ports (const struct mg_context *ctx, int size, struct mg_server_ports *ports)
 
int mg_get_system_info (char *buffer, int buflen)
 
static int mg_get_system_info_impl (char *buffer, int buflen)
 
voidmg_get_user_connection_data (const struct mg_connection *conn)
 
voidmg_get_user_data (const struct mg_context *ctx)
 
const struct mg_optionmg_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 char mg_getc (struct mg_connection *conn)
 
static FUNCTION_MAY_BE_UNUSED void mg_global_lock (void)
 
static FUNCTION_MAY_BE_UNUSED void mg_global_unlock (void)
 
static int mg_inet_pton (int af, const char *src, void *dst, size_t dstlen)
 
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 voidmg_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)
 
static int mg_poll (struct pollfd *pfd, unsigned int n, int milliseconds, volatile int *stop_server)
 
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 voidmg_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_request_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 (struct mg_connection *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,...)
 
static void mg_snprintf (const struct mg_connection *conn, int *truncated, char *buf, size_t buflen, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(5
 
struct mg_context * mg_start (const struct mg_callbacks *callbacks, void *user_data, const char **options)
 
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)
 
 mg_static_assert ((sizeof(config_options)/sizeof(config_options[0]))==(NUM_OPTIONS+1), "config_options and enum not sync")
 
 mg_static_assert (MAX_WORKER_THREADS >=1, "worker threads must be a positive number")
 
 mg_static_assert (sizeof(int)==4||sizeof(int)==8, "int data type size check")
 
 mg_static_assert (sizeof(size_t)==4||sizeof(size_t)==8, "size_t data type size check")
 
 mg_static_assert (sizeof(void *) >=sizeof(int), "data type size check")
 
 mg_static_assert (sizeof(void *)==4||sizeof(void *)==8, "pointer data type size check")
 
void mg_stop (struct mg_context *ctx)
 
long long mg_store_body (struct mg_connection *conn, const char *path)
 
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 (register char *dst, register 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 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 open_file_in_memory (const struct mg_connection *conn, const char *path, struct mg_file *filep, int mode)
 
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[MG_MAX_HEADERS])
 
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_net (const char *spec, uint32_t *net, uint32_t *mask)
 
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)
 
static int print_dav_dir_entry (struct de *de, void *data)
 
static int print_dir_entry (struct de *de)
 
static void print_props (struct mg_connection *conn, const char *uri, 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 int64_t push_all (struct mg_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t 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 voidrealloc2 (void *ptr, size_t size)
 
static void redirect_to_https_port (struct mg_connection *conn, int ssl_index)
 
static int refresh_trust (struct mg_connection *conn)
 
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_double_dots_and_double_slashes (char *s)
 
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 int 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 int 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 int 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 (SOCKET fd, struct mg_connection *conn)
 
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 (SOCKET sock, int nodelay_on)
 
static int set_throttle (const char *spec, uint32_t remote_ip, const char *uri)
 
static int set_uid_option (struct mg_context *phys_ctx)
 
static int should_decode_url (const struct mg_connection *conn)
 
static int should_keep_alive (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)
 
static const char * ssl_error (void)
 
static void ssl_get_client_cert_info (struct mg_connection *conn)
 
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, SSL_CTX *s, int(*func)(SSL *), volatile int *stop_server, 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 void tls_dtor (void *key)
 
static void uninitialize_ssl (void)
 
static voidworker_thread (void *thread_func_param)
 
static voidworker_thread_run (struct worker_thread_args *thread_args)
 

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 struct mg_context common_client_context
 
static const struct mg_option config_options []
 
static struct ssl_func crypto_sw []
 
static voidcryptolib_dll_handle
 
static int cryptolib_users = 0
 
static pthread_mutex_t global_lock_mutex
 
static struct mg_http_method_info http_methods []
 
static int mg_init_library_called = 0
 
static int mg_ssl_initialized = 0
 
static const char * month_names []
 
static pthread_mutexattr_t pthread_mutex_attr
 
static pthread_mutex_t * ssl_mutexes
 
static struct ssl_func ssl_sw []
 
static voidssllib_dll_handle
 
char static_assert_replacement [1]
 
static pthread_key_t sTlsKey
 
static int thread_idx_max = 0
 

Macro Definition Documentation

◆ __STDC_FORMAT_MACROS

#define __STDC_FORMAT_MACROS   /* <inttypes.h> wants this for C++ */

Definition at line 69 of file civetweb.c.

◆ __STDC_LIMIT_MACROS

#define __STDC_LIMIT_MACROS   /* C++ wants that for INT64_MAX */

Definition at line 72 of file civetweb.c.

◆ _DARWIN_UNLIMITED_SELECT

#define _DARWIN_UNLIMITED_SELECT

Definition at line 75 of file civetweb.c.

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64 /* Use 64-bit file offsets by default */

Definition at line 66 of file civetweb.c.

◆ _GNU_SOURCE

#define _GNU_SOURCE   /* for setgroups(), pthread_setname_np() */

Definition at line 57 of file civetweb.c.

◆ _LARGEFILE_SOURCE

#define _LARGEFILE_SOURCE   /* For fseeko(), ftello() */

Definition at line 63 of file civetweb.c.

◆ ALTERNATIVE_QUEUE

#define ALTERNATIVE_QUEUE

Definition at line 137 of file civetweb.c.

◆ ARRAY_SIZE

#define ARRAY_SIZE (   array)    (sizeof(array) / sizeof(array[0]))

Definition at line 435 of file civetweb.c.

◆ ASN1_INTEGER_to_BN

#define ASN1_INTEGER_to_BN    (*(BIGNUM * (*)(const ASN1_INTEGER *ai, BIGNUM *bn)) crypto_sw[21].ptr)

Definition at line 2111 of file civetweb.c.

◆ BN_bn2hex

#define BN_bn2hex   (*(char *(*)(const BIGNUM *a))crypto_sw[20].ptr)

Definition at line 2110 of file civetweb.c.

◆ BN_free

#define BN_free   (*(void (*)(const BIGNUM *a))crypto_sw[22].ptr)

Definition at line 2113 of file civetweb.c.

◆ calloc

#define calloc   DO_NOT_USE_THIS_FUNCTION__USE_mg_calloc

Definition at line 1537 of file civetweb.c.

◆ CGI_ENVIRONMENT_SIZE

#define CGI_ENVIRONMENT_SIZE   (4096) /* in bytes */

Definition at line 412 of file civetweb.c.

◆ closesocket

#define closesocket (   a)    (close(a))

Definition at line 801 of file civetweb.c.

◆ CONF_modules_unload

#define CONF_modules_unload   (*(void (*)(int))crypto_sw[8].ptr)

Definition at line 2091 of file civetweb.c.

◆ CRYPTO_cleanup_all_ex_data

#define CRYPTO_cleanup_all_ex_data   (*(void (*)(void))crypto_sw[9].ptr)

Definition at line 2092 of file civetweb.c.

◆ CRYPTO_free

#define CRYPTO_free   (*(void (*)(void *addr))crypto_sw[23].ptr)

Definition at line 2114 of file civetweb.c.

◆ CRYPTO_LIB

#define CRYPTO_LIB   "libcrypto.so"

Definition at line 795 of file civetweb.c.

◆ CRYPTO_num_locks

#define CRYPTO_num_locks   (*(int (*)(void))crypto_sw[0].ptr)

Definition at line 2081 of file civetweb.c.

◆ CRYPTO_set_id_callback

#define CRYPTO_set_id_callback    (*(void (*)(unsigned long (*)(void)))crypto_sw[2].ptr)

Definition at line 2084 of file civetweb.c.

◆ CRYPTO_set_locking_callback

#define CRYPTO_set_locking_callback    (*(void (*)(void (*)(int, int, const char *, int)))crypto_sw[1].ptr)

Definition at line 2082 of file civetweb.c.

◆ DEBUG_ASSERT

#define DEBUG_ASSERT (   cond)

Definition at line 195 of file civetweb.c.

◆ DEBUG_TRACE

#define DEBUG_TRACE (   fmt,
  ... 
)
Value:
do { \
} while (0)

Definition at line 178 of file civetweb.c.

◆ ENGINE_cleanup

#define ENGINE_cleanup   (*(void (*)(void))crypto_sw[7].ptr)

Definition at line 2090 of file civetweb.c.

◆ ERR_error_string

#define ERR_error_string   (*(char *(*)(unsigned long, char *))crypto_sw[4].ptr)

Definition at line 2087 of file civetweb.c.

◆ ERR_free_strings

#define ERR_free_strings   (*(void (*)(void))crypto_sw[6].ptr)

Definition at line 2089 of file civetweb.c.

◆ ERR_get_error

#define ERR_get_error   (*(unsigned long (*)(void))crypto_sw[3].ptr)

Definition at line 2086 of file civetweb.c.

◆ ERR_remove_state

#define ERR_remove_state   (*(void (*)(unsigned long))crypto_sw[5].ptr)

Definition at line 2088 of file civetweb.c.

◆ ERRNO

#define ERRNO   (errno)

Definition at line 808 of file civetweb.c.

◆ EVP_cleanup

#define EVP_cleanup   (*(void (*)(void))crypto_sw[10].ptr)

Definition at line 2093 of file civetweb.c.

◆ EVP_Digest

#define EVP_Digest
Value:
(*(int (*)( \
const void *, size_t, void *, unsigned int *, const EVP_MD *, void *)) \
crypto_sw[18] \
.ptr)
struct evp_md EVP_MD
Definition: civetweb.c:1768

Definition at line 2104 of file civetweb.c.

◆ EVP_get_digestbyname

#define EVP_get_digestbyname    (*(const EVP_MD *(*)(const char *))crypto_sw[17].ptr)

Definition at line 2102 of file civetweb.c.

◆ free

#define free   DO_NOT_USE_THIS_FUNCTION__USE_mg_free

Definition at line 1539 of file civetweb.c.

◆ FUNCTION_MAY_BE_UNUSED

#define FUNCTION_MAY_BE_UNUSED

Definition at line 251 of file civetweb.c.

◆ HEXTOI

#define HEXTOI (   x)    (isdigit(x) ? (x - '0') : (x - 'W'))

◆ i2c_ASN1_INTEGER

#define i2c_ASN1_INTEGER    (*(int (*)(ASN1_INTEGER *, unsigned char **))crypto_sw[16].ptr)

Definition at line 2100 of file civetweb.c.

◆ i2d_X509

#define i2d_X509   (*(int (*)(X509 *, unsigned char **))crypto_sw[19].ptr)

Definition at line 2109 of file civetweb.c.

◆ IGNORE_UNUSED_RESULT

#define IGNORE_UNUSED_RESULT (   a)    ((void)((a) && 1))

Definition at line 226 of file civetweb.c.

◆ INITIAL_DEPTH

#define INITIAL_DEPTH   9

Definition at line 8272 of file civetweb.c.

◆ INT64_FMT

#define INT64_FMT   PRId64

Definition at line 810 of file civetweb.c.

◆ INT64_MAX

#define INT64_MAX   (9223372036854775807)

Definition at line 439 of file civetweb.c.

◆ INVALID_SOCKET

#define INVALID_SOCKET   (-1)

Definition at line 809 of file civetweb.c.

◆ IP_ADDR_STR_LEN

#define IP_ADDR_STR_LEN   (50) /* IPv6 hex string is 46 chars */

Definition at line 1714 of file civetweb.c.

◆ is_websocket_protocol

#define is_websocket_protocol (   conn)    (0)

Definition at line 2770 of file civetweb.c.

◆ malloc

#define malloc   DO_NOT_USE_THIS_FUNCTION__USE_mg_malloc

Definition at line 1536 of file civetweb.c.

◆ MAX_CGI_ENVIR_VARS

#define MAX_CGI_ENVIR_VARS   (256) /* in variables (count) */

Definition at line 417 of file civetweb.c.

◆ MAX_WORKER_THREADS

#define MAX_WORKER_THREADS   (1024 * 64) /* in threads (count) */

Definition at line 389 of file civetweb.c.

◆ MD5_STATIC

#define MD5_STATIC   static

Definition at line 1706 of file civetweb.c.

◆ MG_BUF_LEN

#define MG_BUF_LEN   (1024 * 8)

Definition at line 422 of file civetweb.c.

◆ mg_calloc_ctx

#define mg_calloc_ctx (   a,
  b,
  c 
)    mg_calloc(a, b)

Definition at line 1495 of file civetweb.c.

◆ mg_closedir

#define mg_closedir (   x)    (closedir(x))

Definition at line 806 of file civetweb.c.

◆ mg_cry

#define mg_cry   DO_NOT_USE_THIS_FUNCTION__USE_mg_cry_internal

Definition at line 3722 of file civetweb.c.

◆ mg_cry_internal

#define mg_cry_internal (   conn,
  fmt,
  ... 
)     mg_cry_internal_wrap(conn, __func__, __LINE__, fmt, __VA_ARGS__)

Definition at line 2774 of file civetweb.c.

◆ MG_FILE_COMPRESSION_SIZE_LIMIT

#define MG_FILE_COMPRESSION_SIZE_LIMIT   (1024) /* in bytes */

Definition at line 402 of file civetweb.c.

◆ MG_FOPEN_MODE_APPEND

#define MG_FOPEN_MODE_APPEND   (4)

Definition at line 3045 of file civetweb.c.

◆ MG_FOPEN_MODE_NONE

#define MG_FOPEN_MODE_NONE   (0)

Definition at line 3036 of file civetweb.c.

◆ MG_FOPEN_MODE_READ

#define MG_FOPEN_MODE_READ   (1)

Definition at line 3039 of file civetweb.c.

◆ MG_FOPEN_MODE_WRITE

#define MG_FOPEN_MODE_WRITE   (2)

Definition at line 3042 of file civetweb.c.

◆ mg_free_ctx

#define mg_free_ctx (   a,
  c 
)    mg_free(a)

Definition at line 1497 of file civetweb.c.

◆ mg_get_option

#define mg_get_option   DO_NOT_USE_THIS_FUNCTION_INTERNALLY__access_directly

Definition at line 3433 of file civetweb.c.

◆ mg_malloc_ctx

#define mg_malloc_ctx (   a,
  c 
)    mg_malloc(a)

Definition at line 1494 of file civetweb.c.

◆ mg_mkdir

#define mg_mkdir (   conn,
  path,
  mode 
)    (mkdir(path, mode))

Definition at line 802 of file civetweb.c.

◆ mg_opendir

#define mg_opendir (   conn,
  x 
)    (opendir(x))

Definition at line 805 of file civetweb.c.

◆ mg_readdir

#define mg_readdir (   x)    (readdir(x))

Definition at line 807 of file civetweb.c.

◆ mg_realloc_ctx

#define mg_realloc_ctx (   a,
  b,
  c 
)    mg_realloc(a, b)

Definition at line 1496 of file civetweb.c.

◆ mg_remove

#define mg_remove (   conn,
  x 
)    (remove(x))

Definition at line 803 of file civetweb.c.

◆ mg_sleep

#define mg_sleep (   x)    (usleep((x)*1000))

Definition at line 804 of file civetweb.c.

◆ mg_static_assert

#define mg_static_assert (   cond,
  txt 
)     extern char static_assert_replacement[(cond) ? 1 : -1]

Definition at line 120 of file civetweb.c.

◆ MGSQLEN

#define MGSQLEN   (20) /* count */

Definition at line 428 of file civetweb.c.

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   (0)

Definition at line 1717 of file civetweb.c.

◆ O_BINARY

#define O_BINARY   (0)

Definition at line 799 of file civetweb.c.

◆ OPENSSL_free

#define OPENSSL_free (   a)    CRYPTO_free(a)

Definition at line 2116 of file civetweb.c.

◆ OPENSSL_INIT_LOAD_CRYPTO_STRINGS

#define OPENSSL_INIT_LOAD_CRYPTO_STRINGS   0x00000002L

Definition at line 1778 of file civetweb.c.

◆ OPENSSL_INIT_LOAD_SSL_STRINGS

#define OPENSSL_INIT_LOAD_SSL_STRINGS   0x00200000L

Definition at line 1777 of file civetweb.c.

◆ OPENSSL_INIT_NO_LOAD_SSL_STRINGS

#define OPENSSL_INIT_NO_LOAD_SSL_STRINGS   0x00100000L

Definition at line 1776 of file civetweb.c.

◆ OPENSSL_REMOVE_THREAD_STATE

#define OPENSSL_REMOVE_THREAD_STATE ( )    ERR_remove_state(0)

Definition at line 2121 of file civetweb.c.

◆ PASSWORDS_FILE_NAME

#define PASSWORDS_FILE_NAME   ".htpasswd"

Definition at line 406 of file civetweb.c.

◆ realloc

#define realloc   DO_NOT_USE_THIS_FUNCTION__USE_mg_realloc

Definition at line 1538 of file civetweb.c.

◆ SHUTDOWN_BOTH

#define SHUTDOWN_BOTH   (2)

Definition at line 444 of file civetweb.c.

◆ SHUTDOWN_RD

#define SHUTDOWN_RD   (0)

Definition at line 442 of file civetweb.c.

◆ SHUTDOWN_WR

#define SHUTDOWN_WR   (1)

Definition at line 443 of file civetweb.c.

◆ snprintf

#define snprintf   DO_NOT_USE_THIS_FUNCTION__USE_mg_snprintf

Definition at line 1540 of file civetweb.c.

◆ SOCKET_TIMEOUT_QUANTUM

#define SOCKET_TIMEOUT_QUANTUM   (2000) /* in ms */

Definition at line 397 of file civetweb.c.

◆ SOMAXCONN

#define SOMAXCONN   (100) /* in pending connections (count) */

Definition at line 838 of file civetweb.c.

◆ SSL_accept

#define SSL_accept   (*(int (*)(SSL *))ssl_sw[1].ptr)

Definition at line 2001 of file civetweb.c.

◆ SSL_CB_HANDSHAKE_DONE

#define SSL_CB_HANDSHAKE_DONE   (0x20)

Definition at line 1796 of file civetweb.c.

◆ SSL_CB_HANDSHAKE_START

#define SSL_CB_HANDSHAKE_START   (0x10)

Definition at line 1795 of file civetweb.c.

◆ SSL_CIPHER_get_name

#define SSL_CIPHER_get_name    (*(const char *(*)(const SSL_CIPHER *))ssl_sw[27].ptr)

Definition at line 2036 of file civetweb.c.

◆ SSL_connect

#define SSL_connect   (*(int (*)(SSL *))ssl_sw[2].ptr)

Definition at line 2002 of file civetweb.c.

◆ SSL_ctrl

#define SSL_ctrl   (*(long (*)(SSL *, int, long, void *))ssl_sw[38].ptr)

Definition at line 2054 of file civetweb.c.

◆ SSL_CTRL_CLEAR_OPTIONS

#define SSL_CTRL_CLEAR_OPTIONS   (77)

Definition at line 1773 of file civetweb.c.

◆ SSL_CTRL_OPTIONS

#define SSL_CTRL_OPTIONS   (32)

Definition at line 1772 of file civetweb.c.

◆ SSL_CTRL_SET_ECDH_AUTO

#define SSL_CTRL_SET_ECDH_AUTO   (94)

Definition at line 1774 of file civetweb.c.

◆ SSL_CTRL_SET_TLSEXT_HOSTNAME

#define SSL_CTRL_SET_TLSEXT_HOSTNAME   55

Definition at line 2065 of file civetweb.c.

◆ SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG

#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG   54

Definition at line 2064 of file civetweb.c.

◆ SSL_CTRL_SET_TLSEXT_SERVERNAME_CB

#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB   53

Definition at line 2063 of file civetweb.c.

◆ SSL_CTX_callback_ctrl

#define SSL_CTX_callback_ctrl    (*(long (*)(SSL_CTX *, int, void (*)(void)))ssl_sw[35].ptr)

Definition at line 2049 of file civetweb.c.

◆ SSL_CTX_check_private_key

#define SSL_CTX_check_private_key   (*(int (*)(SSL_CTX *))ssl_sw[28].ptr)

Definition at line 2038 of file civetweb.c.

◆ SSL_CTX_clear_options

#define SSL_CTX_clear_options (   ctx,
  op 
)     SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_OPTIONS, (op), NULL)

Definition at line 2058 of file civetweb.c.

◆ SSL_CTX_ctrl

#define SSL_CTX_ctrl   (*(long (*)(SSL_CTX *, int, long, void *))ssl_sw[30].ptr)

Definition at line 2041 of file civetweb.c.

◆ SSL_CTX_free

#define SSL_CTX_free   (*(void (*)(SSL_CTX *))ssl_sw[14].ptr)

Definition at line 2017 of file civetweb.c.

◆ SSL_CTX_load_verify_locations

#define SSL_CTX_load_verify_locations    (*(int (*)(SSL_CTX *, const char *, const char *))ssl_sw[21].ptr)

Definition at line 2029 of file civetweb.c.

◆ SSL_CTX_new

#define SSL_CTX_new   (*(SSL_CTX * (*)(SSL_METHOD *)) ssl_sw[8].ptr)

Definition at line 2008 of file civetweb.c.

◆ SSL_CTX_set_cipher_list

#define SSL_CTX_set_cipher_list    (*(int (*)(SSL_CTX *, const char *))ssl_sw[31].ptr)

Definition at line 2042 of file civetweb.c.

◆ SSL_CTX_set_default_passwd_cb

#define SSL_CTX_set_default_passwd_cb    (*(void (*)(SSL_CTX *, mg_callback_t))ssl_sw[13].ptr)

Definition at line 2015 of file civetweb.c.

◆ SSL_CTX_set_default_verify_paths

#define SSL_CTX_set_default_verify_paths   (*(int (*)(SSL_CTX *))ssl_sw[22].ptr)

Definition at line 2031 of file civetweb.c.

◆ SSL_CTX_set_ecdh_auto

#define SSL_CTX_set_ecdh_auto (   ctx,
  onoff 
)     SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff, NULL)

Definition at line 2060 of file civetweb.c.

◆ SSL_CTX_set_info_callback

#define SSL_CTX_set_info_callback
Value:
(*(void (*)(SSL_CTX *, void (*callback)(const SSL *, int, int)))ssl_sw[32] \
.ptr)
typedef void((*Func_t)())
struct ssl_ctx_st SSL_CTX
Definition: civetweb.c:1762
struct ssl_st SSL
Definition: civetweb.c:1760
static struct ssl_func ssl_sw[]
Definition: civetweb.c:2127

Definition at line 2044 of file civetweb.c.

◆ SSL_CTX_set_options

#define SSL_CTX_set_options (   ctx,
  op 
)     SSL_CTX_ctrl((ctx), SSL_CTRL_OPTIONS, (op), NULL)

Definition at line 2056 of file civetweb.c.

◆ SSL_CTX_set_session_id_context

#define SSL_CTX_set_session_id_context    (*(int (*)(SSL_CTX *, const unsigned char *, unsigned int))ssl_sw[29].ptr)

Definition at line 2039 of file civetweb.c.

◆ SSL_CTX_set_tlsext_servername_arg

#define SSL_CTX_set_tlsext_servername_arg (   ctx,
  arg 
)     SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG, 0, (void *)arg)

Definition at line 2070 of file civetweb.c.

◆ SSL_CTX_set_tlsext_servername_callback

#define SSL_CTX_set_tlsext_servername_callback (   ctx,
  cb 
)
Value:
(void (*)(void))cb)
#define SSL_CTX_callback_ctrl
Definition: civetweb.c:2049
#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
Definition: civetweb.c:2063

Definition at line 2066 of file civetweb.c.

◆ SSL_CTX_set_verify

#define SSL_CTX_set_verify
Value:
(*(void (*)(SSL_CTX *, \
int, \
int (*verify_callback)(int, X509_STORE_CTX *)))ssl_sw[19] \
.ptr)
struct x509_store_ctx_st X509_STORE_CTX
Definition: civetweb.c:1763

Definition at line 2023 of file civetweb.c.

◆ SSL_CTX_set_verify_depth

#define SSL_CTX_set_verify_depth   (*(void (*)(SSL_CTX *, int))ssl_sw[23].ptr)

Definition at line 2032 of file civetweb.c.

◆ SSL_CTX_use_certificate_chain_file

#define SSL_CTX_use_certificate_chain_file    (*(int (*)(SSL_CTX *, const char *))ssl_sw[16].ptr)

Definition at line 2019 of file civetweb.c.

◆ SSL_CTX_use_certificate_file

#define SSL_CTX_use_certificate_file    (*(int (*)(SSL_CTX *, const char *, int))ssl_sw[12].ptr)

Definition at line 2013 of file civetweb.c.

◆ SSL_CTX_use_PrivateKey_file

#define SSL_CTX_use_PrivateKey_file    (*(int (*)(SSL_CTX *, const char *, int))ssl_sw[11].ptr)

Definition at line 2011 of file civetweb.c.

◆ SSL_ERROR_NONE

#define SSL_ERROR_NONE   (0)

Definition at line 1798 of file civetweb.c.

◆ SSL_ERROR_SSL

#define SSL_ERROR_SSL   (1)

Definition at line 1799 of file civetweb.c.

◆ SSL_ERROR_SYSCALL

#define SSL_ERROR_SYSCALL   (5) /* see errno */

Definition at line 1803 of file civetweb.c.

◆ SSL_ERROR_WANT_ACCEPT

#define SSL_ERROR_WANT_ACCEPT   (8)

Definition at line 1806 of file civetweb.c.

◆ SSL_ERROR_WANT_CONNECT

#define SSL_ERROR_WANT_CONNECT   (7)

Definition at line 1805 of file civetweb.c.

◆ SSL_ERROR_WANT_READ

#define SSL_ERROR_WANT_READ   (2)

Definition at line 1800 of file civetweb.c.

◆ SSL_ERROR_WANT_WRITE

#define SSL_ERROR_WANT_WRITE   (3)

Definition at line 1801 of file civetweb.c.

◆ SSL_ERROR_WANT_X509_LOOKUP

#define SSL_ERROR_WANT_X509_LOOKUP   (4)

Definition at line 1802 of file civetweb.c.

◆ SSL_ERROR_ZERO_RETURN

#define SSL_ERROR_ZERO_RETURN   (6)

Definition at line 1804 of file civetweb.c.

◆ SSL_free

#define SSL_free   (*(void (*)(SSL *))ssl_sw[0].ptr)

Definition at line 2000 of file civetweb.c.

◆ SSL_get_app_data

#define SSL_get_app_data (   s)    (SSL_get_ex_data(s, 0))

Definition at line 2079 of file civetweb.c.

◆ SSL_get_current_cipher

#define SSL_get_current_cipher   (*(SSL_CIPHER * (*)(SSL *)) ssl_sw[26].ptr)

Definition at line 2035 of file civetweb.c.

◆ SSL_get_error

#define SSL_get_error   (*(int (*)(SSL *, int))ssl_sw[5].ptr)

Definition at line 2005 of file civetweb.c.

◆ SSL_get_ex_data

#define SSL_get_ex_data   (*(char *(*)(const SSL *, int))ssl_sw[33].ptr)

Definition at line 2047 of file civetweb.c.

◆ SSL_get_peer_certificate

#define SSL_get_peer_certificate   (*(X509 * (*)(SSL *)) ssl_sw[24].ptr)

Definition at line 2033 of file civetweb.c.

◆ SSL_get_servername

#define SSL_get_servername    (*(const char *(*)(const SSL *, int type))ssl_sw[36].ptr)

Definition at line 2051 of file civetweb.c.

◆ SSL_get_version

#define SSL_get_version   (*(const char *(*)(SSL *))ssl_sw[25].ptr)

Definition at line 2034 of file civetweb.c.

◆ SSL_LIB

#define SSL_LIB   "libssl.so"

Definition at line 792 of file civetweb.c.

◆ SSL_library_init

#define SSL_library_init   (*(int (*)(void))ssl_sw[10].ptr)

Definition at line 2010 of file civetweb.c.

◆ SSL_load_error_strings

#define SSL_load_error_strings   (*(void (*)(void))ssl_sw[15].ptr)

Definition at line 2018 of file civetweb.c.

◆ SSL_new

#define SSL_new   (*(SSL * (*)(SSL_CTX *)) ssl_sw[7].ptr)

Definition at line 2007 of file civetweb.c.

◆ SSL_OP_ALL

#define SSL_OP_ALL   ((long)(0x80000BFFUL))

Definition at line 1784 of file civetweb.c.

◆ SSL_OP_CIPHER_SERVER_PREFERENCE

#define SSL_OP_CIPHER_SERVER_PREFERENCE   (0x00400000L)

Definition at line 1791 of file civetweb.c.

◆ SSL_OP_NO_COMPRESSION

#define SSL_OP_NO_COMPRESSION   (0x00020000L)

Definition at line 1793 of file civetweb.c.

◆ SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION

#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION   (0x00010000L)

Definition at line 1792 of file civetweb.c.

◆ SSL_OP_NO_SSLv2

#define SSL_OP_NO_SSLv2   (0x01000000L)

Definition at line 1785 of file civetweb.c.

◆ SSL_OP_NO_SSLv3

#define SSL_OP_NO_SSLv3   (0x02000000L)

Definition at line 1786 of file civetweb.c.

◆ SSL_OP_NO_TLSv1

#define SSL_OP_NO_TLSv1   (0x04000000L)

Definition at line 1787 of file civetweb.c.

◆ SSL_OP_NO_TLSv1_1

#define SSL_OP_NO_TLSv1_1   (0x10000000L)

Definition at line 1789 of file civetweb.c.

◆ SSL_OP_NO_TLSv1_2

#define SSL_OP_NO_TLSv1_2   (0x08000000L)

Definition at line 1788 of file civetweb.c.

◆ SSL_OP_SINGLE_DH_USE

#define SSL_OP_SINGLE_DH_USE   (0x00100000L)

Definition at line 1790 of file civetweb.c.

◆ SSL_pending

#define SSL_pending   (*(int (*)(SSL *))ssl_sw[18].ptr)

Definition at line 2022 of file civetweb.c.

◆ SSL_read

#define SSL_read   (*(int (*)(SSL *, void *, int))ssl_sw[3].ptr)

Definition at line 2003 of file civetweb.c.

◆ SSL_set_app_data

#define SSL_set_app_data (   s,
  arg 
)    (SSL_set_ex_data(s, 0, (char *)arg))

Definition at line 2078 of file civetweb.c.

◆ SSL_set_ex_data

#define SSL_set_ex_data   (*(void (*)(SSL *, int, char *))ssl_sw[34].ptr)

Definition at line 2048 of file civetweb.c.

◆ SSL_set_fd

#define SSL_set_fd   (*(int (*)(SSL *, SOCKET))ssl_sw[6].ptr)

Definition at line 2006 of file civetweb.c.

◆ SSL_set_SSL_CTX

#define SSL_set_SSL_CTX   (*(SSL_CTX * (*)(SSL *, SSL_CTX *)) ssl_sw[37].ptr)

Definition at line 2053 of file civetweb.c.

◆ SSL_set_tlsext_host_name

#define SSL_set_tlsext_host_name (   ctx,
  arg 
)     SSL_ctrl(ctx, SSL_CTRL_SET_TLSEXT_HOSTNAME, 0, (void *)arg)

Definition at line 2072 of file civetweb.c.

◆ SSL_shutdown

#define SSL_shutdown   (*(int (*)(SSL *))ssl_sw[20].ptr)

Definition at line 2028 of file civetweb.c.

◆ SSL_TLSEXT_ERR_ALERT_FATAL

#define SSL_TLSEXT_ERR_ALERT_FATAL   (2)

Definition at line 1812 of file civetweb.c.

◆ SSL_TLSEXT_ERR_ALERT_WARNING

#define SSL_TLSEXT_ERR_ALERT_WARNING   (1)

Definition at line 1811 of file civetweb.c.

◆ SSL_TLSEXT_ERR_NOACK

#define SSL_TLSEXT_ERR_NOACK   (3)

Definition at line 1813 of file civetweb.c.

◆ SSL_TLSEXT_ERR_OK

#define SSL_TLSEXT_ERR_OK   (0)

Definition at line 1810 of file civetweb.c.

◆ SSL_VERIFY_CLIENT_ONCE

#define SSL_VERIFY_CLIENT_ONCE   (4)

Definition at line 1783 of file civetweb.c.

◆ SSL_VERIFY_FAIL_IF_NO_PEER_CERT

#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT   (2)

Definition at line 1782 of file civetweb.c.

◆ SSL_VERIFY_NONE

#define SSL_VERIFY_NONE   (0)

Definition at line 1780 of file civetweb.c.

◆ SSL_VERIFY_PEER

#define SSL_VERIFY_PEER   (1)

Definition at line 1781 of file civetweb.c.

◆ SSL_write

#define SSL_write   (*(int (*)(SSL *, const void *, int))ssl_sw[4].ptr)

Definition at line 2004 of file civetweb.c.

◆ SSLv23_client_method

#define SSLv23_client_method   (*(SSL_METHOD * (*)(void)) ssl_sw[17].ptr)

Definition at line 2021 of file civetweb.c.

◆ SSLv23_server_method

#define SSLv23_server_method   (*(SSL_METHOD * (*)(void)) ssl_sw[9].ptr)

Definition at line 2009 of file civetweb.c.

◆ strcat0

#define strcat0 (   a,
  b 
)
Value:
{ \
if ((a != NULL) && (b != NULL)) { \
strcat(a, b); \
} \
}
#define b(i)
Definition: RSha256.hxx:100
auto * a
Definition: textangle.C:12

Definition at line 18865 of file civetweb.c.

◆ STRUCT_FILE_INITIALIZER

#define STRUCT_FILE_INITIALIZER
Value:
{ \
{(uint64_t)0, (time_t)0, 0, 0, 0}, \
{ \
(FILE *)NULL \
} \
}

Definition at line 2279 of file civetweb.c.

◆ TLSEXT_NAMETYPE_host_name

#define TLSEXT_NAMETYPE_host_name   (0)

Definition at line 1809 of file civetweb.c.

◆ TLSEXT_TYPE_server_name

#define TLSEXT_TYPE_server_name   (0)

Definition at line 1808 of file civetweb.c.

◆ UINT64_FMT

#define UINT64_FMT   PRIu64

Definition at line 811 of file civetweb.c.

◆ va_copy

#define va_copy (   x,
  y 
)    ((x) = (y))

Definition at line 892 of file civetweb.c.

◆ vsnprintf_impl

#define vsnprintf_impl   vsnprintf

Definition at line 781 of file civetweb.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 143 of file civetweb.c.

◆ WINCDECL

#define WINCDECL

Definition at line 813 of file civetweb.c.

◆ X509_free

#define X509_free   (*(void (*)(X509 *))crypto_sw[11].ptr)

Definition at line 2094 of file civetweb.c.

◆ X509_get_issuer_name

#define X509_get_issuer_name   (*(X509_NAME * (*)(X509 *)) crypto_sw[13].ptr)

Definition at line 2096 of file civetweb.c.

◆ X509_get_notAfter

#define X509_get_notAfter (   x)    ((x)->cert_info->validity->notAfter)

Definition at line 2076 of file civetweb.c.

◆ X509_get_notBefore

#define X509_get_notBefore (   x)    ((x)->cert_info->validity->notBefore)

Definition at line 2075 of file civetweb.c.

◆ X509_get_serialNumber

#define X509_get_serialNumber   (*(ASN1_INTEGER * (*)(X509 *)) crypto_sw[15].ptr)

Definition at line 2099 of file civetweb.c.

◆ X509_get_subject_name

#define X509_get_subject_name   (*(X509_NAME * (*)(X509 *)) crypto_sw[12].ptr)

Definition at line 2095 of file civetweb.c.

◆ X509_NAME_oneline

#define X509_NAME_oneline    (*(char *(*)(X509_NAME *, char *, int))crypto_sw[14].ptr)

Definition at line 2097 of file civetweb.c.

Typedef Documentation

◆ ASN1_INTEGER

typedef struct asn1_integer ASN1_INTEGER

Definition at line 1765 of file civetweb.c.

◆ BIGNUM

typedef struct bignum BIGNUM

Definition at line 1766 of file civetweb.c.

◆ EVP_MD

typedef struct evp_md EVP_MD

Definition at line 1768 of file civetweb.c.

◆ OPENSSL_INIT_SETTINGS

typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS

Definition at line 1767 of file civetweb.c.

◆ SOCK_OPT_TYPE

typedef const void* SOCK_OPT_TYPE

Definition at line 771 of file civetweb.c.

◆ SOCKET

typedef int SOCKET

Definition at line 812 of file civetweb.c.

◆ SSL

typedef struct ssl_st SSL

Definition at line 1760 of file civetweb.c.

◆ SSL_CTX

typedef struct ssl_ctx_st SSL_CTX

Definition at line 1762 of file civetweb.c.

◆ SSL_METHOD

typedef struct ssl_method_st SSL_METHOD

Definition at line 1761 of file civetweb.c.

◆ X509

typedef struct x509 X509

Definition at line 1769 of file civetweb.c.

◆ X509_NAME

typedef struct x509_name X509_NAME

Definition at line 1764 of file civetweb.c.

◆ X509_STORE_CTX

typedef struct x509_store_ctx_st X509_STORE_CTX

Definition at line 1763 of file civetweb.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LISTENING_PORTS 
NUM_THREADS 
RUN_AS_USER 
CONFIG_TCP_NODELAY 
MAX_REQUEST_SIZE 
LINGER_TIMEOUT 
THROTTLE 
ACCESS_LOG_FILE 
ERROR_LOG_FILE 
ENABLE_KEEP_ALIVE 
REQUEST_TIMEOUT 
KEEP_ALIVE_TIMEOUT 
DECODE_URL 
DOCUMENT_ROOT 
CGI_EXTENSIONS 
CGI_ENVIRONMENT 
PUT_DELETE_PASSWORDS_FILE 
CGI_INTERPRETER 
PROTECT_URI 
AUTHENTICATION_DOMAIN 
ENABLE_AUTH_DOMAIN_CHECK 
SSI_EXTENSIONS 
ENABLE_DIRECTORY_LISTING 
GLOBAL_PASSWORDS_FILE 
INDEX_FILES 
ACCESS_CONTROL_LIST 
EXTRA_MIME_TYPES 
SSL_CERTIFICATE 
SSL_CERTIFICATE_CHAIN 
URL_REWRITE_PATTERN 
HIDE_FILES 
SSL_DO_VERIFY_PEER 
SSL_CA_PATH 
SSL_CA_FILE 
SSL_VERIFY_DEPTH 
SSL_DEFAULT_VERIFY_PATHS 
SSL_CIPHER_LIST 
SSL_PROTOCOL_VERSION 
SSL_SHORT_TRUST 
ACCESS_CONTROL_ALLOW_ORIGIN 
ACCESS_CONTROL_ALLOW_METHODS 
ACCESS_CONTROL_ALLOW_HEADERS 
ERROR_PAGES 
STATIC_FILE_MAX_AGE 
STRICT_HTTPS_MAX_AGE 
ADDITIONAL_HEADER 
ALLOW_INDEX_SCRIPT_SUB_RES 
NUM_OPTIONS 

Definition at line 2308 of file civetweb.c.

◆ anonymous enum

anonymous enum
Enumerator
REQUEST_HANDLER 
WEBSOCKET_HANDLER 
AUTH_HANDLER 

Definition at line 2524 of file civetweb.c.

◆ anonymous enum

anonymous enum
Enumerator
CONTEXT_INVALID 
CONTEXT_SERVER 
CONTEXT_HTTP_CLIENT 
CONTEXT_WS_CLIENT 

Definition at line 2562 of file civetweb.c.

◆ anonymous enum

anonymous enum
Enumerator
CONNECTION_TYPE_INVALID 
CONNECTION_TYPE_REQUEST 
CONNECTION_TYPE_RESPONSE 

Definition at line 2689 of file civetweb.c.

Function Documentation

◆ abort_process()

static int abort_process ( void data)
static

Definition at line 10895 of file civetweb.c.

◆ accept_new_connection()

static void accept_new_connection ( const struct socket *  listener,
struct mg_context *  ctx 
)
static

Definition at line 17930 of file civetweb.c.

◆ addenv() [1/2]

static void static void addenv ( struct cgi_environment *  env,
const char *  fmt,
  ... 
)
static

Definition at line 10622 of file civetweb.c.

◆ addenv() [2/2]

static void addenv ( struct cgi_environment *  env,
PRINTF_FORMAT_STRING(const char *fmt)  ,
  ... 
)
static

◆ alloc_get_host()

static const char * alloc_get_host ( struct mg_connection *  conn)
static

Definition at line 13012 of file civetweb.c.

◆ alloc_vprintf()

static int alloc_vprintf ( char **  out_buf,
char *  prealloc_buf,
size_t  prealloc_size,
const char *  fmt,
va_list  ap 
)
static

Definition at line 6898 of file civetweb.c.

◆ alloc_vprintf2()

static int alloc_vprintf2 ( char **  buf,
const char *  fmt,
va_list  ap 
)
static

Definition at line 6865 of file civetweb.c.

◆ authorize()

static int authorize ( struct mg_connection *  conn,
struct mg_file *  filep,
const char *  realm 
)
static

Definition at line 8403 of file civetweb.c.

◆ bin2str()

static void bin2str ( char *  to,
const unsigned char *  p,
size_t  len 
)
static

Definition at line 7952 of file civetweb.c.

◆ check_acl()

static int check_acl ( struct mg_context *  phys_ctx,
uint32_t  remote_ip 
)
static

Definition at line 14832 of file civetweb.c.

◆ check_authorization()

static int check_authorization ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 8455 of file civetweb.c.

◆ check_password()

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

Definition at line 7990 of file civetweb.c.

◆ close_all_listening_sockets()

static void close_all_listening_sockets ( struct mg_context *  ctx)
static

Definition at line 14217 of file civetweb.c.

◆ close_connection()

static void close_connection ( struct mg_connection *  conn)
static

Definition at line 16240 of file civetweb.c.

◆ close_socket_gracefully()

static void close_socket_gracefully ( struct mg_connection *  conn)
static

Definition at line 16120 of file civetweb.c.

◆ compare_dir_entries()

static int WINCDECL compare_dir_entries ( const void p1,
const void p2 
)
static

Definition at line 9088 of file civetweb.c.

◆ connect_socket()

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

Definition at line 8736 of file civetweb.c.

◆ construct_etag()

static void construct_etag ( char *  buf,
size_t  buf_len,
const struct mg_file_stat *  filestat 
)
static

Definition at line 9507 of file civetweb.c.

◆ consume_socket()

static int consume_socket ( struct mg_context *  ctx,
struct socket *  sp,
int  thread_index 
)
static

Definition at line 17638 of file civetweb.c.

◆ delete_file()

static void delete_file ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 11505 of file civetweb.c.

◆ dir_scan_callback()

static int dir_scan_callback ( struct de *  de,
void data 
)
static

Definition at line 9281 of file civetweb.c.

◆ discard_unread_request_data()

static void discard_unread_request_data ( struct mg_connection *  conn)
static

Definition at line 6533 of file civetweb.c.

◆ do_ssi_exec()

static void do_ssi_exec ( struct mg_connection *  conn,
char *  tag 
)
static

Definition at line 11661 of file civetweb.c.

◆ do_ssi_include()

static void do_ssi_include ( struct mg_connection *  conn,
const char *  ssi,
char *  tag,
int  include_level 
)
static

Definition at line 11574 of file civetweb.c.

◆ event_create()

static void * event_create ( void  )
static

Definition at line 2905 of file civetweb.c.

◆ event_destroy()

static void event_destroy ( void eventhdl)
static

Definition at line 2950 of file civetweb.c.

◆ event_signal()

static int event_signal ( void eventhdl)
static

Definition at line 2939 of file civetweb.c.

◆ event_wait()

static int event_wait ( void eventhdl)
static

Definition at line 2928 of file civetweb.c.

◆ extention_matches_script()

static int extention_matches_script ( struct mg_connection *  conn,
const char *  filename 
)
static

Definition at line 7254 of file civetweb.c.

◆ fc()

static struct mg_connection * fc ( struct mg_context *  ctx)
static

Definition at line 3728 of file civetweb.c.

◆ fclose_on_exec()

static void fclose_on_exec ( struct mg_file_access *  filep,
struct mg_connection *  conn 
)
static

Definition at line 9522 of file civetweb.c.

◆ forward_body_data()

static int forward_body_data ( struct mg_connection *  conn,
FILE *  fp,
SOCKET  sock,
SSL ssl 
)
static

Definition at line 10480 of file civetweb.c.

◆ free_context()

static void free_context ( struct mg_context *  ctx)
static

Definition at line 18163 of file civetweb.c.

◆ get_first_ssl_listener_index()

static int get_first_ssl_listener_index ( const struct mg_context *  ctx)
static

Definition at line 12996 of file civetweb.c.

◆ get_header()

static const char * get_header ( const struct mg_header hdr,
int  num_hdr,
const char *  name 
)
static

Definition at line 3979 of file civetweb.c.

◆ get_http_header_len()

static int get_http_header_len ( const char *  buf,
int  buflen 
)
static

Definition at line 7646 of file civetweb.c.

◆ get_http_method_info()

static const struct mg_http_method_info * get_http_method_info ( const char *  method)
static

Definition at line 10176 of file civetweb.c.

◆ get_http_version()

static const char * get_http_version ( const struct mg_connection *  conn)
static

Definition at line 4037 of file civetweb.c.

◆ get_message()

static int get_message ( struct mg_connection *  conn,
char *  ebuf,
size_t  ebuf_len,
int *  err 
)
static

Definition at line 16824 of file civetweb.c.

◆ get_mime_type()

static void get_mime_type ( struct mg_connection *  conn,
const char *  path,
struct vec *  vec 
)
static

Definition at line 7917 of file civetweb.c.

◆ get_month_index()

static int get_month_index ( const char *  s)
static

Definition at line 7685 of file civetweb.c.

◆ get_option_index()

static int get_option_index ( const char *  name)
static

Definition at line 3407 of file civetweb.c.

◆ get_proto_name()

static const char * get_proto_name ( const struct mg_connection *  conn)
static

Definition at line 3795 of file civetweb.c.

◆ get_random()

static uint64_t get_random ( void  )
static

Definition at line 6030 of file civetweb.c.

◆ get_rel_url_at_current_server()

static const char * get_rel_url_at_current_server ( const char *  uri,
const struct mg_connection *  conn 
)
static

Definition at line 16710 of file civetweb.c.

◆ get_remote_ip()

static uint32_t get_remote_ip ( const struct mg_connection *  conn)
static

Definition at line 12884 of file civetweb.c.

◆ get_request()

static int get_request ( struct mg_connection *  conn,
char *  ebuf,
size_t  ebuf_len,
int *  err 
)
static

Definition at line 16899 of file civetweb.c.

◆ get_request_handler()

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

Definition at line 13458 of file civetweb.c.

◆ get_response()

static int get_response ( struct mg_connection *  conn,
char *  ebuf,
size_t  ebuf_len,
int *  err 
)
static

Definition at line 16990 of file civetweb.c.

◆ get_system_name()

static void get_system_name ( char **  sysName)
static

Definition at line 18290 of file civetweb.c.

◆ get_uri_type()

static int get_uri_type ( const char *  uri)
static

Definition at line 16621 of file civetweb.c.

◆ gmt_time_string()

static void gmt_time_string ( char *  buf,
size_t  buf_len,
time_t *  t 
)
static

Definition at line 3572 of file civetweb.c.

◆ handle_cgi_request()

static void handle_cgi_request ( struct mg_connection *  conn,
const char *  prog 
)
static

Definition at line 10929 of file civetweb.c.

◆ handle_directory_request()

static void handle_directory_request ( struct mg_connection *  conn,
const char *  dir 
)
static

Definition at line 9306 of file civetweb.c.

◆ handle_file_based_request()

static void handle_file_based_request ( struct mg_connection *  conn,
const char *  path,
struct mg_file *  filep 
)
static

Definition at line 14125 of file civetweb.c.

◆ handle_not_modified_static_file_request()

static void handle_not_modified_static_file_request ( struct mg_connection *  conn,
struct mg_file *  filep 
)
static

Definition at line 9806 of file civetweb.c.

◆ handle_propfind()

static void handle_propfind ( struct mg_connection *  conn,
const char *  path,
struct mg_file_stat *  filep 
)
static

Definition at line 11966 of file civetweb.c.

◆ handle_request()

static void handle_request ( struct mg_connection *  conn)
static

Definition at line 13628 of file civetweb.c.

◆ handle_ssi_file_request()

static void handle_ssi_file_request ( struct mg_connection *  conn,
const char *  path,
struct mg_file *  filep 
)
static

Definition at line 11813 of file civetweb.c.

◆ handle_static_file_request()

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

Definition at line 9545 of file civetweb.c.

◆ handler_info_acquire()

static void handler_info_acquire ( struct mg_handler_info *  handler_info)
static

Definition at line 13150 of file civetweb.c.

◆ handler_info_release()

static void handler_info_release ( struct mg_handler_info *  handler_info)
static

Definition at line 13159 of file civetweb.c.

◆ handler_info_wait_unused()

static void handler_info_wait_unused ( struct mg_handler_info *  handler_info)
static

Definition at line 13169 of file civetweb.c.

◆ header_has_option()

static int header_has_option ( const char *  header,
const char *  option 
)
static

Definition at line 4117 of file civetweb.c.

◆ header_val()

static const char * header_val ( const struct mg_connection *  conn,
const char *  header 
)
static

Definition at line 14715 of file civetweb.c.

◆ hexdump2string()

static int hexdump2string ( void mem,
int  memlen,
char *  buf,
int  buflen 
)
static

Definition at line 15140 of file civetweb.c.

◆ init_connection()

static void init_connection ( struct mg_connection *  conn)
static

Definition at line 17386 of file civetweb.c.

◆ init_ssl_ctx()

static int init_ssl_ctx ( struct mg_context *  phys_ctx,
struct mg_domain_context *  dom_ctx 
)
static

Definition at line 15868 of file civetweb.c.

◆ init_ssl_ctx_impl()

static int init_ssl_ctx_impl ( struct mg_context *  phys_ctx,
struct mg_domain_context *  dom_ctx,
const char *  pem,
const char *  chain 
)
static

Definition at line 15678 of file civetweb.c.

◆ initialize_ssl()

static int initialize_ssl ( char *  ebuf,
size_t  ebuf_len 
)
static

Definition at line 15359 of file civetweb.c.

◆ interpret_uri()

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 
)
static

Definition at line 7344 of file civetweb.c.

◆ is_authorized_for_put()

static int is_authorized_for_put ( struct mg_connection *  conn)
static

Definition at line 8559 of file civetweb.c.

◆ is_file_in_memory()

static int is_file_in_memory ( const struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 3113 of file civetweb.c.

◆ is_file_opened()

static int is_file_opened ( const struct mg_file_access *  fileacc)
static

Definition at line 3120 of file civetweb.c.

◆ is_in_script_path()

static int is_in_script_path ( const struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 13572 of file civetweb.c.

◆ is_not_modified()

static int is_not_modified ( const struct mg_connection *  conn,
const struct mg_file_stat *  filestat 
)
static

Definition at line 9792 of file civetweb.c.

◆ is_put_or_delete_method()

static int is_put_or_delete_method ( const struct mg_connection *  conn)
static

Definition at line 7240 of file civetweb.c.

◆ is_ssl_port_used()

static int is_ssl_port_used ( const char *  ports)
static

Definition at line 14392 of file civetweb.c.

◆ is_valid_http_method()

static int is_valid_http_method ( const char *  method)
static

Definition at line 10195 of file civetweb.c.

◆ is_valid_port()

static int is_valid_port ( unsigned long  port)
static

Definition at line 8692 of file civetweb.c.

◆ isbyte()

static int isbyte ( int  n)
static

Definition at line 12823 of file civetweb.c.

◆ load_dll()

static void * load_dll ( char *  ebuf,
size_t  ebuf_len,
const char *  dll_name,
struct ssl_func *  sw 
)
static

Definition at line 15270 of file civetweb.c.

◆ log_access()

static void log_access ( const struct mg_connection *  conn)
static

Definition at line 14733 of file civetweb.c.

◆ lowercase()

static int lowercase ( const char *  s)
static

Definition at line 3260 of file civetweb.c.

◆ master_thread()

static void * master_thread ( void thread_func_param)
static

Definition at line 18147 of file civetweb.c.

◆ master_thread_run()

static void master_thread_run ( void thread_func_param)
static

Definition at line 18013 of file civetweb.c.

◆ match_prefix()

static ptrdiff_t match_prefix ( const char *  pattern,
size_t  pattern_len,
const char *  str 
)
static

Definition at line 4136 of file civetweb.c.

◆ mg_atomic_dec()

static FUNCTION_MAY_BE_UNUSED int mg_atomic_dec ( volatile int *  addr)
static

Definition at line 1203 of file civetweb.c.

◆ mg_atomic_inc()

static FUNCTION_MAY_BE_UNUSED int mg_atomic_inc ( volatile int *  addr)
static

Definition at line 1180 of file civetweb.c.

◆ mg_calloc()

static __inline void * mg_calloc ( size_t  a,
size_t  b 
)
static

Definition at line 1477 of file civetweb.c.

◆ mg_check_digest_access_authentication()

int mg_check_digest_access_authentication ( struct mg_connection *  conn,
const char *  realm,
const char *  filename 
)

Definition at line 8431 of file civetweb.c.

◆ mg_check_feature()

unsigned mg_check_feature ( unsigned  feature)

Definition at line 18802 of file civetweb.c.

◆ mg_close_connection()

void mg_close_connection ( struct mg_connection *  conn)

Definition at line 16304 of file civetweb.c.

◆ mg_connect_client()

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 16586 of file civetweb.c.

◆ mg_connect_client_impl()

static struct mg_connection * mg_connect_client_impl ( const struct mg_client_options client_options,
int  use_ssl,
char *  ebuf,
size_t  ebuf_len 
)
static

Definition at line 16378 of file civetweb.c.

◆ mg_connect_client_secure()

CIVETWEB_API 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 16574 of file civetweb.c.

◆ mg_connect_websocket_client()

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 17224 of file civetweb.c.

◆ mg_cry()

void mg_cry ( const struct mg_connection *  conn,
const char *  fmt,
  ... 
)

Definition at line 3713 of file civetweb.c.

◆ mg_cry_internal_impl()

static void mg_cry_internal_impl ( const struct mg_connection *  conn,
const char *  func,
unsigned  line,
const char *  fmt,
va_list  ap 
)
static

Definition at line 3614 of file civetweb.c.

◆ mg_cry_internal_wrap()

static void mg_cry_internal_wrap ( const struct mg_connection *  conn,
const char *  func,
unsigned  line,
const char *  fmt,
  ... 
)
static

Definition at line 3699 of file civetweb.c.

◆ mg_current_thread_id()

static FUNCTION_MAY_BE_UNUSED unsigned long mg_current_thread_id ( void  )
static

Definition at line 1599 of file civetweb.c.

◆ mg_difftimespec()

static double mg_difftimespec ( const struct timespec *  ts_now,
const struct timespec *  ts_before 
)
static

Definition at line 3596 of file civetweb.c.

◆ mg_download()

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 17107 of file civetweb.c.

◆ mg_exit_library()

unsigned mg_exit_library ( void  )

Definition at line 19821 of file civetweb.c.

◆ mg_fclose()

static int mg_fclose ( struct mg_file_access *  fileacc)
static

Definition at line 3231 of file civetweb.c.

◆ mg_fgetc()

static int mg_fgetc ( struct mg_file *  filep,
int  offset 
)
static

Definition at line 11685 of file civetweb.c.

◆ mg_fgets()

static const char * mg_fgets ( char *  buf,
size_t  size,
struct mg_file *  filep,
char **  p 
)
static

Definition at line 8227 of file civetweb.c.

◆ mg_fopen()

static int mg_fopen ( const struct mg_connection *  conn,
const char *  path,
int  mode,
struct mg_file *  filep 
)
static

Definition at line 3146 of file civetweb.c.

◆ mg_free()

static __inline void mg_free ( void a)
static

Definition at line 1489 of file civetweb.c.

◆ mg_get_builtin_mime_type()

const char * mg_get_builtin_mime_type ( const char *  path)

Definition at line 7895 of file civetweb.c.

◆ mg_get_context()

struct mg_context * mg_get_context ( const struct mg_connection *  conn)

Definition at line 3436 of file civetweb.c.

◆ mg_get_context_info()

int mg_get_context_info ( const struct mg_context *  ctx,
char *  buffer,
int  buflen 
)

Definition at line 19704 of file civetweb.c.

◆ mg_get_cookie()

int mg_get_cookie ( const char *  cookie_header,
const char *  var_name,
char *  dst,
size_t  dst_size 
)

Definition at line 7093 of file civetweb.c.

◆ mg_get_current_time_ns()

static FUNCTION_MAY_BE_UNUSED uint64_t mg_get_current_time_ns ( void  )
static

Definition at line 1649 of file civetweb.c.

◆ mg_get_header()

const char * mg_get_header ( const struct mg_connection *  conn,
const char *  name 
)

Definition at line 4016 of file civetweb.c.

◆ mg_get_option()

const char * mg_get_option ( const struct mg_context *  ctx,
const char *  name 
)

Definition at line 3421 of file civetweb.c.

◆ mg_get_request_info()

const struct mg_request_info * mg_get_request_info ( const struct mg_connection *  conn)

Definition at line 3745 of file civetweb.c.

◆ mg_get_request_link()

int mg_get_request_link ( const struct mg_connection *  conn,
char *  buf,
size_t  buflen 
)

Definition at line 3822 of file civetweb.c.

◆ mg_get_response()

int mg_get_response ( struct mg_connection *  conn,
char *  ebuf,
size_t  ebuf_len,
int  timeout 
)

Definition at line 17052 of file civetweb.c.

◆ mg_get_response_code_text()

const char * mg_get_response_code_text ( const struct mg_connection *  conn,
int  response_code 
)

Definition at line 4312 of file civetweb.c.

◆ mg_get_response_info()

const struct mg_response_info * mg_get_response_info ( const struct mg_connection *  conn)

Definition at line 3782 of file civetweb.c.

◆ mg_get_server_ports()

int mg_get_server_ports ( const struct mg_context *  ctx,
int  size,
struct mg_server_ports ports 
)

Definition at line 3493 of file civetweb.c.

◆ mg_get_system_info()

int mg_get_system_info ( char *  buffer,
int  buflen 
)

Definition at line 19689 of file civetweb.c.

◆ mg_get_system_info_impl()

static int mg_get_system_info_impl ( char *  buffer,
int  buflen 
)
static

Definition at line 18876 of file civetweb.c.

◆ mg_get_user_connection_data()

void * mg_get_user_connection_data ( const struct mg_connection *  conn)

Definition at line 3459 of file civetweb.c.

◆ mg_get_user_data()

void * mg_get_user_data ( const struct mg_context *  ctx)

Definition at line 3443 of file civetweb.c.

◆ mg_get_valid_options()

const struct mg_option * mg_get_valid_options ( void  )

Definition at line 3029 of file civetweb.c.

◆ mg_get_var()

int mg_get_var ( const char *  data,
size_t  data_len,
const char *  name,
char *  dst,
size_t  dst_len 
)

Definition at line 7024 of file civetweb.c.

◆ mg_get_var2()

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 7035 of file civetweb.c.

◆ mg_getc()

static char mg_getc ( struct mg_connection *  conn)
static

Definition at line 6641 of file civetweb.c.

◆ mg_global_lock()

static FUNCTION_MAY_BE_UNUSED void mg_global_lock ( void  )
static

Definition at line 1164 of file civetweb.c.

◆ mg_global_unlock()

static FUNCTION_MAY_BE_UNUSED void mg_global_unlock ( void  )
static

Definition at line 1172 of file civetweb.c.

◆ mg_inet_pton()

static int mg_inet_pton ( int  af,
const char *  src,
void dst,
size_t  dstlen 
)
static

Definition at line 8699 of file civetweb.c.

◆ mg_init_library()

unsigned mg_init_library ( unsigned  features)

Definition at line 19745 of file civetweb.c.

◆ mg_join_thread()

static int mg_join_thread ( pthread_t  threadid)
static

Definition at line 5892 of file civetweb.c.

◆ mg_lock_connection()

void mg_lock_connection ( struct mg_connection *  conn)

Definition at line 12014 of file civetweb.c.

◆ mg_lock_context()

void mg_lock_context ( struct mg_context *  ctx)

Definition at line 12030 of file civetweb.c.

◆ mg_malloc()

static __inline void * mg_malloc ( size_t  a)
static

Definition at line 1471 of file civetweb.c.

◆ mg_md5()

char * mg_md5 ( char  buf[33],
  ... 
)

Definition at line 7967 of file civetweb.c.

◆ mg_modify_passwords_file()

int mg_modify_passwords_file ( const char *  fname,
const char *  domain,
const char *  user,
const char *  pass 
)

Definition at line 8580 of file civetweb.c.

◆ mg_poll()

static int mg_poll ( struct pollfd *  pfd,
unsigned int  n,
int  milliseconds,
volatile int *  stop_server 
)
static

Definition at line 6059 of file civetweb.c.

◆ mg_printf()

int mg_printf ( struct mg_connection *  conn,
const char *  fmt,
  ... 
)

Definition at line 6979 of file civetweb.c.

◆ mg_read()

int mg_read ( struct mg_connection *  conn,
void buf,
size_t  len 
)

Definition at line 6655 of file civetweb.c.

◆ mg_read_inner()

static int mg_read_inner ( struct mg_connection *  conn,
void buf,
size_t  len 
)
static

Definition at line 6573 of file civetweb.c.

◆ mg_realloc()

static __inline void * mg_realloc ( void a,
size_t  b 
)
static

Definition at line 1483 of file civetweb.c.

◆ mg_send_chunk()

int mg_send_chunk ( struct mg_connection *  conn,
const char *  chunk,
unsigned int  chunk_len 
)

Definition at line 6819 of file civetweb.c.

◆ mg_send_digest_access_authentication_request()

int mg_send_digest_access_authentication_request ( struct mg_connection *  conn,
const char *  realm 
)

Definition at line 8546 of file civetweb.c.

◆ mg_send_file()

void mg_send_file ( struct mg_connection *  conn,
const char *  path 
)

Definition at line 9841 of file civetweb.c.

◆ mg_send_file_body()

int mg_send_file_body ( struct mg_connection *  conn,
const char *  path 
)

Definition at line 9776 of file civetweb.c.

◆ mg_send_http_error()

int mg_send_http_error ( struct mg_connection *  conn,
int  status,
const char *  fmt,
  ... 
)

Definition at line 4687 of file civetweb.c.

◆ mg_send_http_error_impl()

static int mg_send_http_error_impl ( struct mg_connection *  conn,
int  status,
const char *  fmt,
va_list  args 
)
static

Definition at line 4511 of file civetweb.c.

◆ mg_send_http_ok()

int mg_send_http_ok ( struct mg_connection *  conn,
const char *  mime_type,
long long  content_length 
)

Definition at line 4701 of file civetweb.c.

◆ mg_send_http_redirect()

int mg_send_http_redirect ( struct mg_connection *  conn,
const char *  target_url,
int  redirect_code 
)

Definition at line 4739 of file civetweb.c.

◆ mg_send_mime_file()

void mg_send_mime_file ( struct mg_connection *  conn,
const char *  path,
const char *  mime_type 
)

Definition at line 9848 of file civetweb.c.

◆ mg_send_mime_file2()

void mg_send_mime_file2 ( struct mg_connection *  conn,
const char *  path,
const char *  mime_type,
const char *  additional_headers 
)

Definition at line 9857 of file civetweb.c.

◆ mg_set_auth_handler()

void mg_set_auth_handler ( struct mg_context *  ctx,
const char *  uri,
mg_request_handler  handler,
void cbdata 
)

Definition at line 13436 of file civetweb.c.

◆ mg_set_handler_type()

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 
)
static

Definition at line 13181 of file civetweb.c.

◆ mg_set_request_handler()

void mg_set_request_handler ( struct mg_context *  ctx,
const char *  uri,
mg_request_handler  handler,
void cbdata 
)

Definition at line 13364 of file civetweb.c.

◆ mg_set_thread_name()

static void mg_set_thread_name ( const char *  name)
static

Definition at line 2961 of file civetweb.c.

◆ mg_set_user_connection_data()

void mg_set_user_connection_data ( struct mg_connection *  conn,
void data 
)

Definition at line 3450 of file civetweb.c.

◆ mg_set_websocket_handler()

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 13386 of file civetweb.c.

◆ mg_set_websocket_handler_with_subprotocols()

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 13406 of file civetweb.c.

◆ mg_snprintf() [1/2]

static void mg_snprintf ( const struct mg_connection *  conn,
int *  truncated,
char *  buf,
size_t  buflen,
const char *  fmt,
  ... 
)
static

Definition at line 3391 of file civetweb.c.

◆ mg_snprintf() [2/2]

static void mg_snprintf ( const struct mg_connection *  conn,
int *  truncated,
char *  buf,
size_t  buflen,
PRINTF_FORMAT_STRING(const char *fmt)  ,
  ... 
)
static

◆ mg_start()

struct mg_context * mg_start ( const struct mg_callbacks callbacks,
void user_data,
const char **  options 
)

Definition at line 18342 of file civetweb.c.

◆ mg_start_thread()

int mg_start_thread ( mg_thread_func_t  func,
void param 
)

Definition at line 5841 of file civetweb.c.

◆ mg_start_thread_with_id()

static int mg_start_thread_with_id ( mg_thread_func_t  func,
void param,
pthread_t *  threadidptr 
)
static

Definition at line 5865 of file civetweb.c.

◆ mg_stat()

static int mg_stat ( const struct mg_connection *  conn,
const char *  path,
struct mg_file_stat *  filep 
)
static

Definition at line 5791 of file civetweb.c.

◆ mg_static_assert() [1/6]

mg_static_assert ( (sizeof(config_options)/sizeof(config_options[0]))  = =(NUM_OPTIONS+1),
"config_options and enum not sync"   
)

◆ mg_static_assert() [2/6]

mg_static_assert ( MAX_WORKER_THREADS >=  1,
"worker threads must be a positive number"   
)

◆ mg_static_assert() [3/6]

mg_static_assert ( sizeof(int)  = =4||sizeof(int)==8,
"int data type size check"   
)

◆ mg_static_assert() [4/6]

mg_static_assert ( sizeof(size_t)  = =4||sizeof(size_t)==8,
"size_t data type size check"   
)

◆ mg_static_assert() [5/6]

mg_static_assert ( sizeof(void *) >=sizeof(int)  ,
"data type size check"   
)

◆ mg_static_assert() [6/6]

mg_static_assert ( sizeof(void *)  = =4||sizeof(void *)==8,
"pointer data type size check"   
)

◆ mg_stop()

void mg_stop ( struct mg_context *  ctx)

Definition at line 18256 of file civetweb.c.

◆ mg_store_body()

long long mg_store_body ( struct mg_connection *  conn,
const char *  path 
)

Definition at line 9953 of file civetweb.c.

◆ mg_strcasecmp()

int mg_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 3282 of file civetweb.c.

◆ mg_strcasestr()

static const char * mg_strcasestr ( const char *  big_str,
const char *  small_str 
)
static

Definition at line 3323 of file civetweb.c.

◆ mg_strdup()

static char * mg_strdup ( const char *  str)
static

Definition at line 3316 of file civetweb.c.

◆ mg_strdup_ctx()

static char * mg_strdup_ctx ( const char *  str,
struct mg_context *  ctx 
)
static

Definition at line 3310 of file civetweb.c.

◆ mg_strlcpy()

static void mg_strlcpy ( register char *  dst,
register const char *  src,
size_t  n 
)
static

Definition at line 3250 of file civetweb.c.

◆ mg_strncasecmp()

int mg_strncasecmp ( const char *  s1,
const char *  s2,
size_t  len 
)

Definition at line 3267 of file civetweb.c.

◆ mg_strndup_ctx()

static char * mg_strndup_ctx ( const char *  ptr,
size_t  len,
struct mg_context *  ctx 
)
static

Definition at line 3295 of file civetweb.c.

◆ mg_unlock_connection()

void mg_unlock_connection ( struct mg_connection *  conn)

Definition at line 12022 of file civetweb.c.

◆ mg_unlock_context()

void mg_unlock_context ( struct mg_context *  ctx)

Definition at line 12038 of file civetweb.c.

◆ mg_url_decode()

int mg_url_decode ( const char *  src,
int  src_len,
char *  dst,
int  dst_len,
int  is_form_url_encoded 
)

Definition at line 6993 of file civetweb.c.

◆ mg_url_encode()

int mg_url_encode ( const char *  src,
char *  dst,
size_t  dst_len 
)

Definition at line 8967 of file civetweb.c.

◆ mg_version()

const char * mg_version ( void  )

Definition at line 3738 of file civetweb.c.

◆ mg_vprintf()

static int mg_vprintf ( struct mg_connection *  conn,
const char *  fmt,
va_list  ap 
)
static

Definition at line 6961 of file civetweb.c.

◆ mg_vsnprintf()

static void mg_vsnprintf ( const struct mg_connection *  conn,
int *  truncated,
char *  buf,
size_t  buflen,
const char *  fmt,
va_list  ap 
)
static

Definition at line 3342 of file civetweb.c.

◆ mg_write()

int mg_write ( struct mg_connection *  conn,
const void buf,
size_t  len 
)

Definition at line 6755 of file civetweb.c.

◆ mkcol()

static void mkcol ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 11280 of file civetweb.c.

◆ must_hide_file()

static int must_hide_file ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 9124 of file civetweb.c.

◆ next_option()

static const char * next_option ( const char *  list,
struct vec *  val,
struct vec *  eq_val 
)
static

Definition at line 4060 of file civetweb.c.

◆ open_auth_file()

static void open_auth_file ( struct mg_connection *  conn,
const char *  path,
struct mg_file *  filep 
)
static

Definition at line 8034 of file civetweb.c.

◆ open_file_in_memory()

static int open_file_in_memory ( const struct mg_connection *  conn,
const char *  path,
struct mg_file *  filep,
int  mode 
)
static

Definition at line 3052 of file civetweb.c.

◆ parse_auth_header()

static int parse_auth_header ( struct mg_connection *  conn,
char *  buf,
size_t  buf_size,
struct ah *  ah 
)
static

Definition at line 8114 of file civetweb.c.

◆ parse_date_string()

static time_t parse_date_string ( const char *  datetime)
static

Definition at line 7701 of file civetweb.c.

◆ parse_http_headers()

static int parse_http_headers ( char **  buf,
struct mg_header  hdr[MG_MAX_HEADERS] 
)
static

Definition at line 10055 of file civetweb.c.

◆ parse_http_request()

static int parse_http_request ( char *  buf,
int  len,
struct mg_request_info ri 
)
static

Definition at line 10211 of file civetweb.c.

◆ parse_http_response()

static int parse_http_response ( char *  buf,
int  len,
struct mg_response_info ri 
)
static

Definition at line 10298 of file civetweb.c.

◆ parse_net()

static int parse_net ( const char *  spec,
uint32_t *  net,
uint32_t *  mask 
)
static

Definition at line 12830 of file civetweb.c.

◆ parse_port_string()

static int parse_port_string ( const struct vec *  vec,
struct socket *  so,
int *  ip_version 
)
static

Definition at line 14250 of file civetweb.c.

◆ parse_range_header()

static int parse_range_header ( const char *  header,
int64_t *  a,
int64_t *  b 
)
static

Definition at line 9500 of file civetweb.c.

◆ prepare_cgi_environment()

static int prepare_cgi_environment ( struct mg_connection *  conn,
const char *  prog,
struct cgi_environment *  env 
)
static

Definition at line 10692 of file civetweb.c.

◆ print_dav_dir_entry()

static int print_dav_dir_entry ( struct de *  de,
void data 
)
static

Definition at line 11930 of file civetweb.c.

◆ print_dir_entry()

static int print_dir_entry ( struct de *  de)
static

Definition at line 8995 of file civetweb.c.

◆ print_props()

static void print_props ( struct mg_connection *  conn,
const char *  uri,
struct mg_file_stat *  filep 
)
static

Definition at line 11899 of file civetweb.c.

◆ process_new_connection()

static void process_new_connection ( struct mg_connection *  conn)
static

Definition at line 17423 of file civetweb.c.

◆ produce_socket()

static void produce_socket ( struct mg_context *  ctx,
const struct socket *  sp 
)
static

Definition at line 17617 of file civetweb.c.

◆ pull_all()

static int pull_all ( FILE *  fp,
struct mg_connection *  conn,
char *  buf,
int  len 
)
static

Definition at line 6489 of file civetweb.c.

◆ pull_inner()

static int pull_inner ( FILE *  fp,
struct mg_connection *  conn,
char *  buf,
int  len,
double  timeout 
)
static

Definition at line 6298 of file civetweb.c.

◆ push_all()

static int64_t push_all ( struct mg_context *  ctx,
FILE *  fp,
SOCKET  sock,
SSL ssl,
const char *  buf,
int64_t  len 
)
static

Definition at line 6254 of file civetweb.c.

◆ push_inner()

static int push_inner ( struct mg_context *  ctx,
FILE *  fp,
SOCKET  sock,
SSL ssl,
const char *  buf,
int  len,
double  timeout 
)
static

Definition at line 6108 of file civetweb.c.

◆ put_dir()

static int put_dir ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 9903 of file civetweb.c.

◆ put_file()

static void put_file ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 11354 of file civetweb.c.

◆ read_auth_file()

static int read_auth_file ( struct mg_file *  filep,
struct read_auth_file_struct *  workdata,
int  depth 
)
static

Definition at line 8289 of file civetweb.c.

◆ read_message()

static int read_message ( FILE *  fp,
struct mg_connection *  conn,
char *  buf,
int  bufsiz,
int *  nread 
)
static

Definition at line 10405 of file civetweb.c.

◆ realloc2()

static void * realloc2 ( void ptr,
size_t  size 
)
static

Definition at line 9270 of file civetweb.c.

◆ redirect_to_https_port()

static void redirect_to_https_port ( struct mg_connection *  conn,
int  ssl_index 
)
static

Definition at line 13099 of file civetweb.c.

◆ refresh_trust()

static int refresh_trust ( struct mg_connection *  conn)
static

Definition at line 14946 of file civetweb.c.

◆ remove_bad_file()

static void remove_bad_file ( const struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 9940 of file civetweb.c.

◆ remove_directory()

static int remove_directory ( struct mg_connection *  conn,
const char *  dir 
)
static

Definition at line 9194 of file civetweb.c.

◆ remove_double_dots_and_double_slashes()

static void remove_double_dots_and_double_slashes ( char *  s)
static

Definition at line 7765 of file civetweb.c.

◆ reset_per_request_attributes()

static void reset_per_request_attributes ( struct mg_connection *  conn)
static

Definition at line 16014 of file civetweb.c.

◆ scan_directory()

static int scan_directory ( struct mg_connection *  conn,
const char *  dir,
void data,
int(*)(struct de *, void *)  cb 
)
static

Definition at line 9138 of file civetweb.c.

◆ send_additional_header()

static int send_additional_header ( struct mg_connection *  conn)
static

Definition at line 4282 of file civetweb.c.

◆ send_authorization_request()

static void send_authorization_request ( struct mg_connection *  conn,
const char *  realm 
)
static

Definition at line 8505 of file civetweb.c.

◆ send_file_data()

static void send_file_data ( struct mg_connection *  conn,
struct mg_file *  filep,
int64_t  offset,
int64_t  len 
)
static

Definition at line 9387 of file civetweb.c.

◆ send_no_cache_header()

static int send_no_cache_header ( struct mg_connection *  conn)
static

Definition at line 4239 of file civetweb.c.

◆ send_options()

static void send_options ( struct mg_connection *  conn)
static

Definition at line 11867 of file civetweb.c.

◆ send_ssi_file()

static void send_ssi_file ( struct mg_connection *  conn,
const char *  path,
struct mg_file *  filep,
int  include_level 
)
static

Definition at line 11707 of file civetweb.c.

◆ send_static_cache_header()

static int send_static_cache_header ( struct mg_connection *  conn)
static

Definition at line 4251 of file civetweb.c.

◆ set_acl_option()

static int set_acl_option ( struct mg_context *  phys_ctx)
static

Definition at line 16007 of file civetweb.c.

◆ set_blocking_mode()

static int set_blocking_mode ( SOCKET  sock)
static

Definition at line 6011 of file civetweb.c.

◆ set_close_on_exec()

static void set_close_on_exec ( SOCKET  fd,
struct mg_connection *  conn 
)
static

Definition at line 5827 of file civetweb.c.

◆ set_gpass_option()

static int set_gpass_option ( struct mg_context *  phys_ctx,
struct mg_domain_context *  dom_ctx 
)
static

Definition at line 15984 of file civetweb.c.

◆ set_non_blocking_mode()

static int set_non_blocking_mode ( SOCKET  sock)
static

Definition at line 5997 of file civetweb.c.

◆ set_ports_option()

static int set_ports_option ( struct mg_context *  phys_ctx)
static

Definition at line 14449 of file civetweb.c.

◆ set_tcp_nodelay()

static int set_tcp_nodelay ( SOCKET  sock,
int  nodelay_on 
)
static

Definition at line 16103 of file civetweb.c.

◆ set_throttle()

static int set_throttle ( const char *  spec,
uint32_t  remote_ip,
const char *  uri 
)
static

Definition at line 12849 of file civetweb.c.

◆ set_uid_option()

static int set_uid_option ( struct mg_context *  phys_ctx)
static

Definition at line 14867 of file civetweb.c.

◆ should_decode_url()

static int should_decode_url ( const struct mg_connection *  conn)
static

Definition at line 4221 of file civetweb.c.

◆ should_keep_alive()

static int should_keep_alive ( const struct mg_connection *  conn)
static

Definition at line 4182 of file civetweb.c.

◆ skip_quoted()

static char * skip_quoted ( char **  buf,
const char *  delimiters,
const char *  whitespace,
char  quotechar 
)
static

Definition at line 3915 of file civetweb.c.

◆ skip_to_end_of_word_and_terminate()

static int skip_to_end_of_word_and_terminate ( char **  ppw,
int  eol 
)
static

Definition at line 10010 of file civetweb.c.

◆ sockaddr_to_string()

static void sockaddr_to_string ( char *  buf,
size_t  len,
const union usa *  usa 
)
static

Definition at line 3538 of file civetweb.c.

◆ spawn_process()

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 
)
static

Definition at line 5903 of file civetweb.c.

◆ ssl_error()

static const char * ssl_error ( void  )
static

Definition at line 15131 of file civetweb.c.

◆ ssl_get_client_cert_info()

static void ssl_get_client_cert_info ( struct mg_connection *  conn)
static

Definition at line 15166 of file civetweb.c.

◆ ssl_get_protocol()

static long ssl_get_protocol ( int  version_id)
static

Definition at line 15569 of file civetweb.c.

◆ ssl_info_callback()

static void ssl_info_callback ( const SSL ssl,
int  what,
int  ret 
)
static

Definition at line 15596 of file civetweb.c.

◆ ssl_locking_callback()

static void ssl_locking_callback ( int  mode,
int  mutex_num,
const char *  file,
int  line 
)
static

Definition at line 15253 of file civetweb.c.

◆ ssl_servername_callback()

static int ssl_servername_callback ( SSL ssl,
int *  ad,
void arg 
)
static

Definition at line 15612 of file civetweb.c.

◆ ssl_use_pem_file()

static int ssl_use_pem_file ( struct mg_context *  phys_ctx,
struct mg_domain_context *  dom_ctx,
const char *  pem,
const char *  chain 
)
static

Definition at line 15498 of file civetweb.c.

◆ sslize()

static int sslize ( struct mg_connection *  conn,
SSL_CTX s,
int(*)(SSL *)  func,
volatile int *  stop_server,
const struct mg_client_options client_options 
)
static

Definition at line 15033 of file civetweb.c.

◆ substitute_index_file()

static int substitute_index_file ( struct mg_connection *  conn,
char *  path,
size_t  path_len,
struct mg_file_stat *  filestat 
)
static

Definition at line 7296 of file civetweb.c.

◆ suggest_connection_header()

static const char * suggest_connection_header ( const struct mg_connection *  conn)
static

Definition at line 4232 of file civetweb.c.

◆ tls_dtor()

static void tls_dtor ( void key)
static

Definition at line 14921 of file civetweb.c.

◆ uninitialize_ssl()

static void uninitialize_ssl ( void  )
static

Definition at line 15943 of file civetweb.c.

◆ worker_thread()

static void * worker_thread ( void thread_func_param)
static

Definition at line 17909 of file civetweb.c.

◆ worker_thread_run()

static void * worker_thread_run ( struct worker_thread_args *  thread_args)
static

Definition at line 17727 of file civetweb.c.

Variable Documentation

◆ 

const struct { ... } abs_uri_protocols[]
Initial value:
= {{"http://", 7, 80},
{"https://", 8, 443},
{"ws://", 5, 80},
{"wss://", 6, 443},
{NULL, 0, 0}}

◆ 

const struct { ... } builtin_mime_types[]

◆ common_client_context

struct mg_context common_client_context
static

Definition at line 16374 of file civetweb.c.

◆ config_options

const struct mg_option config_options[]
static

Definition at line 2409 of file civetweb.c.

◆ crypto_sw

struct ssl_func crypto_sw[]
static
Initial value:
= {{"CRYPTO_num_locks", NULL},
{"CRYPTO_set_locking_callback", NULL},
{"CRYPTO_set_id_callback", NULL},
{"ERR_get_error", NULL},
{"ERR_error_string", NULL},
{"ERR_remove_state", NULL},
{"ERR_free_strings", NULL},
{"ENGINE_cleanup", NULL},
{"CONF_modules_unload", NULL},
{"CRYPTO_cleanup_all_ex_data", NULL},
{"EVP_cleanup", NULL},
{"X509_free", NULL},
{"X509_get_subject_name", NULL},
{"X509_get_issuer_name", NULL},
{"X509_NAME_oneline", NULL},
{"X509_get_serialNumber", NULL},
{"i2c_ASN1_INTEGER", NULL},
{"EVP_get_digestbyname", NULL},
{"EVP_Digest", NULL},
{"i2d_X509", NULL},
{"BN_bn2hex", NULL},
{"ASN1_INTEGER_to_BN", NULL},
{"BN_free", NULL},
{"CRYPTO_free", NULL},
{NULL, NULL}}

Definition at line 2171 of file civetweb.c.

◆ cryptolib_dll_handle

void* cryptolib_dll_handle
static

Definition at line 15346 of file civetweb.c.

◆ cryptolib_users

int cryptolib_users = 0
static

Definition at line 15354 of file civetweb.c.

◆ default_port

unsigned default_port

Definition at line 16606 of file civetweb.c.

◆ ext_len

size_t ext_len

Definition at line 7794 of file civetweb.c.

◆ extension

const char* extension

Definition at line 7793 of file civetweb.c.

◆ global_lock_mutex

pthread_mutex_t global_lock_mutex
static

Definition at line 1149 of file civetweb.c.

◆ http_methods

struct mg_http_method_info http_methods[]
static

Definition at line 10119 of file civetweb.c.

◆ mg_init_library_called

int mg_init_library_called = 0
static

Definition at line 1549 of file civetweb.c.

◆ mg_ssl_initialized

int mg_ssl_initialized = 0
static

Definition at line 1552 of file civetweb.c.

◆ mime_type

const char* mime_type

Definition at line 7795 of file civetweb.c.

◆ month_names

const char* month_names[]
static
Initial value:
= {"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"}

Definition at line 2202 of file civetweb.c.

◆ proto

const char* proto

Definition at line 16604 of file civetweb.c.

◆ proto_len

size_t proto_len

Definition at line 16605 of file civetweb.c.

◆ pthread_mutex_attr

pthread_mutexattr_t pthread_mutex_attr
static

Definition at line 963 of file civetweb.c.

◆ ssl_mutexes

pthread_mutex_t* ssl_mutexes
static

Definition at line 15029 of file civetweb.c.

◆ ssl_sw

struct ssl_func ssl_sw[]
static

Definition at line 2127 of file civetweb.c.

◆ ssllib_dll_handle

void* ssllib_dll_handle
static

Definition at line 15345 of file civetweb.c.

◆ static_assert_replacement

char static_assert_replacement[1]

Definition at line 119 of file civetweb.c.

◆ sTlsKey

pthread_key_t sTlsKey
static

Definition at line 1555 of file civetweb.c.

◆ thread_idx_max

int thread_idx_max = 0
static

Definition at line 1556 of file civetweb.c.