Github User Fetcher 1.0.0
C Application with Server and GUI
|
#include "civetweb.h"
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdint.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <dirent.h>
#include <grp.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <poll.h>
#include <pthread.h>
#include <pwd.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <dlfcn.h>
#include "md5.inl"
#include "openssl_dl.inl"
#include "sort.inl"
#include "match.inl"
#include "response.inl"
#include "handle_form.inl"
Go to the source code of this file.
Data Structures | |
struct | mg_workerTLS |
union | usa |
struct | vec |
struct | mg_file_stat |
struct | mg_file_access |
struct | mg_file |
struct | socket |
struct | mg_handler_info |
struct | mg_domain_context |
struct | twebdav_lock |
struct | mg_context |
struct | mg_connection |
struct | de |
struct | ah |
struct | read_auth_file_struct |
struct | dir_scan_data |
struct | mg_http_method_info |
struct | cgi_environment |
struct | process_control_data |
struct | websocket_client_thread_data |
Macros | |
#define | _GNU_SOURCE /* for setgroups(), pthread_setname_np() */ |
#define | _LARGEFILE_SOURCE /* For fseeko(), ftello() */ |
#define | _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ |
#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 | mg_static_assert(cond, txt) extern char static_assert_replacement[(cond) ? 1 : -1] |
#define | NO_ALTERNATIVE_QUEUE |
#define | WIN32_LEAN_AND_MEAN |
#define | DEBUG_TRACE(fmt, ...) |
#define | DEBUG_ASSERT(cond) |
#define | IGNORE_UNUSED_RESULT(a) ((void)((a) && 1)) |
#define | FUNCTION_MAY_BE_UNUSED |
#define | ERROR_TRY_AGAIN(err) (((err) == EAGAIN) || ((err) == EWOULDBLOCK) || ((err) == EINTR)) |
#define | MAX_WORKER_THREADS (1024 * 64) /* in threads (count) */ |
#define | SOCKET_TIMEOUT_QUANTUM (2000) /* in ms */ |
#define | MG_FILE_COMPRESSION_SIZE_LIMIT (1024) /* in bytes */ |
#define | PASSWORDS_FILE_NAME ".htpasswd" |
#define | CGI_ENVIRONMENT_SIZE (4096) /* in bytes */ |
#define | MAX_CGI_ENVIR_VARS (256) /* in variables (count) */ |
#define | MG_BUF_LEN (1024 * 8) |
#define | ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) |
#define | INT64_MAX (9223372036854775807) |
#define | SHUTDOWN_RD (0) |
#define | SHUTDOWN_WR (1) |
#define | SHUTDOWN_BOTH (2) |
#define | UTF8_PATH_MAX (PATH_MAX) |
#define | vsnprintf_impl vsnprintf |
#define | SSL_LIB "libssl.so" |
#define | CRYPTO_LIB "libcrypto.so" |
#define | O_BINARY (0) |
#define | closesocket(a) (close(a)) |
#define | mg_mkdir(conn, path, mode) (mkdir(path, mode)) |
#define | mg_remove(conn, x) (remove(x)) |
#define | mg_sleep(x) (usleep((x)*1000)) |
#define | mg_opendir(conn, x) (opendir(x)) |
#define | mg_closedir(x) (closedir(x)) |
#define | mg_readdir(x) (readdir(x)) |
#define | ERRNO (errno) |
#define | INVALID_SOCKET (-1) |
#define | INT64_FMT PRId64 |
#define | UINT64_FMT PRIu64 |
#define | WINCDECL |
#define | mg_pollfd pollfd |
#define | va_copy(x, y) ((x) = (y)) |
#define | mg_malloc_ctx(a, c) mg_malloc(a) |
#define | mg_calloc_ctx(a, b, c) mg_calloc(a, b) |
#define | mg_realloc_ctx(a, b, c) mg_realloc(a, b) |
#define | mg_free_ctx(a, c) mg_free(a) |
#define | malloc DO_NOT_USE_THIS_FUNCTION__USE_mg_malloc |
#define | calloc DO_NOT_USE_THIS_FUNCTION__USE_mg_calloc |
#define | realloc DO_NOT_USE_THIS_FUNCTION__USE_mg_realloc |
#define | free DO_NOT_USE_THIS_FUNCTION__USE_mg_free |
#define | snprintf DO_NOT_USE_THIS_FUNCTION__USE_mg_snprintf |
#define | MD5_STATIC static |
#define | IP_ADDR_STR_LEN (50) /* IPv6 hex string is 46 chars */ |
#define | MSG_NOSIGNAL (0) |
#define | USA_IN_PORT_UNSAFE(s) ((s)->sin.sin_port) |
#define | STRUCT_FILE_INITIALIZER |
#define | STOP_FLAG_IS_ZERO(f) ((*(f)) == 0) |
#define | STOP_FLAG_IS_TWO(f) ((*(f)) == 2) |
#define | STOP_FLAG_ASSIGN(f, v) ((*(f)) = (v)) |
#define | NUM_WEBDAV_LOCKS 10 |
#define | LOCK_DURATION_S 60 |
#define | mg_cry_internal(conn, fmt, ...) mg_cry_internal_wrap(conn, NULL, __func__, __LINE__, fmt, __VA_ARGS__) |
#define | mg_cry_ctx_internal(ctx, fmt, ...) mg_cry_internal_wrap(NULL, ctx, __func__, __LINE__, fmt, __VA_ARGS__) |
#define | MG_FOPEN_MODE_NONE (0) |
#define | MG_FOPEN_MODE_READ (1) |
#define | MG_FOPEN_MODE_WRITE (2) |
#define | MG_FOPEN_MODE_APPEND (4) |
#define | mg_get_option DO_NOT_USE_THIS_FUNCTION_INTERNALLY__access_directly |
#define | mg_cry DO_NOT_USE_THIS_FUNCTION__USE_mg_cry_internal |
#define | HTTP1_only |
#define | HEXTOI(x) (isdigit(x) ? (x - '0') : (x - 'W')) |
#define | INITIAL_DEPTH 9 |
Typedefs | |
typedef const void * | SOCK_OPT_TYPE |
typedef int | SOCKET |
typedef int volatile | stop_flag_t |
Functions | |
mg_static_assert (sizeof(int)==4||sizeof(int)==8, "int data type size check") | |
mg_static_assert (sizeof(void *)==4||sizeof(void *)==8, "pointer data type size check") | |
mg_static_assert (sizeof(void *) >=sizeof(int), "data type size check") | |
mg_static_assert (MAX_WORKER_THREADS >=1, "worker threads must be a positive number") | |
mg_static_assert (sizeof(size_t)==4||sizeof(size_t)==8, "size_t data type size check") | |
static FUNCTION_MAY_BE_UNUSED void | mg_global_lock (void) |
static FUNCTION_MAY_BE_UNUSED void | mg_global_unlock (void) |
static FUNCTION_MAY_BE_UNUSED ptrdiff_t | mg_atomic_inc (volatile ptrdiff_t *addr) |
static FUNCTION_MAY_BE_UNUSED ptrdiff_t | mg_atomic_dec (volatile ptrdiff_t *addr) |
static __inline void * | mg_malloc (size_t a) |
static __inline void * | mg_calloc (size_t a, size_t b) |
static __inline void * | mg_realloc (void *a, size_t b) |
static __inline void | mg_free (void *a) |
static void | mg_vsnprintf (const struct mg_connection *conn, int *truncated, char *buf, size_t buflen, const char *fmt, va_list ap) |
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 |
static FUNCTION_MAY_BE_UNUSED unsigned long | mg_current_thread_id (void) |
static FUNCTION_MAY_BE_UNUSED uint64_t | mg_get_current_time_ns (void) |
mg_static_assert ((sizeof(config_options)/sizeof(config_options[0]))==(NUM_OPTIONS+1), "config_options and enum not sync") | |
static void | mg_cry_internal_wrap (const struct mg_connection *conn, struct mg_context *ctx, const char *func, unsigned line, const char *fmt,...) PRINTF_ARGS(5 |
static void static void | mg_set_thread_name (const char *name) |
CIVETWEB_API const struct mg_option * | mg_get_valid_options (void) |
static int | is_file_opened (const struct mg_file_access *fileacc) |
static int | mg_stat (const struct mg_connection *conn, const char *path, struct mg_file_stat *filep) |
static int | mg_path_suspicious (const struct mg_connection *conn, const char *path) |
static int | mg_fopen (const struct mg_connection *conn, const char *path, int mode, struct mg_file *filep) |
static int | mg_fclose (struct mg_file_access *fileacc) |
static void | mg_strlcpy (char *dst, const char *src, size_t n) |
static int | lowercase (const char *s) |
CIVETWEB_API int | mg_strncasecmp (const char *s1, const char *s2, size_t len) |
CIVETWEB_API int | mg_strcasecmp (const char *s1, const char *s2) |
static char * | mg_strndup_ctx (const char *ptr, size_t len, struct mg_context *ctx) |
static char * | mg_strdup_ctx (const char *str, struct mg_context *ctx) |
static char * | mg_strdup (const char *str) |
static const char * | mg_strcasestr (const char *big_str, const char *small_str) |
static void | mg_snprintf (const struct mg_connection *conn, int *truncated, char *buf, size_t buflen, const char *fmt,...) |
static int | get_option_index (const char *name) |
CIVETWEB_API const char * | mg_get_option (const struct mg_context *ctx, const char *name) |
CIVETWEB_API struct mg_context * | mg_get_context (const struct mg_connection *conn) |
CIVETWEB_API void * | mg_get_user_data (const struct mg_context *ctx) |
CIVETWEB_API void * | mg_get_user_context_data (const struct mg_connection *conn) |
CIVETWEB_API void * | mg_get_thread_pointer (const struct mg_connection *conn) |
CIVETWEB_API void | mg_set_user_connection_data (const struct mg_connection *const_conn, void *data) |
CIVETWEB_API void * | mg_get_user_connection_data (const struct mg_connection *conn) |
CIVETWEB_API int | mg_get_server_ports (const struct mg_context *ctx, int size, struct mg_server_port *ports) |
static void | sockaddr_to_string (char *buf, size_t len, const union usa *usa) |
static void | gmt_time_string (char *buf, size_t buf_len, time_t *t) |
static double | mg_difftimespec (const struct timespec *ts_now, const struct timespec *ts_before) |
static void | mg_cry_internal_impl (const struct mg_connection *conn, const char *func, unsigned line, const char *fmt, va_list ap) |
static struct mg_connection * | fake_connection (struct mg_connection *fc, struct mg_context *ctx) |
CIVETWEB_API void | mg_cry (const struct mg_connection *conn, const char *fmt,...) |
CIVETWEB_API const char * | mg_version (void) |
CIVETWEB_API const struct mg_request_info * | mg_get_request_info (const struct mg_connection *conn) |
CIVETWEB_API const struct mg_response_info * | mg_get_response_info (const struct mg_connection *conn) |
static const char * | get_proto_name (const struct mg_connection *conn) |
static int | mg_construct_local_link (const struct mg_connection *conn, char *buf, size_t buflen, const char *define_proto, int define_port, const char *define_uri) |
CIVETWEB_API int | mg_get_request_link (const struct mg_connection *conn, char *buf, size_t buflen) |
static char * | skip_quoted (char **buf, const char *delimiters, const char *whitespace, char quotechar) |
static const char * | get_header (const struct mg_header *hdr, int num_hdr, const char *name) |
static int | get_req_headers (const struct mg_request_info *ri, const char *name, const char **output, int output_max_size) |
CIVETWEB_API const char * | mg_get_header (const struct mg_connection *conn, const char *name) |
static const char * | get_http_version (const struct mg_connection *conn) |
static const char * | next_option (const char *list, struct vec *val, struct vec *eq_val) |
static int | header_has_option (const char *header, const char *option) |
static int | should_keep_alive (const struct mg_connection *conn) |
static int | should_decode_url (const struct mg_connection *conn) |
static int | should_decode_query_string (const struct mg_connection *conn) |
static const char * | suggest_connection_header (const struct mg_connection *conn) |
static void | send_no_cache_header (struct mg_connection *conn) |
static void | send_static_cache_header (struct mg_connection *conn) |
static void | send_additional_header (struct mg_connection *conn) |
static void | send_cors_header (struct mg_connection *conn) |
static void | handle_file_based_request (struct mg_connection *conn, const char *path, struct mg_file *filep) |
CIVETWEB_API const char * | mg_get_response_code_text (const struct mg_connection *conn, int response_code) |
static int | mg_send_http_error_impl (struct mg_connection *conn, int status, const char *fmt, va_list args) |
CIVETWEB_API int | mg_send_http_error (struct mg_connection *conn, int status, const char *fmt,...) |
CIVETWEB_API int | mg_send_http_ok (struct mg_connection *conn, const char *mime_type, long long content_length) |
CIVETWEB_API int | mg_send_http_redirect (struct mg_connection *conn, const char *target_url, int redirect_code) |
static void | set_close_on_exec (int fd, const struct mg_connection *conn, struct mg_context *ctx) |
CIVETWEB_API 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_join_thread (pthread_t threadid) |
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, int cgi_config_idx) |
static int | set_non_blocking_mode (SOCKET sock) |
static int | set_blocking_mode (SOCKET sock) |
static uint64_t | get_random (void) |
static int | mg_poll (struct mg_pollfd *pfd, unsigned int n, int milliseconds, const stop_flag_t *stop_flag) |
static int | push_inner (struct mg_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int len, double timeout) |
static int | push_all (struct mg_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int len) |
static int | pull_inner (FILE *fp, struct mg_connection *conn, char *buf, int len, double timeout) |
static int | pull_all (FILE *fp, struct mg_connection *conn, char *buf, int len) |
static void | discard_unread_request_data (struct mg_connection *conn) |
static int | mg_read_inner (struct mg_connection *conn, void *buf, size_t len) |
static void | handle_request (struct mg_connection *) |
static void | log_access (const struct mg_connection *) |
static void | handle_request_stat_log (struct mg_connection *conn) |
CIVETWEB_API int | mg_read (struct mg_connection *conn, void *buf, size_t len) |
CIVETWEB_API int | mg_write (struct mg_connection *conn, const void *buf, size_t len) |
CIVETWEB_API int | mg_send_chunk (struct mg_connection *conn, const char *chunk, unsigned int chunk_len) |
static int | alloc_vprintf2 (char **buf, const char *fmt, va_list ap) |
static int | alloc_vprintf (char **out_buf, char *prealloc_buf, size_t prealloc_size, const char *fmt, va_list ap) |
static int | alloc_printf (char **out_buf, const char *fmt,...) |
static int | mg_vprintf (struct mg_connection *conn, const char *fmt, va_list ap) |
CIVETWEB_API int | mg_printf (struct mg_connection *conn, const char *fmt,...) |
CIVETWEB_API int | mg_url_decode (const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded) |
static void | url_decode_in_place (char *buf) |
CIVETWEB_API int | mg_get_var (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len) |
CIVETWEB_API int | mg_get_var2 (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len, size_t occurrence) |
CIVETWEB_API int | mg_split_form_urlencoded (char *data, struct mg_header *form_fields, unsigned num_form_fields) |
CIVETWEB_API int | mg_get_cookie (const char *cookie_header, const char *var_name, char *dst, size_t dst_size) |
CIVETWEB_API int | mg_base64_encode (const unsigned char *src, size_t src_len, char *dst, size_t *dst_len) |
static unsigned char | b64reverse (char letter) |
CIVETWEB_API int | mg_base64_decode (const char *src, size_t src_len, unsigned char *dst, size_t *dst_len) |
static int | is_put_or_delete_method (const struct mg_connection *conn) |
static int | is_civetweb_webdav_method (const struct mg_connection *conn) |
static int | extention_matches_script (struct mg_connection *conn, const char *filename) |
static int | extention_matches_template_text (struct mg_connection *conn, const char *filename) |
static int | substitute_index_file (struct mg_connection *conn, char *path, size_t path_len, struct mg_file_stat *filestat) |
static void | interpret_uri (struct mg_connection *conn, char *filename, size_t filename_buf_len, struct mg_file_stat *filestat, int *is_found, int *is_script_resource, int *is_websocket_request, int *is_put_or_delete_request, int *is_webdav_request, int *is_template_text) |
static int | get_http_header_len (const char *buf, int buflen) |
static int | get_month_index (const char *s) |
static time_t | parse_date_string (const char *datetime) |
static void | remove_dot_segments (char *inout) |
CIVETWEB_API const char * | mg_get_builtin_mime_type (const char *path) |
static void | get_mime_type (struct mg_connection *conn, const char *path, struct vec *vec) |
static void | bin2str (char *to, const unsigned char *p, size_t len) |
CIVETWEB_API char * | mg_md5 (char buf[33],...) |
static int | check_password_digest (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 | open_auth_file (struct mg_connection *conn, const char *path, struct mg_file *filep) |
static int | parse_auth_header (struct mg_connection *conn, char *buf, size_t buf_size, struct ah *ah) |
static const char * | mg_fgets (char *buf, size_t size, struct mg_file *filep) |
static int | read_auth_file (struct mg_file *filep, struct read_auth_file_struct *workdata, int depth) |
static int | authorize (struct mg_connection *conn, struct mg_file *filep, const char *realm) |
CIVETWEB_API int | mg_check_digest_access_authentication (struct mg_connection *conn, const char *realm, const char *filename) |
static int | check_authorization (struct mg_connection *conn, const char *path) |
static void | send_authorization_request (struct mg_connection *conn, const char *realm) |
CIVETWEB_API int | mg_send_digest_access_authentication_request (struct mg_connection *conn, const char *realm) |
static int | is_authorized_for_put (struct mg_connection *conn) |
CIVETWEB_API int | mg_modify_passwords_file_ha1 (const char *fname, const char *domain, const char *user, const char *ha1) |
CIVETWEB_API int | mg_modify_passwords_file (const char *fname, const char *domain, const char *user, const char *pass) |
static int | is_valid_port (unsigned long port) |
static int | mg_inet_pton (int af, const char *src, void *dst, size_t dstlen, int resolve_src) |
static int | connect_socket (struct mg_context *ctx, const char *host, int port, int use_ssl, struct mg_error_data *error, SOCKET *sock, union usa *sa) |
CIVETWEB_API int | mg_url_encode (const char *src, char *dst, size_t dst_len) |
static int | print_dir_entry (struct mg_connection *conn, struct de *de) |
static int | compare_dir_entries (const void *p1, const void *p2, void *arg) |
static int | must_hide_file (struct mg_connection *conn, const char *path) |
static int | scan_directory (struct mg_connection *conn, const char *dir, void *data, int(*cb)(struct de *, void *)) |
static int | remove_directory (struct mg_connection *conn, const char *dir) |
static int | dir_scan_callback (struct de *de, void *data) |
static void | handle_directory_request (struct mg_connection *conn, const char *dir) |
static void | send_file_data (struct mg_connection *conn, struct mg_file *filep, int64_t offset, int64_t len, int no_buffering) |
static int | parse_range_header (const char *header, int64_t *a, int64_t *b) |
static void | construct_etag (char *buf, size_t buf_len, const struct mg_file_stat *filestat) |
static void | fclose_on_exec (struct mg_file_access *filep, struct mg_connection *conn) |
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) |
CIVETWEB_API int | mg_send_file_body (struct mg_connection *conn, const char *path) |
static int | is_not_modified (const struct mg_connection *conn, const struct mg_file_stat *filestat) |
static void | handle_not_modified_static_file_request (struct mg_connection *conn, struct mg_file *filep) |
CIVETWEB_API void | mg_send_file (struct mg_connection *conn, const char *path) |
CIVETWEB_API void | mg_send_mime_file (struct mg_connection *conn, const char *path, const char *mime_type) |
CIVETWEB_API void | mg_send_mime_file2 (struct mg_connection *conn, const char *path, const char *mime_type, const char *additional_headers) |
static int | put_dir (struct mg_connection *conn, const char *path) |
static void | remove_bad_file (const struct mg_connection *conn, const char *path) |
CIVETWEB_API long long | mg_store_body (struct mg_connection *conn, const char *path) |
static int | skip_to_end_of_word_and_terminate (char **ppw, int eol) |
static int | parse_http_headers (char **buf, struct mg_header hdr[MG_MAX_HEADERS]) |
static const struct mg_http_method_info * | get_http_method_info (const char *method) |
static int | is_valid_http_method (const char *method) |
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 | read_message (FILE *fp, struct mg_connection *conn, char *buf, int bufsiz, int *nread) |
static int | forward_body_data (struct mg_connection *conn, FILE *fp, SOCKET sock, SSL *ssl) |
static void | addenv (struct cgi_environment *env, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2 |
static void static void | addenv (struct cgi_environment *env, const char *fmt,...) |
static int | prepare_cgi_environment (struct mg_connection *conn, const char *prog, struct cgi_environment *env, int cgi_config_idx) |
static int | abort_cgi_process (void *data) |
static void | handle_cgi_request (struct mg_connection *conn, const char *prog, int cgi_config_idx) |
static void | dav_mkcol (struct mg_connection *conn, const char *path) |
static int | get_uri_type (const char *uri) |
static const char * | get_rel_url_at_current_server (const char *uri, const struct mg_connection *conn) |
static void | dav_move_file (struct mg_connection *conn, const char *path, int do_copy) |
static void | put_file (struct mg_connection *conn, const char *path) |
static void | delete_file (struct mg_connection *conn, const char *path) |
static void | send_ssi_file (struct mg_connection *, const char *, struct mg_file *, int) |
static void | do_ssi_include (struct mg_connection *conn, const char *ssi, char *tag, int include_level) |
static void | do_ssi_exec (struct mg_connection *conn, char *tag) |
static int | mg_fgetc (struct mg_file *filep) |
static void | handle_ssi_file_request (struct mg_connection *conn, const char *path, struct mg_file *filep) |
static void | send_options (struct mg_connection *conn) |
static int | print_props (struct mg_connection *conn, const char *uri, const char *name, struct mg_file_stat *filep) |
static int | print_dav_dir_entry (struct de *de, void *data) |
static void | handle_propfind (struct mg_connection *conn, const char *path, struct mg_file_stat *filep) |
static void | dav_lock_file (struct mg_connection *conn, const char *path) |
static void | dav_unlock_file (struct mg_connection *conn, const char *path) |
static void | dav_proppatch (struct mg_connection *conn, const char *path) |
CIVETWEB_API void | mg_lock_connection (struct mg_connection *conn) |
CIVETWEB_API void | mg_unlock_connection (struct mg_connection *conn) |
CIVETWEB_API void | mg_lock_context (struct mg_context *ctx) |
CIVETWEB_API void | mg_unlock_context (struct mg_context *ctx) |
static int | should_switch_to_protocol (const struct mg_connection *conn) |
static int | parse_match_net (const struct vec *vec, const union usa *sa, int no_strict) |
static int | set_throttle (const char *spec, const union usa *rsa, const char *uri) |
static int | get_first_ssl_listener_index (const struct mg_context *ctx) |
static void | get_host_from_request_info (struct vec *host, const struct mg_request_info *ri) |
static int | switch_domain_context (struct mg_connection *conn) |
static void | redirect_to_https_port (struct mg_connection *conn, int port) |
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) |
CIVETWEB_API void | mg_set_request_handler (struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata) |
CIVETWEB_API 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) |
CIVETWEB_API 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) |
CIVETWEB_API void | mg_set_auth_handler (struct mg_context *ctx, const char *uri, mg_authorization_handler handler, void *cbdata) |
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 | is_in_script_path (const struct mg_connection *conn, const char *path) |
static void | release_handler_ref (struct mg_connection *conn, struct mg_handler_info *handler_info) |
static void | close_all_listening_sockets (struct mg_context *ctx) |
static int | parse_port_string (const struct vec *vec, struct socket *so, int *ip_version) |
static int | is_ssl_port_used (const char *ports) |
static int | set_ports_option (struct mg_context *phys_ctx) |
static const char * | header_val (const struct mg_connection *conn, const char *header) |
static int | check_acl (struct mg_context *phys_ctx, const union usa *sa) |
static int | set_uid_option (struct mg_context *phys_ctx) |
static void | tls_dtor (void *key) |
static int | ssl_use_pem_file (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx, const char *pem, const char *chain) |
static const char * | ssl_error (void) |
static int | refresh_trust (struct mg_connection *conn) |
static int | sslize (struct mg_connection *conn, int(*func)(SSL *), const struct mg_client_options *client_options) |
static int | hexdump2string (void *mem, int memlen, char *buf, int buflen) |
static int | ssl_get_client_cert_info (const struct mg_connection *conn, struct mg_client_cert *client_cert) |
static void | ssl_locking_callback (int mode, int mutex_num, const char *file, int line) |
static void * | load_tls_dll (char *ebuf, size_t ebuf_len, const char *dll_name, struct ssl_func *sw, int *feature_missing) |
static int | initialize_openssl (char *ebuf, size_t ebuf_len) |
static long | ssl_get_protocol (int version_id) |
static void | ssl_info_callback (const SSL *ssl, int what, int ret) |
static int | ssl_servername_callback (SSL *ssl, int *ad, void *arg) |
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 | init_ssl_ctx (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx) |
static void | uninitialize_openssl (void) |
static int | set_gpass_option (struct mg_context *phys_ctx, struct mg_domain_context *dom_ctx) |
static int | set_acl_option (struct mg_context *phys_ctx) |
static void | reset_per_request_attributes (struct mg_connection *conn) |
static int | set_tcp_nodelay (const struct socket *so, int nodelay_on) |
static void | close_socket_gracefully (struct mg_connection *conn) |
static void | close_connection (struct mg_connection *conn) |
CIVETWEB_API void | mg_close_connection (struct mg_connection *conn) |
static struct mg_connection * | mg_connect_client_impl (const struct mg_client_options *client_options, int use_ssl, struct mg_init_data *init, struct mg_error_data *error) |
CIVETWEB_API struct mg_connection * | mg_connect_client_secure (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size) |
CIVETWEB_API struct mg_connection * | mg_connect_client (const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size) |
static int | get_message (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) |
static int | get_request (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) |
static int | get_response (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) |
CIVETWEB_API int | mg_get_response (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int timeout) |
CIVETWEB_API struct mg_connection * | mg_download (const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, const char *fmt,...) |
static struct mg_connection * | mg_connect_websocket_client_impl (const struct mg_client_options *client_options, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, const char *extensions, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
CIVETWEB_API 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) |
CIVETWEB_API struct mg_connection * | mg_connect_websocket_client_secure (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
CIVETWEB_API struct mg_connection * | mg_connect_websocket_client_extensions (const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, const char *extensions, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
CIVETWEB_API struct mg_connection * | mg_connect_websocket_client_secure_extensions (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, const char *extensions, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data) |
static void | init_connection (struct mg_connection *conn) |
static void | process_new_connection (struct mg_connection *conn) |
static int | consume_socket (struct mg_context *ctx, struct socket *sp, int thread_index) |
static void | produce_socket (struct mg_context *ctx, const struct socket *sp) |
static void | worker_thread_run (struct mg_connection *conn) |
static void * | worker_thread (void *thread_func_param) |
static void | accept_new_connection (const struct socket *listener, struct mg_context *ctx) |
static void | master_thread_run (struct mg_context *ctx) |
static void * | master_thread (void *thread_func_param) |
static void | free_context (struct mg_context *ctx) |
CIVETWEB_API void | mg_stop (struct mg_context *ctx) |
static void | get_system_name (char **sysName) |
static void | legacy_init (const char **options) |
CIVETWEB_API struct mg_context * | mg_start2 (struct mg_init_data *init, struct mg_error_data *error) |
CIVETWEB_API struct mg_context * | mg_start (const struct mg_callbacks *callbacks, void *user_data, const char **options) |
CIVETWEB_API int | mg_start_domain2 (struct mg_context *ctx, const char **options, struct mg_error_data *error) |
CIVETWEB_API int | mg_start_domain (struct mg_context *ctx, const char **options) |
CIVETWEB_API unsigned | mg_check_feature (unsigned feature) |
static size_t | mg_str_append (char **dst, char *end, const char *src) |
CIVETWEB_API int | mg_get_system_info (char *buffer, int buflen) |
CIVETWEB_API int | mg_get_context_info (const struct mg_context *ctx, char *buffer, int buflen) |
CIVETWEB_API void | mg_disable_connection_keep_alive (struct mg_connection *conn) |
CIVETWEB_API unsigned | mg_init_library (unsigned features) |
CIVETWEB_API unsigned | mg_exit_library (void) |
Variables | ||
char | static_assert_replacement [1] | |
static pthread_mutexattr_t | pthread_mutex_attr | |
static pthread_mutex_t | global_lock_mutex | |
static int | mg_init_library_called = 0 | |
static pthread_key_t | sTlsKey | |
static volatile ptrdiff_t | thread_idx_max = 0 | |
static const char | month_names [][4] | |
static const struct mg_option | config_options [] | |
struct { | ||
const char * extension | ||
size_t ext_len | ||
const char * mime_type | ||
} | builtin_mime_types [] | |
static const struct mg_http_method_info | http_methods [] | |
static char * | all_methods = NULL | |
static pthread_mutex_t * | ssl_mutexes | |
static void * | ssllib_dll_handle | |
static void * | cryptolib_dll_handle | |
static volatile ptrdiff_t | cryptolib_users | |
struct { | ||
const char * proto | ||
size_t proto_len | ||
unsigned default_port | ||
} | abs_uri_protocols [] | |
#define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
Definition at line 75 of file civetweb.c.
#define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ |
Definition at line 78 of file civetweb.c.
#define _DARWIN_UNLIMITED_SELECT |
Definition at line 81 of file civetweb.c.
#define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ |
Definition at line 72 of file civetweb.c.
#define _GNU_SOURCE /* for setgroups(), pthread_setname_np() */ |
Definition at line 59 of file civetweb.c.
#define _LARGEFILE_SOURCE /* For fseeko(), ftello() */ |
Definition at line 69 of file civetweb.c.
#define ARRAY_SIZE | ( | array | ) | (sizeof(array) / sizeof(array[0])) |
Definition at line 506 of file civetweb.c.
Referenced by dav_move_file(), get_month_index(), and mg_fopen().
#define calloc DO_NOT_USE_THIS_FUNCTION__USE_mg_calloc |
Definition at line 1540 of file civetweb.c.
Referenced by mg_calloc(), and Tokenizer_new().
#define CGI_ENVIRONMENT_SIZE (4096) /* in bytes */ |
Definition at line 488 of file civetweb.c.
Referenced by addenv(), and prepare_cgi_environment().
Definition at line 917 of file civetweb.c.
Referenced by accept_new_connection(), close_all_listening_sockets(), close_connection(), close_socket_gracefully(), connect_socket(), duk_trans_socket_finish(), duk_trans_socket_init(), duk_trans_socket_peek_cb(), duk_trans_socket_read_cb(), duk_trans_socket_waitconn(), duk_trans_socket_write_cb(), mg_connect_client_impl(), and set_ports_option().
#define CRYPTO_LIB "libcrypto.so" |
Definition at line 911 of file civetweb.c.
Referenced by initialize_openssl().
#define DEBUG_ASSERT | ( | cond | ) |
Definition at line 260 of file civetweb.c.
Referenced by forward_body_data(), get_message(), handle_request(), header_has_option(), mg_get_var2(), mg_set_handler_type(), process_new_connection(), and ssl_servername_callback().
#define DEBUG_TRACE | ( | fmt, | |
... ) |
Definition at line 242 of file civetweb.c.
Referenced by abort_cgi_process(), accept_new_connection(), consume_socket(), dav_mkcol(), dav_move_file(), delete_file(), get_host_from_request_info(), handle_cgi_request(), handle_request(), handle_request_stat_log(), initialize_openssl(), interpret_uri(), is_authorized_for_put(), load_tls_dll(), master_thread_run(), mg_connect_websocket_client_impl(), mg_cry_internal_impl(), mg_init_library(), mg_send_http_error_impl(), mg_start2(), mg_start_domain2(), open_auth_file(), process_new_connection(), produce_socket(), pull_inner(), push_inner(), put_dir(), put_file(), ssl_servername_callback(), switch_domain_context(), and worker_thread_run().
#define ERRNO (errno) |
Definition at line 924 of file civetweb.c.
Referenced by accept_new_connection(), close_socket_gracefully(), connect_socket(), dav_mkcol(), delete_file(), do_ssi_exec(), do_ssi_include(), fclose_on_exec(), handle_cgi_request(), handle_directory_request(), handle_ssi_file_request(), handle_static_file_request(), mg_connect_client_impl(), mg_poll(), mg_start2(), open_auth_file(), pull_inner(), push_inner(), put_file(), remove_directory(), scan_directory(), send_file_data(), set_close_on_exec(), set_gpass_option(), set_ports_option(), spawn_process(), and sslize().
#define ERROR_TRY_AGAIN | ( | err | ) | (((err) == EAGAIN) || ((err) == EWOULDBLOCK) || ((err) == EINTR)) |
Definition at line 447 of file civetweb.c.
Referenced by mg_poll(), pull_inner(), and push_inner().
#define free DO_NOT_USE_THIS_FUNCTION__USE_mg_free |
Definition at line 1542 of file civetweb.c.
Referenced by buffer_cleanup(), cleanupdb(), collfree(), db_register_function(), duk_alloc_hybrid_init(), duk_dvalue_free(), duk_dvalue_make_tag_data(), duk_free_hybrid(), duk_free_logging(), duk_free_torture(), duk_realloc_hybrid(), duk_realloc_logging(), duk_realloc_torture(), duk_trans_dvalue_free(), duk_trans_dvalue_init(), fetch_github_user(), free_system_info(), get_dir(), handle_fh(), handle_fh(), handle_fh(), handle_interactive(), handle_interactive(), l_alloc(), l_alloc(), l_alloc(), l_alloc(), lfs_lock_dir(), lfs_unlock_dir(), mg_free(), push_link_target(), run_client(), sandbox_free(), sandbox_free(), sandbox_realloc(), sandbox_realloc(), set_option(), start_civetweb(), start_http_server(), Tokenizer_delete(), Tokenizer_next(), Tokenizer_set(), and Xml_load().
#define FUNCTION_MAY_BE_UNUSED |
Definition at line 316 of file civetweb.c.
#define HEXTOI | ( | x | ) | (isdigit(x) ? (x - '0') : (x - 'W')) |
#define HTTP1_only |
Definition at line 6609 of file civetweb.c.
Referenced by handle_request().
Definition at line 291 of file civetweb.c.
Referenced by alloc_vprintf(), close_all_listening_sockets(), mg_cry_internal_impl(), and remove_directory().
#define INITIAL_DEPTH 9 |
Definition at line 8715 of file civetweb.c.
Referenced by authorize().
#define INT64_FMT PRId64 |
Definition at line 926 of file civetweb.c.
Referenced by construct_etag(), handle_cgi_request(), handle_static_file_request(), log_access(), mg_get_context_info(), parse_range_header(), and print_props().
#define INT64_MAX (9223372036854775807) |
Definition at line 513 of file civetweb.c.
Referenced by do_ssi_exec(), do_ssi_include(), handle_cgi_request(), handle_static_file_request(), mg_read_inner(), mg_send_file_body(), and send_file_data().
#define INVALID_SOCKET (-1) |
Definition at line 925 of file civetweb.c.
Referenced by accept_new_connection(), close_all_listening_sockets(), close_connection(), close_socket_gracefully(), connect_socket(), duk_trans_socket_finish(), duk_trans_socket_init(), duk_trans_socket_peek_cb(), duk_trans_socket_read_cb(), duk_trans_socket_waitconn(), duk_trans_socket_write_cb(), handle_cgi_request(), put_file(), and set_ports_option().
#define IP_ADDR_STR_LEN (50) /* IPv6 hex string is 46 chars */ |
Definition at line 1732 of file civetweb.c.
Referenced by accept_new_connection(), log_access(), mg_cry_internal_impl(), and prepare_cgi_environment().
#define LOCK_DURATION_S 60 |
Definition at line 2333 of file civetweb.c.
Referenced by dav_lock_file(), and print_props().
#define malloc DO_NOT_USE_THIS_FUNCTION__USE_mg_malloc |
Definition at line 1539 of file civetweb.c.
Referenced by buffer_init(), db_create_collation(), db_register_function(), duk_alloc_hybrid(), duk_alloc_hybrid_init(), duk_alloc_logging(), duk_alloc_torture(), duk_dvalue_alloc(), duk_dvalue_make_tag_data(), duk_realloc_logging(), duk_realloc_torture(), duk_trans_dvalue_init(), fetch_github_user(), handle_fh(), handle_fh(), handle_fh(), handle_interactive(), handle_interactive(), init_system_info(), lfs_lock_dir(), mg_malloc(), my_cooperate(), sandbox_alloc(), sandbox_alloc(), sandbox_realloc(), sandbox_realloc(), sdup(), set_option(), Tokenizer_set(), and Xml_load().
#define MAX_CGI_ENVIR_VARS (256) /* in variables (count) */ |
Definition at line 493 of file civetweb.c.
Referenced by prepare_cgi_environment().
#define MAX_WORKER_THREADS (1024 * 64) /* in threads (count) */ |
Definition at line 465 of file civetweb.c.
Referenced by mg_start2().
#define MD5_STATIC static |
Definition at line 1724 of file civetweb.c.
#define MG_BUF_LEN (1024 * 8) |
Definition at line 498 of file civetweb.c.
Referenced by alloc_vprintf2(), authorize(), close_socket_gracefully(), discard_unread_request_data(), do_ssi_include(), forward_body_data(), mg_cry_internal_impl(), mg_send_http_error_impl(), mg_send_http_redirect(), mg_store_body(), mg_vprintf(), redirect_to_https_port(), send_file_data(), and send_ssi_file().
Definition at line 1498 of file civetweb.c.
Referenced by mg_connect_websocket_client_impl(), mg_set_handler_type(), mg_start2(), and mg_start_domain2().
#define mg_closedir | ( | x | ) | (closedir(x)) |
Definition at line 922 of file civetweb.c.
Referenced by remove_directory(), and scan_directory().
#define mg_cry DO_NOT_USE_THIS_FUNCTION__USE_mg_cry_internal |
Definition at line 3510 of file civetweb.c.
#define mg_cry_ctx_internal | ( | ctx, | |
fmt, | |||
... ) mg_cry_internal_wrap(NULL, ctx, __func__, __LINE__, fmt, __VA_ARGS__) |
Definition at line 2586 of file civetweb.c.
Referenced by accept_new_connection(), check_acl(), init_ssl_ctx(), init_ssl_ctx_impl(), mg_set_handler_type(), mg_start2(), mg_start_domain2(), refresh_trust(), set_gpass_option(), set_ports_option(), set_uid_option(), ssl_use_pem_file(), and worker_thread_run().
#define mg_cry_internal | ( | conn, | |
fmt, | |||
... ) mg_cry_internal_wrap(conn, NULL, __func__, __LINE__, fmt, __VA_ARGS__) |
Definition at line 2583 of file civetweb.c.
Referenced by addenv(), check_authorization(), close_socket_gracefully(), dav_mkcol(), do_ssi_exec(), do_ssi_include(), fclose_on_exec(), handle_cgi_request(), handle_request(), log_access(), mg_connect_client_impl(), mg_get_response_code_text(), mg_store_body(), mg_vsnprintf(), open_auth_file(), prepare_cgi_environment(), read_auth_file(), remove_bad_file(), remove_directory(), scan_directory(), send_file_data(), send_ssi_file(), set_close_on_exec(), spawn_process(), and sslize().
#define MG_FILE_COMPRESSION_SIZE_LIMIT (1024) /* in bytes */ |
Definition at line 478 of file civetweb.c.
Referenced by handle_static_file_request().
#define MG_FOPEN_MODE_APPEND (4) |
Definition at line 2849 of file civetweb.c.
Referenced by log_access(), mg_cry_internal_impl(), and mg_fopen().
#define MG_FOPEN_MODE_NONE (0) |
Definition at line 2840 of file civetweb.c.
#define MG_FOPEN_MODE_READ (1) |
Definition at line 2843 of file civetweb.c.
Referenced by check_authorization(), do_ssi_include(), handle_ssi_file_request(), handle_static_file_request(), is_authorized_for_put(), mg_check_digest_access_authentication(), mg_fopen(), mg_send_file_body(), open_auth_file(), and read_auth_file().
#define MG_FOPEN_MODE_WRITE (2) |
Definition at line 2846 of file civetweb.c.
Referenced by mg_fopen(), mg_store_body(), and put_file().
Definition at line 1500 of file civetweb.c.
#define mg_get_option DO_NOT_USE_THIS_FUNCTION_INTERNALLY__access_directly |
Definition at line 3185 of file civetweb.c.
Referenced by main().
Definition at line 1497 of file civetweb.c.
Referenced by dav_move_file(), handle_cgi_request(), handle_request(), interpret_uri(), mg_construct_local_link(), mg_strndup_ctx(), prepare_cgi_environment(), print_props(), ssl_get_client_cert_info(), and worker_thread_run().
#define mg_mkdir | ( | conn, | |
path, | |||
mode ) (mkdir(path, mode)) |
Definition at line 918 of file civetweb.c.
Referenced by dav_mkcol(), and put_dir().
#define mg_opendir | ( | conn, | |
x ) (opendir(x)) |
Definition at line 921 of file civetweb.c.
Referenced by remove_directory(), and scan_directory().
#define mg_pollfd pollfd |
Definition at line 948 of file civetweb.c.
Referenced by connect_socket(), master_thread_run(), pull_inner(), push_inner(), set_ports_option(), and sslize().
#define mg_readdir | ( | x | ) | (readdir(x)) |
Definition at line 923 of file civetweb.c.
Referenced by remove_directory(), and scan_directory().
#define mg_realloc_ctx | ( | a, | |
b, | |||
c ) mg_realloc(a, b) |
Definition at line 1499 of file civetweb.c.
Referenced by addenv(), and set_ports_option().
#define mg_remove | ( | conn, | |
x ) (remove(x)) |
Definition at line 919 of file civetweb.c.
Referenced by delete_file(), remove_bad_file(), and remove_directory().
#define mg_sleep | ( | x | ) | (usleep((x)*1000)) |
Definition at line 920 of file civetweb.c.
Referenced by mg_set_handler_type(), mg_stop(), push_inner(), and sslize().
#define mg_static_assert | ( | cond, | |
txt ) extern char static_assert_replacement[(cond) ? 1 : -1] |
Definition at line 126 of file civetweb.c.
#define MSG_NOSIGNAL (0) |
Definition at line 1735 of file civetweb.c.
Referenced by push_inner(), socket_write(), and socket_write().
#define NO_ALTERNATIVE_QUEUE |
Definition at line 152 of file civetweb.c.
#define NUM_WEBDAV_LOCKS 10 |
Definition at line 2330 of file civetweb.c.
Referenced by dav_lock_file(), dav_unlock_file(), and print_props().
#define O_BINARY (0) |
Definition at line 915 of file civetweb.c.
#define PASSWORDS_FILE_NAME ".htpasswd" |
Definition at line 482 of file civetweb.c.
Referenced by must_hide_file(), and open_auth_file().
#define realloc DO_NOT_USE_THIS_FUNCTION__USE_mg_realloc |
Definition at line 1541 of file civetweb.c.
Referenced by buffer_ensure_capacity(), duk__trans_buffer_ensure(), duk__trans_buffer_ensure(), duk_realloc_hybrid(), duk_realloc_logging(), get_dir(), handle_fh(), handle_fh(), l_alloc(), l_alloc(), l_alloc(), l_alloc(), mg_realloc(), push_link_target(), sandbox_realloc(), sandbox_realloc(), set_option(), and Tokenizer_append().
#define SHUTDOWN_BOTH (2) |
Definition at line 518 of file civetweb.c.
#define SHUTDOWN_RD (0) |
Definition at line 516 of file civetweb.c.
#define SHUTDOWN_WR (1) |
Definition at line 517 of file civetweb.c.
Referenced by close_socket_gracefully().
#define snprintf DO_NOT_USE_THIS_FUNCTION__USE_mg_snprintf |
Definition at line 1543 of file civetweb.c.
Referenced by fetch_github_user(), handle_file(), handle_file(), init_server_name(), process_command_line_arguments(), set_absolute_path(), wrapped_compile_execute(), wrapped_compile_execute(), and Xml_pushEncode().
#define SOCKET_TIMEOUT_QUANTUM (2000) /* in ms */ |
Definition at line 473 of file civetweb.c.
Referenced by master_thread_run(), mg_poll(), and push_inner().
#define SSL_LIB "libssl.so" |
Definition at line 908 of file civetweb.c.
Referenced by initialize_openssl().
#define STOP_FLAG_ASSIGN | ( | f, | |
v ) ((*(f)) = (v)) |
Definition at line 2324 of file civetweb.c.
Referenced by connect_socket(), master_thread_run(), mg_close_connection(), and mg_stop().
#define STOP_FLAG_IS_TWO | ( | f | ) | ((*(f)) == 2) |
Definition at line 2323 of file civetweb.c.
Referenced by mg_stop().
#define STOP_FLAG_IS_ZERO | ( | f | ) | ((*(f)) == 0) |
Definition at line 2322 of file civetweb.c.
Referenced by consume_socket(), master_thread_run(), mg_poll(), mg_start_domain2(), mg_write(), process_new_connection(), produce_socket(), pull_all(), pull_inner(), push_all(), push_inner(), read_message(), and sslize().
#define STRUCT_FILE_INITIALIZER |
Definition at line 1891 of file civetweb.c.
Referenced by check_authorization(), do_ssi_exec(), do_ssi_include(), handle_cgi_request(), handle_request(), is_authorized_for_put(), mg_check_digest_access_authentication(), mg_send_file_body(), mg_send_http_error_impl(), mg_send_mime_file2(), put_dir(), put_file(), and set_gpass_option().
#define UINT64_FMT PRIu64 |
Definition at line 927 of file civetweb.c.
Referenced by dav_lock_file(), mg_send_http_ok(), and send_authorization_request().
Definition at line 1860 of file civetweb.c.
Referenced by get_rel_url_at_current_server(), handle_request(), mg_get_server_ports(), and worker_thread_run().
#define UTF8_PATH_MAX (PATH_MAX) |
Definition at line 861 of file civetweb.c.
Referenced by check_authorization(), dav_lock_file(), dav_move_file(), dav_proppatch(), dav_unlock_file(), handle_cgi_request(), handle_request(), handle_static_file_request(), interpret_uri(), mg_modify_passwords_file_ha1(), mg_send_http_error_impl(), open_auth_file(), print_props(), put_dir(), remove_directory(), and scan_directory().
#define va_copy | ( | x, | |
y ) ((x) = (y)) |
Definition at line 1003 of file civetweb.c.
Referenced by alloc_vprintf(), alloc_vprintf2(), and mg_send_http_error_impl().
#define vsnprintf_impl vsnprintf |
Definition at line 897 of file civetweb.c.
Referenced by alloc_vprintf(), alloc_vprintf2(), mg_cry_internal_impl(), and mg_vsnprintf().
#define WIN32_LEAN_AND_MEAN |
Definition at line 175 of file civetweb.c.
#define WINCDECL |
Definition at line 929 of file civetweb.c.
typedef const void* SOCK_OPT_TYPE |
Definition at line 863 of file civetweb.c.
typedef int SOCKET |
Definition at line 928 of file civetweb.c.
typedef int volatile stop_flag_t |
Definition at line 2321 of file civetweb.c.
anonymous enum |
Definition at line 1918 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
REQUEST_HANDLER | |
WEBSOCKET_HANDLER | |
AUTH_HANDLER |
Definition at line 2225 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
CONTEXT_INVALID | |
CONTEXT_SERVER | |
CONTEXT_HTTP_CLIENT | |
CONTEXT_WS_CLIENT |
Definition at line 2261 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
CONNECTION_TYPE_INVALID | |
CONNECTION_TYPE_REQUEST | |
CONNECTION_TYPE_RESPONSE |
Definition at line 2459 of file civetweb.c.
anonymous enum |
Enumerator | |
---|---|
PROTOCOL_TYPE_HTTP1 | |
PROTOCOL_TYPE_WEBSOCKET | |
PROTOCOL_TYPE_HTTP2 |
Definition at line 2465 of file civetweb.c.
|
static |
Definition at line 11552 of file civetweb.c.
References DEBUG_TRACE, mg_atomic_dec(), mg_free(), process_control_data::pid, and process_control_data::references.
Referenced by handle_cgi_request().
|
static |
Definition at line 19957 of file civetweb.c.
References check_acl(), closesocket, mg_domain_context::config, CONFIG_TCP_NODELAY, mg_context::dd, DEBUG_TRACE, ERRNO, socket::in_use, INVALID_SOCKET, IP_ADDR_STR_LEN, socket::is_ssl, socket::lsa, mg_cry_ctx_internal, NULL, produce_socket(), socket::rsa, usa::sa, set_close_on_exec(), set_non_blocking_mode(), set_tcp_nodelay(), socket::sock, sockaddr_to_string(), and socket::ssl_redir.
Referenced by master_thread_run().
|
static |
Definition at line 11284 of file civetweb.c.
References CGI_ENVIRONMENT_SIZE, mg_cry_internal, mg_realloc_ctx, and mg_vsnprintf().
|
static |
Referenced by prepare_cgi_environment().
|
static |
Definition at line 6996 of file civetweb.c.
References alloc_vprintf(), and NULL.
|
static |
Definition at line 6939 of file civetweb.c.
References alloc_vprintf2(), IGNORE_UNUSED_RESULT, mg_malloc(), NULL, va_copy, and vsnprintf_impl.
Referenced by alloc_printf(), and mg_vprintf().
|
static |
Definition at line 6906 of file civetweb.c.
References MG_BUF_LEN, mg_free(), mg_malloc(), NULL, va_copy, and vsnprintf_impl.
Referenced by alloc_vprintf().
|
static |
Definition at line 8861 of file civetweb.c.
References read_auth_file_struct::ah, AUTHENTICATION_DOMAIN, read_auth_file_struct::buf, mg_domain_context::config, read_auth_file_struct::conn, mg_connection::dom_ctx, read_auth_file_struct::domain, INITIAL_DEPTH, MG_BUF_LEN, mg_strdup_ctx(), parse_auth_header(), mg_connection::phys_ctx, read_auth_file(), mg_request_info::remote_user, mg_connection::request_info, and ah::user.
Referenced by check_authorization(), is_authorized_for_put(), and mg_check_digest_access_authentication().
|
static |
Definition at line 7358 of file civetweb.c.
Referenced by mg_base64_decode().
|
static |
Definition at line 8389 of file civetweb.c.
References vec::len.
Referenced by mg_md5().
|
static |
Definition at line 16229 of file civetweb.c.
References ACCESS_CONTROL_LIST, mg_domain_context::config, mg_context::dd, vec::len, mg_cry_ctx_internal, next_option(), NULL, parse_match_net(), and vec::ptr.
Referenced by accept_new_connection(), and set_acl_option().
|
static |
Definition at line 8918 of file civetweb.c.
References mg_file::access, authorize(), mg_domain_context::config, mg_connection::dom_ctx, is_file_opened(), vec::len, mg_request_info::local_uri, mg_cry_internal, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_READ, mg_snprintf(), next_option(), NULL, open_auth_file(), PROTECT_URI, vec::ptr, mg_connection::request_info, STRUCT_FILE_INITIALIZER, and UTF8_PATH_MAX.
Referenced by handle_request().
|
static |
Definition at line 8427 of file civetweb.c.
References mg_md5(), mg_strcasecmp(), and NULL.
Referenced by read_auth_file().
|
static |
Definition at line 15456 of file civetweb.c.
References closesocket, IGNORE_UNUSED_RESULT, INVALID_SOCKET, mg_context::listening_socket_fds, mg_context::listening_sockets, socket::lsa, mg_free(), NULL, mg_context::num_listening_sockets, usa::sin, and socket::sock.
Referenced by master_thread_run(), and set_ports_option().
|
static |
Definition at line 17864 of file civetweb.c.
References mg_context::callbacks, mg_connection::client, close_socket_gracefully(), closesocket, mg_callbacks::connection_close, mg_callbacks::connection_closed, CONTEXT_SERVER, mg_context::context_type, INVALID_SOCKET, mg_lock_connection(), mg_set_user_connection_data(), mg_unlock_connection(), mg_connection::must_close, NULL, mg_connection::phys_ctx, socket::sock, and mg_connection::ssl.
Referenced by mg_close_connection(), process_new_connection(), and worker_thread_run().
|
static |
Definition at line 17740 of file civetweb.c.
References mg_connection::client, closesocket, mg_domain_context::config, mg_connection::dom_ctx, ERRNO, INVALID_SOCKET, LINGER_TIMEOUT, MG_BUF_LEN, mg_cry_internal, NULL, pull_inner(), set_blocking_mode(), SHUTDOWN_WR, and socket::sock.
Referenced by close_connection().
|
static |
Definition at line 9716 of file civetweb.c.
Referenced by handle_directory_request().
|
static |
Definition at line 9287 of file civetweb.c.
References CIVETWEB_API, closesocket, ERRNO, error(), INVALID_SOCKET, is_valid_port(), MG_ERROR_DATA_CODE_CONNECT_FAILED, MG_ERROR_DATA_CODE_CONNECT_TIMEOUT, MG_ERROR_DATA_CODE_HOST_NOT_FOUND, MG_ERROR_DATA_CODE_INIT_LIBRARY_FAILED, MG_ERROR_DATA_CODE_INVALID_PARAM, MG_ERROR_DATA_CODE_OS_ERROR, mg_free(), mg_inet_pton(), mg_poll(), mg_pollfd, mg_snprintf(), mg_strdup_ctx(), NULL, set_close_on_exec(), set_non_blocking_mode(), usa::sin, mg_context::stop_flag, and STOP_FLAG_ASSIGN.
Referenced by mg_connect_client_impl().
|
static |
Definition at line 10181 of file civetweb.c.
References INT64_FMT, mg_file_stat::last_modified, mg_snprintf(), NULL, and mg_file_stat::size.
Referenced by handle_not_modified_static_file_request(), handle_static_file_request(), and is_not_modified().
|
static |
Definition at line 19624 of file civetweb.c.
References DEBUG_TRACE, socket::sock, mg_context::sq_empty, mg_context::sq_full, mg_context::sq_head, mg_context::sq_size, mg_context::sq_tail, mg_context::squeue, mg_context::stop_flag, STOP_FLAG_IS_ZERO, and mg_context::thread_mutex.
Referenced by worker_thread_run().
|
static |
Definition at line 12802 of file civetweb.c.
References mg_connection::dom_ctx, LOCK_DURATION_S, twebdav_lock::locktime, mg_get_current_time_ns(), mg_get_request_link(), mg_lock_context(), mg_md5(), mg_printf(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_strlcpy(), mg_unlock_context(), mg_connection::must_close, NULL, NUM_WEBDAV_LOCKS, twebdav_lock::path, mg_connection::phys_ctx, mg_request_info::remote_user, mg_connection::request_info, s, send_additional_header(), send_static_cache_header(), twebdav_lock::token, UINT64_FMT, twebdav_lock::user, UTF8_PATH_MAX, and mg_context::webdav_lock.
Referenced by handle_request().
|
static |
Definition at line 11915 of file civetweb.c.
References mg_connection::data_len, DEBUG_TRACE, ERRNO, de::file, mg_file_stat::last_modified, mg_cry_internal, mg_mkdir, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_stat(), NULL, mg_connection::request_len, send_additional_header(), and send_static_cache_header().
Referenced by handle_request().
|
static |
Definition at line 11994 of file civetweb.c.
References ARRAY_SIZE, mg_domain_context::config, DEBUG_TRACE, DOCUMENT_ROOT, mg_connection::dom_ctx, FALSE, get_rel_url_at_current_server(), get_uri_type(), mg_free(), mg_get_header(), mg_malloc_ctx, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_snprintf(), mg_stat(), mg_strdup_ctx(), mg_url_decode(), NULL, mg_connection::phys_ctx, remove_dot_segments(), TRUE, and UTF8_PATH_MAX.
Referenced by handle_request().
|
static |
Definition at line 12964 of file civetweb.c.
References mg_connection::dom_ctx, mg_get_request_link(), mg_printf(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_connection::must_close, twebdav_lock::path, send_additional_header(), send_static_cache_header(), and UTF8_PATH_MAX.
Referenced by handle_request().
|
static |
Definition at line 12931 of file civetweb.c.
References mg_connection::dom_ctx, mg_get_request_link(), mg_lock_context(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_unlock_context(), mg_connection::must_close, NUM_WEBDAV_LOCKS, twebdav_lock::path, mg_connection::phys_ctx, mg_request_info::remote_user, mg_connection::request_info, UTF8_PATH_MAX, and mg_context::webdav_lock.
Referenced by handle_request().
|
static |
Definition at line 12293 of file civetweb.c.
References DEBUG_TRACE, ERRNO, de::file, mg_file_stat::is_directory, mg_remove, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_stat(), remove_directory(), send_additional_header(), and send_no_cache_header().
Referenced by handle_request().
|
static |
Definition at line 9911 of file civetweb.c.
References dir_scan_data::arr_size, dir_scan_data::entries, de::file, de::file_name, mg_realloc(), mg_strdup(), NULL, and dir_scan_data::num_entries.
Referenced by handle_directory_request().
|
static |
Definition at line 6484 of file civetweb.c.
References MG_BUF_LEN, and mg_read().
Referenced by handle_request().
|
static |
Definition at line 12443 of file civetweb.c.
References mg_file::access, ERRNO, mg_file_access::fp, INT64_MAX, mg_cry_internal, NULL, send_file_data(), and STRUCT_FILE_INITIALIZER.
Referenced by send_ssi_file().
|
static |
Definition at line 12358 of file civetweb.c.
References mg_file::access, mg_domain_context::config, DOCUMENT_ROOT, mg_connection::dom_ctx, ERRNO, fclose_on_exec(), de::file_name, INT64_MAX, MG_BUF_LEN, mg_cry_internal, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_READ, mg_snprintf(), NULL, send_file_data(), send_ssi_file(), SSI_EXTENSIONS, and STRUCT_FILE_INITIALIZER.
Referenced by send_ssi_file().
|
static |
Definition at line 7504 of file civetweb.c.
References CGI2_EXTENSIONS, CGI_EXTENSIONS, mg_domain_context::config, mg_connection::dom_ctx, NULL, and PUT_DELETE_PASSWORDS_FILE.
Referenced by interpret_uri().
|
static |
Definition at line 7550 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, and SSI_EXTENSIONS.
Referenced by interpret_uri().
|
static |
Definition at line 3470 of file civetweb.c.
References mg_context::dd, mg_connection::dom_ctx, and mg_connection::phys_ctx.
Referenced by master_thread_run(), mg_cry_internal_wrap(), set_close_on_exec(), and set_gpass_option().
|
static |
Definition at line 10196 of file civetweb.c.
References ERRNO, mg_file_access::fp, mg_cry_internal, and NULL.
Referenced by do_ssi_include(), handle_ssi_file_request(), handle_static_file_request(), mg_send_file_body(), and put_file().
|
static |
Definition at line 11184 of file civetweb.c.
References mg_connection::consumed_content, DEBUG_ASSERT, MG_BUF_LEN, mg_get_header(), mg_printf(), mg_read(), mg_send_http_error(), mg_strcasecmp(), NULL, mg_connection::phys_ctx, push_all(), and mg_connection::status_code.
Referenced by handle_cgi_request(), and put_file().
|
static |
Definition at line 20249 of file civetweb.c.
References mg_context::callbacks, mg_domain_context::config, mg_context::dd, mg_callbacks::exit_context, mg_callbacks::external_ssl_ctx, mg_domain_context::handlers, mg_free(), mg_handler_info::next, mg_context::nonce_mutex, NULL, NUM_OPTIONS, mg_context::sq_empty, mg_context::sq_full, mg_context::squeue, mg_domain_context::ssl_ctx, mg_context::systemName, mg_context::thread_mutex, mg_handler_info::uri, mg_context::user_data, mg_context::worker_connections, and mg_context::worker_threadids.
Referenced by mg_start2(), and mg_stop().
|
static |
Definition at line 14121 of file civetweb.c.
References socket::is_ssl, and mg_context::listening_sockets.
Referenced by handle_request().
|
static |
Definition at line 3820 of file civetweb.c.
References mg_strcasecmp(), name, NULL, and mg_header::value.
Referenced by get_host_from_request_info(), get_request(), get_response(), handle_cgi_request(), handle_request(), and mg_get_header().
|
static |
Definition at line 14136 of file civetweb.c.
References DEBUG_TRACE, get_header(), mg_request_info::http_headers, vec::len, NULL, mg_request_info::num_headers, and vec::ptr.
Referenced by switch_domain_context().
|
static |
Definition at line 7952 of file civetweb.c.
Referenced by parse_http_request(), parse_http_response(), and read_message().
|
static |
Definition at line 10880 of file civetweb.c.
References http_methods, mg_http_method_info::name, and NULL.
Referenced by is_valid_http_method().
|
static |
Definition at line 3876 of file civetweb.c.
References mg_connection::connection_type, CONNECTION_TYPE_REQUEST, CONNECTION_TYPE_RESPONSE, mg_request_info::http_version, mg_response_info::http_version, NULL, mg_connection::request_info, and mg_connection::response_info.
Referenced by should_keep_alive().
|
static |
Definition at line 18569 of file civetweb.c.
References mg_connection::buf, mg_connection::buf_size, mg_connection::data_len, DEBUG_ASSERT, mg_snprintf(), mg_connection::must_close, NULL, read_message(), mg_connection::req_time, mg_connection::request_len, and reset_per_request_attributes().
Referenced by get_request(), and get_response().
|
static |
Definition at line 8354 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, EXTRA_MIME_TYPES, vec::len, mg_get_builtin_mime_type(), mg_strncasecmp(), next_option(), NULL, and vec::ptr.
Referenced by handle_static_file_request().
|
static |
Definition at line 7989 of file civetweb.c.
References ARRAY_SIZE, month_names, and s.
Referenced by parse_date_string().
|
static |
Definition at line 3159 of file civetweb.c.
References config_options, mg_option::name, name, and NULL.
Referenced by mg_get_option(), mg_start2(), and mg_start_domain2().
|
static |
Definition at line 3574 of file civetweb.c.
References mg_request_info::is_ssl, proto, mg_connection::protocol_type, PROTOCOL_TYPE_WEBSOCKET, and mg_connection::request_info.
Referenced by mg_construct_local_link().
|
static |
Definition at line 5909 of file civetweb.c.
References mg_get_current_time_ns().
Referenced by mg_start2(), and mg_start_domain2().
|
static |
Definition at line 18465 of file civetweb.c.
References abs_uri_protocols, AUTHENTICATION_DOMAIN, mg_connection::client, mg_domain_context::config, mg_connection::dom_ctx, ENABLE_AUTH_DOMAIN_CHECK, is_valid_port(), socket::lsa, mg_strcasecmp(), mg_strncasecmp(), NULL, proto, proto_len, and USA_IN_PORT_UNSAFE.
Referenced by dav_move_file(), and process_new_connection().
|
static |
Definition at line 3836 of file civetweb.c.
References mg_request_info::http_headers, mg_strcasecmp(), mg_header::name, name, mg_request_info::num_headers, output, and mg_header::value.
Referenced by should_switch_to_protocol().
|
static |
Definition at line 18645 of file civetweb.c.
References mg_connection::accept_gzip, mg_connection::buf, mg_connection::buf_size, mg_connection::connection_type, CONNECTION_TYPE_REQUEST, mg_connection::content_len, mg_request_info::content_length, get_header(), get_message(), mg_request_info::http_headers, mg_connection::is_chunked, mg_snprintf(), mg_strcasecmp(), NULL, mg_request_info::num_headers, parse_http_request(), mg_connection::request_info, and switch_domain_context().
Referenced by process_new_connection().
|
static |
Definition at line 14560 of file civetweb.c.
References mg_handler_info::auth_handler, mg_handler_info::cbdata, mg_handler_info::close_handler, mg_handler_info::connect_handler, mg_handler_info::data_handler, mg_connection::dom_ctx, mg_handler_info::handler, mg_handler_info::handler_type, mg_domain_context::handlers, mg_request_info::local_uri, mg_get_request_info(), mg_lock_context(), mg_unlock_context(), mg_handler_info::next, NULL, mg_connection::phys_ctx, mg_handler_info::ready_handler, mg_handler_info::refcount, mg_handler_info::removing, REQUEST_HANDLER, mg_handler_info::subprotocols, mg_handler_info::uri, mg_handler_info::uri_len, and WEBSOCKET_HANDLER.
Referenced by handle_request().
|
static |
Definition at line 18737 of file civetweb.c.
References mg_connection::buf, mg_connection::buf_size, mg_connection::connection_type, CONNECTION_TYPE_RESPONSE, mg_connection::content_len, mg_request_info::content_length, mg_response_info::content_length, get_header(), get_message(), mg_response_info::http_headers, mg_connection::is_chunked, mg_snprintf(), mg_strcasecmp(), NULL, mg_response_info::num_headers, parse_http_response(), mg_connection::request_info, mg_connection::response_info, and mg_response_info::status_code.
Referenced by mg_connect_websocket_client_impl(), mg_download(), and mg_get_response().
|
static |
Definition at line 20389 of file civetweb.c.
References FALSE, mg_strdup(), and name.
Referenced by mg_start2().
|
static |
Definition at line 18395 of file civetweb.c.
References abs_uri_protocols, is_valid_port(), mg_strncasecmp(), NULL, proto, and proto_len.
Referenced by dav_move_file(), and process_new_connection().
|
static |
Definition at line 3341 of file civetweb.c.
References mg_strlcpy(), and NULL.
Referenced by handle_directory_request(), handle_not_modified_static_file_request(), handle_request(), handle_ssi_file_request(), handle_static_file_request(), mg_get_context_info(), and print_props().
|
static |
Definition at line 11587 of file civetweb.c.
References abort_cgi_process(), mg_file::access, cgi_environment::buf, CGI_BUFFERING, mg_domain_context::config, config_options, mg_connection::content_len, DEBUG_TRACE, mg_connection::dom_ctx, ERRNO, forward_body_data(), mg_file_access::fp, get_header(), mg_request_info::http_headers, INT64_FMT, INT64_MAX, INVALID_SOCKET, mg_connection::is_chunked, mg_context::max_request_size, mg_cry_internal, mg_free(), mg_malloc_ctx, mg_printf(), mg_send_http_error(), mg_snprintf(), mg_strcasecmp(), mg_write(), mg_connection::must_close, mg_header::name, NULL, mg_request_info::num_headers, parse_http_headers(), mg_connection::phys_ctx, process_control_data::pid, prepare_cgi_environment(), pull_all(), read_message(), process_control_data::references, REQUEST_TIMEOUT, send_file_data(), should_keep_alive(), spawn_process(), mg_connection::status_code, STRUCT_FILE_INITIALIZER, UTF8_PATH_MAX, mg_header::value, and cgi_environment::var.
Referenced by handle_file_based_request().
|
static |
Definition at line 9942 of file civetweb.c.
References compare_dir_entries(), dir_scan_callback(), dir_scan_data::entries, ERRNO, de::file_name, gmt_time_string(), mg_request_info::local_uri, mg_free(), mg_malloc(), mg_printf(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_strlcpy(), mg_connection::must_close, NULL, dir_scan_data::num_entries, print_dir_entry(), mg_request_info::query_string, mg_connection::request_info, scan_directory(), send_additional_header(), send_static_cache_header(), and mg_connection::status_code.
Referenced by handle_request(), and mg_send_mime_file2().
|
static |
Definition at line 15354 of file civetweb.c.
References CGI2_EXTENSIONS, CGI_EXTENSIONS, mg_domain_context::config, mg_connection::dom_ctx, handle_cgi_request(), handle_not_modified_static_file_request(), handle_ssi_file_request(), handle_static_file_request(), mg_connection::in_error_handler, is_in_script_path(), is_not_modified(), mg_send_http_error(), NULL, PUT_DELETE_PASSWORDS_FILE, SSI_EXTENSIONS, and mg_file::stat.
Referenced by handle_request(), and mg_send_http_error_impl().
|
static |
Definition at line 10483 of file civetweb.c.
References construct_etag(), gmt_time_string(), mg_file_stat::last_modified, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), NULL, send_additional_header(), send_static_cache_header(), and mg_file::stat.
Referenced by handle_file_based_request(), handle_request(), and mg_send_mime_file2().
|
static |
Definition at line 12759 of file civetweb.c.
References mg_domain_context::config, depth, mg_connection::dom_ctx, ENABLE_DIRECTORY_LISTING, mg_file_stat::is_directory, mg_request_info::local_uri, mg_get_header(), mg_printf(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_strcasecmp(), mg_connection::must_close, NULL, print_dav_dir_entry(), print_props(), mg_connection::request_info, scan_directory(), send_additional_header(), and send_static_cache_header().
Referenced by handle_request().
|
static |
Definition at line 14704 of file civetweb.c.
References ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, AUTH_HANDLER, mg_callbacks::begin_request, mg_context::callbacks, check_authorization(), mg_connection::client, mg_domain_context::config, dav_lock_file(), dav_mkcol(), dav_move_file(), dav_proppatch(), dav_unlock_file(), DEBUG_ASSERT, DEBUG_TRACE, delete_file(), discard_unread_request_data(), DOCUMENT_ROOT, mg_connection::dom_ctx, ENABLE_DIRECTORY_LISTING, ENABLE_WEBDAV, get_first_ssl_listener_index(), get_header(), get_request_handler(), gmt_time_string(), handle_directory_request(), handle_file_based_request(), handle_not_modified_static_file_request(), handle_propfind(), handle_static_file_request(), HTTP1_only, mg_request_info::http_headers, mg_connection::in_error_handler, interpret_uri(), is_authorized_for_put(), mg_file_stat::is_directory, is_in_script_path(), is_not_modified(), is_put_or_delete_method(), socket::is_ssl, mg_context::listening_sockets, mg_request_info::local_uri, mg_request_info::local_uri_raw, socket::lsa, mg_cry_internal, mg_free(), mg_get_request_link(), mg_malloc_ctx, mg_printf(), mg_send_http_error(), mg_send_http_redirect(), mg_strcasecmp(), mg_strdup(), mg_connection::must_close, must_hide_file(), NULL, mg_request_info::num_headers, mg_connection::phys_ctx, mg_connection::protocol_type, PROTOCOL_TYPE_WEBSOCKET, PUT_DELETE_PASSWORDS_FILE, put_file(), mg_request_info::query_string, redirect_to_https_port(), release_handler_ref(), remove_dot_segments(), REQUEST_HANDLER, mg_connection::request_info, mg_request_info::request_method, mg_connection::request_state, mg_request_info::request_uri, socket::rsa, send_authorization_request(), send_options(), set_throttle(), should_decode_query_string(), should_decode_url(), socket::ssl_redir, mg_file::stat, mg_connection::status_code, STRUCT_FILE_INITIALIZER, mg_websocket_subprotocols::subprotocols, suggest_connection_header(), THROTTLE, mg_connection::throttle, url_decode_in_place(), USA_IN_PORT_UNSAFE, mg_context::user_data, UTF8_PATH_MAX, and WEBSOCKET_HANDLER.
Referenced by handle_request_stat_log().
|
static |
Definition at line 6562 of file civetweb.c.
References mg_context::callbacks, mg_connection::consumed_content, DEBUG_TRACE, mg_callbacks::end_request, handle_request(), log_access(), mg_difftimespec(), NULL, mg_connection::num_bytes_sent, mg_connection::phys_ctx, mg_connection::req_time, and mg_connection::status_code.
Referenced by process_new_connection().
|
static |
Definition at line 12588 of file civetweb.c.
References mg_file::access, ERRNO, fclose_on_exec(), gmt_time_string(), mg_fclose(), mg_fopen(), MG_FOPEN_MODE_READ, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_connection::must_close, NULL, send_additional_header(), send_cors_header(), send_no_cache_header(), and send_ssi_file().
Referenced by handle_file_based_request().
|
static |
Definition at line 10220 of file civetweb.c.
References mg_connection::accept_gzip, mg_file::access, construct_etag(), mg_connection::dom_ctx, ERRNO, fclose_on_exec(), get_mime_type(), gmt_time_string(), INT64_FMT, INT64_MAX, mg_file_stat::is_directory, mg_file_stat::is_gzipped, mg_file_stat::last_modified, vec::len, mg_fclose(), MG_FILE_COMPRESSION_SIZE_LIMIT, mg_fopen(), MG_FOPEN_MODE_READ, mg_get_header(), mg_response_header_add(), mg_response_header_add_lines(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_snprintf(), mg_stat(), mime_type, NULL, parse_range_header(), mg_connection::protocol_type, PROTOCOL_TYPE_HTTP1, vec::ptr, mg_connection::request_info, mg_request_info::request_method, send_additional_header(), send_cors_header(), send_file_data(), send_static_cache_header(), mg_file_stat::size, mg_file::stat, mg_connection::status_code, and UTF8_PATH_MAX.
Referenced by handle_file_based_request(), handle_request(), and mg_send_mime_file2().
|
static |
Definition at line 3956 of file civetweb.c.
References DEBUG_ASSERT, vec::len, mg_strncasecmp(), next_option(), NULL, and vec::ptr.
Referenced by should_keep_alive().
|
static |
Definition at line 16046 of file civetweb.c.
References mg_get_header(), and NULL.
Referenced by log_access().
|
static |
Definition at line 16594 of file civetweb.c.
Referenced by ssl_get_client_cert_info().
|
static |
Definition at line 19329 of file civetweb.c.
References mg_request_info::acceptedWebSocketSubprotocol, mg_context::callbacks, mg_domain_context::config, mg_connection::connection_type, CONNECTION_TYPE_INVALID, CONTEXT_SERVER, mg_context::context_type, mg_connection::data_len, mg_connection::dom_ctx, ENABLE_KEEP_ALIVE, mg_connection::handled_requests, mg_callbacks::init_connection, mg_set_user_connection_data(), mg_strcasecmp(), mg_connection::must_close, NULL, mg_connection::phys_ctx, and mg_connection::request_info.
Referenced by worker_thread_run().
|
static |
Definition at line 17485 of file civetweb.c.
References AUTHENTICATION_DOMAIN, mg_context::callbacks, mg_domain_context::config, config_options, mg_context::dd, mg_callbacks::external_ssl_ctx, mg_callbacks::external_ssl_ctx_domain, mg_callbacks::init_ssl, init_ssl_ctx_impl(), mg_callbacks::init_ssl_domain, initialize_openssl(), is_ssl_port_used(), LISTENING_PORTS, mg_cry_ctx_internal, name, NULL, SSL_CERTIFICATE, SSL_CERTIFICATE_CHAIN, mg_domain_context::ssl_ctx, and mg_context::user_data.
Referenced by mg_start2(), and mg_start_domain2().
|
static |
Definition at line 17239 of file civetweb.c.
References AUTHENTICATION_DOMAIN, mg_context::callbacks, mg_domain_context::config, mg_context::dd, mg_callbacks::init_ssl, mg_callbacks::init_ssl_domain, LISTENING_PORTS, mg_cry_ctx_internal, mg_strcasecmp(), NULL, SSL_CA_FILE, SSL_CA_PATH, SSL_CACHE_TIMEOUT, SSL_CIPHER_LIST, mg_domain_context::ssl_ctx, SSL_DEFAULT_VERIFY_PATHS, SSL_DO_VERIFY_PEER, ssl_error(), ssl_get_protocol(), ssl_info_callback(), SSL_PROTOCOL_VERSION, ssl_servername_callback(), ssl_use_pem_file(), SSL_VERIFY_DEPTH, and mg_context::user_data.
Referenced by init_ssl_ctx().
|
static |
Definition at line 16821 of file civetweb.c.
References CRYPTO_LIB, cryptolib_dll_handle, cryptolib_users, DEBUG_TRACE, load_tls_dll(), mg_atomic_inc(), mg_current_thread_id(), mg_free(), mg_malloc(), mg_snprintf(), NULL, pthread_mutex_attr, ssl_error(), SSL_LIB, ssl_locking_callback(), ssl_mutexes, and ssllib_dll_handle.
Referenced by init_ssl_ctx(), and mg_init_library().
|
static |
Definition at line 7622 of file civetweb.c.
References mg_connection::accept_gzip, ALLOW_INDEX_SCRIPT_SUB_RES, mg_domain_context::config, DEBUG_TRACE, DOCUMENT_ROOT, mg_connection::dom_ctx, extention_matches_script(), extention_matches_template_text(), is_civetweb_webdav_method(), mg_file_stat::is_directory, mg_file_stat::is_gzipped, is_put_or_delete_method(), vec::len, mg_request_info::local_uri, mg_free(), mg_get_header(), mg_malloc_ctx, mg_snprintf(), mg_stat(), mg_strcasecmp(), next_option(), NULL, mg_connection::path_info, mg_connection::phys_ctx, mg_connection::protocol_type, PROTOCOL_TYPE_WEBSOCKET, vec::ptr, mg_connection::request_info, substitute_index_file(), URL_REWRITE_PATTERN, and UTF8_PATH_MAX.
Referenced by handle_request().
|
static |
Definition at line 9035 of file civetweb.c.
References mg_file::access, authorize(), mg_domain_context::config, DEBUG_TRACE, mg_connection::dom_ctx, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_READ, NULL, PUT_DELETE_PASSWORDS_FILE, and STRUCT_FILE_INITIALIZER.
Referenced by handle_request().
|
static |
Definition at line 7482 of file civetweb.c.
References NULL, mg_connection::request_info, mg_request_info::request_method, and s.
Referenced by interpret_uri().
|
static |
Definition at line 2853 of file civetweb.c.
References mg_file_access::fp, and NULL.
Referenced by check_authorization().
|
static |
Definition at line 14645 of file civetweb.c.
Referenced by handle_file_based_request(), and handle_request().
|
static |
Definition at line 10468 of file civetweb.c.
References construct_etag(), mg_file_stat::last_modified, mg_get_header(), mg_strcasecmp(), NULL, and parse_date_string().
Referenced by handle_file_based_request(), handle_request(), and mg_send_mime_file2().
|
static |
Definition at line 7464 of file civetweb.c.
References NULL, mg_connection::request_info, mg_request_info::request_method, and s.
Referenced by handle_request(), and interpret_uri().
|
static |
Definition at line 15679 of file civetweb.c.
Referenced by init_ssl_ctx(), and legacy_init().
|
static |
Definition at line 10899 of file civetweb.c.
References get_http_method_info(), and NULL.
Referenced by parse_http_request().
|
static |
Definition at line 9239 of file civetweb.c.
Referenced by connect_socket(), get_rel_url_at_current_server(), get_uri_type(), and parse_port_string().
|
static |
Definition at line 20436 of file civetweb.c.
References config_options, mg_option::default_value, is_ssl_port_used(), LISTENING_PORTS, MG_FEATURES_DEFAULT, MG_FEATURES_TLS, mg_init_library(), and mg_option::name.
Referenced by mg_start2().
|
static |
Definition at line 16715 of file civetweb.c.
References DEBUG_TRACE, mg_snprintf(), and NULL.
Referenced by initialize_openssl().
|
static |
Definition at line 16063 of file civetweb.c.
References mg_file::access, ACCESS_LOG_FILE, mg_context::callbacks, mg_connection::client, mg_domain_context::config, mg_connection::conn_birth_time, mg_connection::dom_ctx, mg_file_access::fp, header_val(), mg_request_info::http_version, INT64_FMT, IP_ADDR_STR_LEN, mg_callbacks::log_access, lua_getglobal, lua_pcall, LUA_TBOOLEAN, lua_toboolean(), lua_tolstring(), LUA_TSTRING, lua_type(), mg_cry_internal, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_APPEND, mg_snprintf(), mg_strlcpy(), NULL, mg_connection::num_bytes_sent, mg_connection::phys_ctx, mg_request_info::query_string, mg_request_info::remote_user, mg_connection::request_info, mg_request_info::request_method, mg_request_info::request_uri, socket::rsa, sockaddr_to_string(), and mg_connection::status_code.
Referenced by handle_request_stat_log().
|
static |
Definition at line 3012 of file civetweb.c.
References s.
Referenced by mg_strcasecmp(), mg_strncasecmp(), and set_throttle().
|
static |
Definition at line 20231 of file civetweb.c.
References master_thread_run(), and NULL.
Referenced by mg_start2().
|
static |
Definition at line 20044 of file civetweb.c.
References accept_new_connection(), mg_context::callbacks, mg_context::cfg_worker_threads, close_all_listening_sockets(), DEBUG_TRACE, mg_callbacks::exit_thread, fake_connection(), FALSE, mg_callbacks::init_thread, mg_workerTLS::is_master, mg_context::listening_socket_fds, mg_context::listening_sockets, lua_close(), lua_getglobal, lua_pcall, lua_pop, LUA_TFUNCTION, lua_type(), mg_join_thread(), mg_poll(), mg_pollfd, mg_set_thread_name(), NULL, mg_context::num_listening_sockets, socket::sock, SOCKET_TIMEOUT_QUANTUM, mg_context::sq_full, mg_context::start_time, sTlsKey, mg_context::stop_flag, STOP_FLAG_ASSIGN, STOP_FLAG_IS_ZERO, mg_context::thread_mutex, mg_workerTLS::user_ptr, and mg_context::worker_threadids.
Referenced by master_thread().
|
static |
Definition at line 1144 of file civetweb.c.
References mg_global_lock(), and mg_global_unlock().
Referenced by abort_cgi_process(), process_new_connection(), and uninitialize_openssl().
|
static |
Definition at line 1121 of file civetweb.c.
References mg_global_lock(), and mg_global_unlock().
Referenced by initialize_openssl(), mg_current_thread_id(), mg_start2(), process_new_connection(), and worker_thread_run().
CIVETWEB_API int mg_base64_decode | ( | const char * | src, |
size_t | src_len, | ||
unsigned char * | dst, | ||
size_t * | dst_len ) |
Definition at line 7383 of file civetweb.c.
References b64reverse(), and NULL.
Referenced by parse_auth_header().
CIVETWEB_API int mg_base64_encode | ( | const unsigned char * | src, |
size_t | src_len, | ||
char * | dst, | ||
size_t * | dst_len ) |
Definition at line 7305 of file civetweb.c.
References NULL.
|
static |
Definition at line 1480 of file civetweb.c.
References calloc.
Referenced by mg_connect_client_impl(), mg_modify_passwords_file_ha1(), and mg_start2().
CIVETWEB_API int mg_check_digest_access_authentication | ( | struct mg_connection * | conn, |
const char * | realm, | ||
const char * | filename ) |
Definition at line 8893 of file civetweb.c.
References mg_file::access, authorize(), mg_fclose(), mg_fopen(), MG_FOPEN_MODE_READ, and STRUCT_FILE_INITIALIZER.
CIVETWEB_API unsigned mg_check_feature | ( | unsigned | feature | ) |
Definition at line 21430 of file civetweb.c.
References MG_FEATURES_CACHE, MG_FEATURES_CGI, MG_FEATURES_COMPRESSION, MG_FEATURES_FILES, MG_FEATURES_HTTP2, MG_FEATURES_IPV6, MG_FEATURES_LUA, MG_FEATURES_SSJS, MG_FEATURES_SSL, MG_FEATURES_STATS, MG_FEATURES_WEBSOCKET, and MG_FEATURES_X_DOMAIN_SOCKET.
Referenced by mg_get_system_info(), and mg_init_library().
CIVETWEB_API void mg_close_connection | ( | struct mg_connection * | conn | ) |
Definition at line 17938 of file civetweb.c.
References mg_context::cfg_worker_threads, close_connection(), CONTEXT_HTTP_CLIENT, CONTEXT_SERVER, mg_context::context_type, CONTEXT_WS_CLIENT, mg_context::dd, mg_free(), mg_join_thread(), mg_connection::must_close, mg_connection::mutex, NULL, mg_connection::phys_ctx, mg_domain_context::ssl_ctx, mg_context::stop_flag, STOP_FLAG_ASSIGN, and mg_context::worker_threadids.
Referenced by mg_connect_websocket_client_impl(), mg_download(), and run_client().
CIVETWEB_API 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 18253 of file civetweb.c.
References error(), mg_client_options::host, mg_client_options::host_name, mg_connect_client_impl(), and mg_client_options::port.
Referenced by mg_download(), and run_client().
|
static |
Definition at line 18001 of file civetweb.c.
References mg_connection::buf, mg_connection::buf_size, mg_connection::client, mg_client_options::client_cert, closesocket, config_options, connect_socket(), CONTEXT_HTTP_CLIENT, mg_context::context_type, mg_context::dd, mg_connection::dom_ctx, ERRNO, error(), mg_client_options::host, socket::is_ssl, socket::lsa, MAX_REQUEST_SIZE, mg_calloc(), mg_cry_internal, MG_ERROR_DATA_CODE_INIT_TLS_FAILED, MG_ERROR_DATA_CODE_OK, MG_ERROR_DATA_CODE_OS_ERROR, MG_ERROR_DATA_CODE_OUT_OF_MEMORY, MG_ERROR_DATA_CODE_TLS_CLIENT_CERT_ERROR, MG_ERROR_DATA_CODE_TLS_CONNECT_ERROR, MG_ERROR_DATA_CODE_TLS_SERVER_CERT_ERROR, mg_free(), mg_snprintf(), mg_connection::mutex, NULL, mg_connection::phys_ctx, mg_client_options::port, pthread_mutex_attr, socket::rsa, usa::sa, mg_client_options::server_cert, usa::sin, socket::sock, mg_domain_context::ssl_ctx, ssl_error(), ssl_use_pem_file(), and sslize().
Referenced by mg_connect_client(), mg_connect_client_secure(), and mg_connect_websocket_client_impl().
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 18237 of file civetweb.c.
References error(), and mg_connect_client_impl().
CIVETWEB_API 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 19212 of file civetweb.c.
References close_func(), mg_client_options::host, mg_connect_websocket_client_impl(), NULL, and mg_client_options::port.
CIVETWEB_API struct mg_connection * mg_connect_websocket_client_extensions | ( | const char * | host, |
int | port, | ||
int | use_ssl, | ||
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
const char * | extensions, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data ) |
Definition at line 19269 of file civetweb.c.
References close_func(), mg_client_options::host, mg_connect_websocket_client_impl(), and mg_client_options::port.
|
static |
Definition at line 18997 of file civetweb.c.
References websocket_client_thread_data::callback_data, mg_context::cfg_worker_threads, close_func(), websocket_client_thread_data::close_handler, websocket_client_thread_data::conn, mg_context::context_type, CONTEXT_WS_CLIENT, websocket_client_thread_data::data_handler, mg_connection::data_len, DEBUG_TRACE, error(), get_response(), mg_client_options::host, mg_request_info::local_uri, mg_request_info::local_uri_raw, mg_calloc_ctx, mg_close_connection(), mg_connect_client_impl(), mg_free(), mg_printf(), mg_snprintf(), mg_start_thread_with_id(), NULL, mg_connection::phys_ctx, mg_connection::request_info, mg_request_info::request_uri, mg_connection::response_info, mg_response_info::status_code, mg_context::user_data, and mg_context::worker_threadids.
Referenced by mg_connect_websocket_client(), mg_connect_websocket_client_extensions(), mg_connect_websocket_client_secure(), and mg_connect_websocket_client_secure_extensions().
CIVETWEB_API struct mg_connection * mg_connect_websocket_client_secure | ( | const struct mg_client_options * | client_options, |
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data ) |
Definition at line 19242 of file civetweb.c.
References close_func(), mg_connect_websocket_client_impl(), and NULL.
CIVETWEB_API struct mg_connection * mg_connect_websocket_client_secure_extensions | ( | const struct mg_client_options * | client_options, |
char * | error_buffer, | ||
size_t | error_buffer_size, | ||
const char * | path, | ||
const char * | origin, | ||
const char * | extensions, | ||
mg_websocket_data_handler | data_func, | ||
mg_websocket_close_handler | close_func, | ||
void * | user_data ) |
Definition at line 19300 of file civetweb.c.
References close_func(), mg_connect_websocket_client_impl(), and NULL.
|
static |
Definition at line 3601 of file civetweb.c.
References AUTHENTICATION_DOMAIN, mg_connection::client, mg_domain_context::config, default_port, mg_connection::dom_ctx, ENABLE_AUTH_DOMAIN_CHECK, get_proto_name(), mg_request_info::is_ssl, mg_request_info::local_uri, socket::lsa, mg_free(), mg_malloc_ctx, mg_snprintf(), mg_strcasecmp(), mg_url_encode(), NULL, mg_connection::phys_ctx, proto, mg_connection::request_info, mg_request_info::request_uri, usa::sa, mg_request_info::server_port, and sockaddr_to_string().
Referenced by mg_get_request_link(), print_props(), and redirect_to_https_port().
CIVETWEB_API void mg_cry | ( | const struct mg_connection * | conn, |
const char * | fmt, | ||
... ) |
Definition at line 3501 of file civetweb.c.
References mg_cry_internal_impl().
|
static |
Definition at line 3382 of file civetweb.c.
References mg_file::access, mg_context::callbacks, mg_connection::client, mg_domain_context::config, DEBUG_TRACE, mg_connection::dom_ctx, ERROR_LOG_FILE, mg_file_access::fp, IGNORE_UNUSED_RESULT, IP_ADDR_STR_LEN, mg_callbacks::log_message, MG_BUF_LEN, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_APPEND, NULL, mg_connection::phys_ctx, mg_connection::request_info, mg_request_info::request_method, mg_request_info::request_uri, socket::rsa, sockaddr_to_string(), and vsnprintf_impl.
Referenced by mg_cry(), and mg_cry_internal_wrap().
|
static |
Definition at line 3481 of file civetweb.c.
References fake_connection(), and mg_cry_internal_impl().
|
static |
Definition at line 1626 of file civetweb.c.
References mg_workerTLS::is_master, mg_atomic_inc(), mg_malloc(), NULL, sTlsKey, mg_workerTLS::thread_idx, and thread_idx_max.
Referenced by initialize_openssl().
|
static |
Definition at line 3364 of file civetweb.c.
Referenced by handle_request_stat_log(), and read_message().
CIVETWEB_API void mg_disable_connection_keep_alive | ( | struct mg_connection * | conn | ) |
Definition at line 22042 of file civetweb.c.
References mg_connection::must_close, and NULL.
CIVETWEB_API 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 18874 of file civetweb.c.
References mg_connection::data_len, get_response(), mg_request_info::local_uri, mg_close_connection(), mg_connect_client(), mg_snprintf(), mg_vprintf(), NULL, mg_connection::request_info, and mg_request_info::request_uri.
CIVETWEB_API unsigned mg_exit_library | ( | void | ) |
Definition at line 22477 of file civetweb.c.
References all_methods, global_lock_mutex, mg_free(), mg_global_lock(), mg_global_unlock(), mg_init_library_called, NULL, pthread_mutex_attr, sTlsKey, and uninitialize_openssl().
Referenced by run_client().
|
static |
Definition at line 2986 of file civetweb.c.
References mg_file_access::fp, and NULL.
Referenced by check_authorization(), do_ssi_include(), handle_ssi_file_request(), handle_static_file_request(), is_authorized_for_put(), log_access(), mg_check_digest_access_authentication(), mg_cry_internal_impl(), mg_send_file_body(), mg_store_body(), put_file(), and read_auth_file().
|
static |
Definition at line 12467 of file civetweb.c.
References mg_file::access, mg_file_access::fp, and NULL.
Referenced by send_ssi_file().
|
static |
Definition at line 8696 of file civetweb.c.
References mg_file::access, mg_file_access::fp, and NULL.
Referenced by read_auth_file().
|
static |
Definition at line 2915 of file civetweb.c.
References mg_file::access, ARRAY_SIZE, mg_file_access::fp, MG_FOPEN_MODE_APPEND, MG_FOPEN_MODE_READ, MG_FOPEN_MODE_WRITE, mg_path_suspicious(), mg_stat(), NULL, and mg_file::stat.
Referenced by check_authorization(), do_ssi_include(), handle_ssi_file_request(), handle_static_file_request(), is_authorized_for_put(), log_access(), mg_check_digest_access_authentication(), mg_cry_internal_impl(), mg_send_file_body(), mg_store_body(), open_auth_file(), put_file(), and read_auth_file().
|
static |
Definition at line 1492 of file civetweb.c.
References free.
Referenced by abort_cgi_process(), alloc_vprintf2(), close_all_listening_sockets(), connect_socket(), dav_move_file(), free_context(), handle_cgi_request(), handle_directory_request(), handle_request(), initialize_openssl(), interpret_uri(), mg_close_connection(), mg_connect_client_impl(), mg_connect_websocket_client_impl(), mg_construct_local_link(), mg_exit_library(), mg_modify_passwords_file_ha1(), mg_set_handler_type(), mg_start2(), mg_start_domain2(), mg_vprintf(), prepare_cgi_environment(), print_dir_entry(), print_props(), process_new_connection(), reset_per_request_attributes(), set_ports_option(), ssl_get_client_cert_info(), tls_dtor(), uninitialize_openssl(), and worker_thread_run().
CIVETWEB_API const char * mg_get_builtin_mime_type | ( | const char * | path | ) |
Definition at line 8332 of file civetweb.c.
References builtin_mime_types, ext_len, extension, mg_strcasecmp(), and NULL.
Referenced by get_mime_type().
CIVETWEB_API struct mg_context * mg_get_context | ( | const struct mg_connection * | conn | ) |
Definition at line 3188 of file civetweb.c.
References NULL, and mg_connection::phys_ctx.
Referenced by mg_get_user_context_data().
CIVETWEB_API int mg_get_context_info | ( | const struct mg_context * | ctx, |
char * | buffer, | ||
int | buflen ) |
Definition at line 21843 of file civetweb.c.
References block(), gmt_time_string(), INT64_FMT, mg_snprintf(), mg_str_append(), NULL, mg_context::sq_blocked, mg_context::sq_head, mg_context::sq_size, mg_context::sq_tail, and mg_context::start_time.
CIVETWEB_API int mg_get_cookie | ( | const char * | cookie_header, |
const char * | var_name, | ||
char * | dst, | ||
size_t | dst_size ) |
Definition at line 7256 of file civetweb.c.
References mg_strcasestr(), mg_strlcpy(), NULL, and s.
|
static |
Definition at line 1676 of file civetweb.c.
Referenced by dav_lock_file(), get_random(), pull_all(), and push_inner().
CIVETWEB_API const char * mg_get_header | ( | const struct mg_connection * | conn, |
const char * | name ) |
Definition at line 3855 of file civetweb.c.
References mg_connection::connection_type, CONNECTION_TYPE_REQUEST, CONNECTION_TYPE_RESPONSE, get_header(), mg_request_info::http_headers, mg_response_info::http_headers, name, NULL, mg_request_info::num_headers, mg_response_info::num_headers, mg_connection::request_info, and mg_connection::response_info.
Referenced by dav_move_file(), forward_body_data(), handle_propfind(), handle_static_file_request(), header_val(), interpret_uri(), is_not_modified(), parse_auth_header(), prepare_cgi_environment(), put_file(), send_cors_header(), should_keep_alive(), and should_switch_to_protocol().
CIVETWEB_API const char * mg_get_option | ( | const struct mg_context * | ctx, |
const char * | name ) |
Definition at line 3173 of file civetweb.c.
References mg_domain_context::config, mg_context::dd, get_option_index(), name, and NULL.
CIVETWEB_API const struct mg_request_info * mg_get_request_info | ( | const struct mg_connection * | conn | ) |
Definition at line 3521 of file civetweb.c.
References mg_connection::connection_type, CONNECTION_TYPE_REQUEST, CONNECTION_TYPE_RESPONSE, mg_request_info::http_headers, mg_response_info::http_headers, NULL, mg_response_info::num_headers, mg_connection::request_info, mg_connection::response_info, mg_response_info::status_code, and sTlsKey.
Referenced by get_request_handler(), and user_handler().
CIVETWEB_API int mg_get_request_link | ( | const struct mg_connection * | conn, |
char * | buf, | ||
size_t | buflen ) |
Definition at line 3745 of file civetweb.c.
References mg_construct_local_link(), and NULL.
Referenced by dav_lock_file(), dav_proppatch(), dav_unlock_file(), and handle_request().
CIVETWEB_API int mg_get_response | ( | struct mg_connection * | conn, |
char * | ebuf, | ||
size_t | ebuf_len, | ||
int | timeout ) |
Definition at line 18822 of file civetweb.c.
References mg_domain_context::config, mg_connection::data_len, mg_connection::dom_ctx, get_response(), mg_request_info::local_uri, mg_request_info::local_uri_raw, mg_snprintf(), NULL, mg_connection::request_info, REQUEST_TIMEOUT, and mg_request_info::request_uri.
Referenced by run_client().
CIVETWEB_API const char * mg_get_response_code_text | ( | const struct mg_connection * | conn, |
int | response_code ) |
Definition at line 4176 of file civetweb.c.
References mg_cry_internal.
Referenced by mg_send_http_error_impl().
CIVETWEB_API const struct mg_response_info * mg_get_response_info | ( | const struct mg_connection * | conn | ) |
Definition at line 3561 of file civetweb.c.
References mg_connection::connection_type, CONNECTION_TYPE_RESPONSE, NULL, and mg_connection::response_info.
Referenced by run_client().
CIVETWEB_API int mg_get_server_ports | ( | const struct mg_context * | ctx, |
int | size, | ||
struct mg_server_port * | ports ) |
Definition at line 3248 of file civetweb.c.
References mg_server_port::is_redirect, socket::is_ssl, mg_server_port::is_ssl, mg_context::listening_sockets, socket::lsa, mg_context::num_listening_sockets, mg_server_port::port, mg_server_port::protocol, usa::sa, socket::ssl_redir, and USA_IN_PORT_UNSAFE.
CIVETWEB_API int mg_get_system_info | ( | char * | buffer, |
int | buflen ) |
Definition at line 21512 of file civetweb.c.
References block(), DUK_VERSION, LUA_RELEASE, LUA_VERSION_NUM, mg_check_feature(), MG_FEATURES_CACHE, MG_FEATURES_CGI, MG_FEATURES_FILES, MG_FEATURES_IPV6, MG_FEATURES_LUA, MG_FEATURES_SSJS, MG_FEATURES_SSL, MG_FEATURES_STATS, MG_FEATURES_WEBSOCKET, mg_snprintf(), mg_str_append(), mg_version(), name, and NULL.
Referenced by init_system_info().
CIVETWEB_API void * mg_get_thread_pointer | ( | const struct mg_connection * | conn | ) |
Definition at line 3209 of file civetweb.c.
References sTlsKey, mg_connection::tls_user_ptr, and mg_workerTLS::user_ptr.
CIVETWEB_API void * mg_get_user_connection_data | ( | const struct mg_connection * | conn | ) |
Definition at line 3238 of file civetweb.c.
References mg_request_info::conn_data, NULL, and mg_connection::request_info.
CIVETWEB_API void * mg_get_user_context_data | ( | const struct mg_connection * | conn | ) |
Definition at line 3202 of file civetweb.c.
References mg_get_context(), and mg_get_user_data().
CIVETWEB_API void * mg_get_user_data | ( | const struct mg_context * | ctx | ) |
Definition at line 3195 of file civetweb.c.
References NULL, and mg_context::user_data.
Referenced by mg_get_user_context_data().
CIVETWEB_API const struct mg_option * mg_get_valid_options | ( | void | ) |
Definition at line 2833 of file civetweb.c.
References config_options.
Referenced by set_option(), and show_usage_and_exit().
CIVETWEB_API int mg_get_var | ( | const char * | data, |
size_t | data_len, | ||
const char * | name, | ||
char * | dst, | ||
size_t | dst_len ) |
Definition at line 7088 of file civetweb.c.
References mg_get_var2(), and name.
CIVETWEB_API 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 7099 of file civetweb.c.
References DEBUG_ASSERT, mg_strncasecmp(), mg_url_decode(), name, NULL, and s.
Referenced by mg_get_var().
|
static |
Definition at line 1094 of file civetweb.c.
References global_lock_mutex.
Referenced by mg_atomic_dec(), mg_atomic_inc(), mg_exit_library(), and mg_init_library().
|
static |
Definition at line 1102 of file civetweb.c.
References global_lock_mutex.
Referenced by mg_atomic_dec(), mg_atomic_inc(), mg_exit_library(), and mg_init_library().
|
static |
Definition at line 9246 of file civetweb.c.
References NULL.
Referenced by connect_socket(), parse_match_net(), and parse_port_string().
CIVETWEB_API unsigned mg_init_library | ( | unsigned | features | ) |
Definition at line 22347 of file civetweb.c.
References all_methods, DEBUG_TRACE, global_lock_mutex, http_methods, initialize_openssl(), mg_check_feature(), MG_FEATURES_SSL, mg_global_lock(), mg_global_unlock(), mg_init_library_called, mg_malloc(), mg_http_method_info::name, name, NULL, pthread_mutex_attr, sTlsKey, and tls_dtor().
Referenced by legacy_init(), and run_client().
|
static |
Definition at line 5757 of file civetweb.c.
References NULL, and threadid.
Referenced by master_thread_run(), mg_close_connection(), and mg_stop().
CIVETWEB_API void mg_lock_connection | ( | struct mg_connection * | conn | ) |
Definition at line 13000 of file civetweb.c.
References mg_connection::mutex.
Referenced by close_connection().
CIVETWEB_API void mg_lock_context | ( | struct mg_context * | ctx | ) |
Definition at line 13018 of file civetweb.c.
References CONTEXT_SERVER, mg_context::context_type, and mg_context::nonce_mutex.
Referenced by dav_lock_file(), dav_unlock_file(), get_request_handler(), mg_set_handler_type(), mg_start_domain2(), refresh_trust(), release_handler_ref(), send_authorization_request(), ssl_servername_callback(), sslize(), and switch_domain_context().
|
static |
Definition at line 1474 of file civetweb.c.
References malloc.
Referenced by alloc_vprintf(), alloc_vprintf2(), handle_directory_request(), initialize_openssl(), mg_current_thread_id(), mg_init_library(), and print_dir_entry().
CIVETWEB_API char * mg_md5 | ( | char | buf[33], |
... ) |
Definition at line 8404 of file civetweb.c.
References bin2str(), and NULL.
Referenced by check_password_digest(), dav_lock_file(), mg_modify_passwords_file(), and read_auth_file().
CIVETWEB_API int mg_modify_passwords_file | ( | const char * | fname, |
const char * | domain, | ||
const char * | user, | ||
const char * | pass ) |
Definition at line 9220 of file civetweb.c.
References mg_md5(), mg_modify_passwords_file_ha1(), and NULL.
Referenced by start_civetweb().
CIVETWEB_API int mg_modify_passwords_file_ha1 | ( | const char * | fname, |
const char * | domain, | ||
const char * | user, | ||
const char * | ha1 ) |
Definition at line 9057 of file civetweb.c.
References fwrite(), mg_calloc(), mg_free(), NULL, and UTF8_PATH_MAX.
Referenced by mg_modify_passwords_file().
|
static |
Definition at line 2871 of file civetweb.c.
References NULL.
Referenced by mg_fopen(), and mg_stat().
|
static |
Definition at line 5938 of file civetweb.c.
References ERRNO, ERROR_TRY_AGAIN, SOCKET_TIMEOUT_QUANTUM, and STOP_FLAG_IS_ZERO.
Referenced by connect_socket(), master_thread_run(), pull_inner(), push_inner(), and sslize().
CIVETWEB_API int mg_printf | ( | struct mg_connection * | conn, |
const char * | fmt, | ||
... ) |
Definition at line 7034 of file civetweb.c.
References mg_vprintf().
Referenced by dav_lock_file(), dav_proppatch(), forward_body_data(), handle_cgi_request(), handle_directory_request(), handle_propfind(), handle_request(), mg_connect_websocket_client_impl(), mg_send_http_error_impl(), print_dir_entry(), print_props(), run_client(), and user_handler().
CIVETWEB_API int mg_read | ( | struct mg_connection * | conn, |
void * | buf, | ||
size_t | len ) |
Definition at line 6614 of file civetweb.c.
References mg_connection::consumed_content, mg_connection::content_len, mg_connection::is_chunked, mg_read_inner(), and NULL.
Referenced by discard_unread_request_data(), forward_body_data(), mg_store_body(), and run_client().
|
static |
Definition at line 6494 of file civetweb.c.
References body(), mg_connection::buf, mg_connection::consumed_content, mg_connection::content_len, mg_connection::data_len, INT64_MAX, NULL, pull_all(), and mg_connection::request_len.
Referenced by mg_read().
|
static |
CIVETWEB_API int mg_send_chunk | ( | struct mg_connection * | conn, |
const char * | chunk, | ||
unsigned int | chunk_len ) |
Definition at line 6860 of file civetweb.c.
References chunk(), and mg_write().
CIVETWEB_API int mg_send_digest_access_authentication_request | ( | struct mg_connection * | conn, |
const char * | realm ) |
Definition at line 9022 of file civetweb.c.
References mg_connection::dom_ctx, and send_authorization_request().
CIVETWEB_API void mg_send_file | ( | struct mg_connection * | conn, |
const char * | path ) |
Definition at line 10510 of file civetweb.c.
References mg_send_mime_file2(), and NULL.
CIVETWEB_API int mg_send_file_body | ( | struct mg_connection * | conn, |
const char * | path ) |
Definition at line 10451 of file civetweb.c.
References mg_file::access, fclose_on_exec(), INT64_MAX, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_READ, send_file_data(), and STRUCT_FILE_INITIALIZER.
CIVETWEB_API int mg_send_http_error | ( | struct mg_connection * | conn, |
int | status, | ||
const char * | fmt, | ||
... ) |
Definition at line 4562 of file civetweb.c.
References mg_send_http_error_impl().
Referenced by dav_lock_file(), dav_mkcol(), dav_move_file(), dav_unlock_file(), delete_file(), forward_body_data(), handle_cgi_request(), handle_directory_request(), handle_file_based_request(), handle_request(), handle_ssi_file_request(), handle_static_file_request(), mg_send_mime_file2(), process_new_connection(), put_file(), redirect_to_https_port(), and send_file_data().
|
static |
Definition at line 4375 of file civetweb.c.
References mg_context::callbacks, mg_domain_context::config, DEBUG_TRACE, mg_connection::dom_ctx, ERROR_PAGES, handle_file_based_request(), mg_callbacks::http_error, mg_connection::in_error_handler, INDEX_FILES, vec::len, MG_BUF_LEN, mg_get_response_code_text(), mg_printf(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_snprintf(), mg_stat(), mg_vsnprintf(), mg_write(), mg_connection::must_close, NULL, mg_connection::phys_ctx, send_additional_header(), send_cors_header(), send_no_cache_header(), mg_file::stat, mg_connection::status_code, STRUCT_FILE_INITIALIZER, UTF8_PATH_MAX, and va_copy.
Referenced by mg_send_http_error().
CIVETWEB_API int mg_send_http_ok | ( | struct mg_connection * | conn, |
const char * | mime_type, | ||
long long | content_length ) |
Definition at line 4576 of file civetweb.c.
References mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_snprintf(), mime_type, NULL, mg_connection::protocol_type, PROTOCOL_TYPE_HTTP1, send_additional_header(), send_cors_header(), send_no_cache_header(), and UINT64_FMT.
CIVETWEB_API int mg_send_http_redirect | ( | struct mg_connection * | conn, |
const char * | target_url, | ||
int | redirect_code ) |
Definition at line 4618 of file civetweb.c.
References MG_BUF_LEN, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_snprintf(), mg_write(), NULL, mg_connection::request_info, mg_request_info::request_method, send_additional_header(), send_cors_header(), send_no_cache_header(), and send_static_cache_header().
Referenced by handle_request(), and redirect_to_https_port().
CIVETWEB_API void mg_send_mime_file | ( | struct mg_connection * | conn, |
const char * | path, | ||
const char * | mime_type ) |
Definition at line 10517 of file civetweb.c.
References mg_send_mime_file2(), mime_type, and NULL.
CIVETWEB_API void mg_send_mime_file2 | ( | struct mg_connection * | conn, |
const char * | path, | ||
const char * | mime_type, | ||
const char * | additional_headers ) |
Definition at line 10526 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, ENABLE_DIRECTORY_LISTING, handle_directory_request(), handle_not_modified_static_file_request(), handle_static_file_request(), mg_file_stat::is_directory, is_not_modified(), mg_send_http_error(), mg_stat(), mg_strcasecmp(), mime_type, mg_file::stat, and STRUCT_FILE_INITIALIZER.
Referenced by mg_send_file(), and mg_send_mime_file().
CIVETWEB_API void mg_set_auth_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_authorization_handler | handler, | ||
void * | cbdata ) |
Definition at line 14538 of file civetweb.c.
References AUTH_HANDLER, mg_handler_info::cbdata, mg_context::dd, mg_handler_info::handler, mg_set_handler_type(), NULL, and mg_handler_info::uri.
|
static |
Definition at line 14280 of file civetweb.c.
References AUTH_HANDLER, mg_handler_info::auth_handler, mg_handler_info::cbdata, mg_handler_info::close_handler, mg_handler_info::connect_handler, mg_handler_info::data_handler, DEBUG_ASSERT, mg_handler_info::handler, mg_handler_info::handler_type, mg_domain_context::handlers, mg_calloc_ctx, mg_cry_ctx_internal, mg_free(), mg_lock_context(), mg_sleep, mg_strdup_ctx(), mg_unlock_context(), mg_handler_info::next, NULL, mg_handler_info::ready_handler, mg_handler_info::refcount, mg_handler_info::removing, REQUEST_HANDLER, mg_handler_info::subprotocols, mg_handler_info::uri, mg_handler_info::uri_len, and WEBSOCKET_HANDLER.
Referenced by mg_set_auth_handler(), mg_set_request_handler(), and mg_set_websocket_handler_with_subprotocols().
CIVETWEB_API void mg_set_request_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_request_handler | handler, | ||
void * | cbdata ) |
Definition at line 14466 of file civetweb.c.
References mg_handler_info::cbdata, mg_context::dd, mg_handler_info::handler, mg_set_handler_type(), NULL, REQUEST_HANDLER, and mg_handler_info::uri.
Referenced by start_http_server().
|
static |
Definition at line 2780 of file civetweb.c.
References mg_snprintf(), name, and NULL.
Referenced by master_thread_run(), and worker_thread_run().
CIVETWEB_API void mg_set_user_connection_data | ( | const struct mg_connection * | const_conn, |
void * | data ) |
Definition at line 3225 of file civetweb.c.
References mg_request_info::conn_data, NULL, and mg_connection::request_info.
Referenced by close_connection(), and init_connection().
CIVETWEB_API 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 14488 of file civetweb.c.
References mg_handler_info::cbdata, mg_handler_info::close_handler, mg_handler_info::connect_handler, mg_handler_info::data_handler, mg_set_websocket_handler_with_subprotocols(), NULL, mg_handler_info::ready_handler, and mg_handler_info::uri.
CIVETWEB_API 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 14508 of file civetweb.c.
References mg_handler_info::cbdata, mg_handler_info::close_handler, mg_handler_info::connect_handler, mg_handler_info::data_handler, mg_context::dd, mg_set_handler_type(), NULL, mg_handler_info::ready_handler, mg_handler_info::subprotocols, mg_handler_info::uri, and WEBSOCKET_HANDLER.
Referenced by mg_set_websocket_handler().
|
static |
Definition at line 3143 of file civetweb.c.
References mg_vsnprintf().
|
static |
Referenced by check_authorization(), connect_socket(), construct_etag(), dav_move_file(), do_ssi_include(), get_message(), get_request(), get_response(), handle_cgi_request(), handle_static_file_request(), initialize_openssl(), interpret_uri(), load_tls_dll(), log_access(), mg_connect_client_impl(), mg_connect_websocket_client_impl(), mg_construct_local_link(), mg_download(), mg_get_context_info(), mg_get_response(), mg_get_system_info(), mg_send_http_error_impl(), mg_send_http_ok(), mg_send_http_redirect(), mg_set_thread_name(), mg_start2(), mg_start_domain2(), open_auth_file(), prepare_cgi_environment(), print_dir_entry(), process_new_connection(), remove_directory(), scan_directory(), send_additional_header(), send_authorization_request(), and send_static_cache_header().
CIVETWEB_API int mg_split_form_urlencoded | ( | char * | data, |
struct mg_header * | form_fields, | ||
unsigned | num_form_fields ) |
Definition at line 7157 of file civetweb.c.
References mg_header::name, name, NULL, url_decode_in_place(), mg_header::value, and value.
CIVETWEB_API struct mg_context * mg_start | ( | const struct mg_callbacks * | callbacks, |
void * | user_data, | ||
const char ** | options ) |
Definition at line 21205 of file civetweb.c.
References mg_init_data::callbacks, mg_init_data::configuration_options, mg_start2(), NULL, and mg_init_data::user_data.
Referenced by start_http_server().
CIVETWEB_API struct mg_context * mg_start2 | ( | struct mg_init_data * | init, |
struct mg_error_data * | error ) |
Definition at line 20464 of file civetweb.c.
References mg_domain_context::auth_nonce_mask, mg_context::callbacks, mg_init_data::callbacks, mg_context::cfg_worker_threads, mg_domain_context::config, config_options, mg_init_data::configuration_options, CONNECTION_QUEUE_SIZE, CONTEXT_SERVER, mg_context::context_type, mg_context::dd, DEBUG_TRACE, mg_option::default_value, DOCUMENT_ROOT, ERRNO, error(), mg_callbacks::exit_context, free_context(), get_option_index(), get_random(), get_system_name(), mg_domain_context::handlers, mg_callbacks::init_context, init_ssl_ctx(), mg_workerTLS::is_master, legacy_init(), vec::len, lua_getglobal, lua_newtable, lua_pop, lua_pushstring(), lua_rawset(), master_thread(), mg_context::masterthreadid, MAX_REQUEST_SIZE, mg_context::max_request_size, MAX_WORKER_THREADS, mg_atomic_inc(), mg_calloc(), mg_calloc_ctx, mg_cry_ctx_internal, MG_ERROR_DATA_CODE_INIT_ACL_FAILED, MG_ERROR_DATA_CODE_INIT_LIBRARY_FAILED, MG_ERROR_DATA_CODE_INIT_PORTS_FAILED, MG_ERROR_DATA_CODE_INIT_TLS_FAILED, MG_ERROR_DATA_CODE_INIT_USER_FAILED, MG_ERROR_DATA_CODE_INVALID_OPTION, MG_ERROR_DATA_CODE_INVALID_PASS_FILE, MG_ERROR_DATA_CODE_OK, MG_ERROR_DATA_CODE_OS_ERROR, MG_ERROR_DATA_CODE_OUT_OF_MEMORY, MG_ERROR_DATA_CODE_SCRIPT_ERROR, mg_free(), mg_init_library_called, mg_snprintf(), mg_start_thread_with_id(), mg_strdup_ctx(), mg_strncasecmp(), mg_option::name, name, mg_domain_context::next, next_option(), mg_context::nonce_mutex, NULL, NUM_THREADS, mg_connection::phys_ctx, pthread_mutex_attr, vec::ptr, set_acl_option(), set_gpass_option(), set_ports_option(), set_uid_option(), mg_context::sq_blocked, mg_context::sq_empty, mg_context::sq_full, mg_context::sq_size, mg_context::squeue, mg_context::starter_thread_idx, sTlsKey, mg_context::systemName, mg_workerTLS::thread_idx, thread_idx_max, mg_context::thread_mutex, mg_context::user_data, mg_init_data::user_data, value, mg_context::worker_connections, worker_thread(), and mg_context::worker_threadids.
Referenced by mg_start(), and start_civetweb().
CIVETWEB_API int mg_start_domain | ( | struct mg_context * | ctx, |
const char ** | options ) |
Definition at line 21422 of file civetweb.c.
References mg_start_domain2(), and NULL.
Referenced by start_civetweb().
CIVETWEB_API int mg_start_domain2 | ( | struct mg_context * | ctx, |
const char ** | options, | ||
struct mg_error_data * | error ) |
Definition at line 21220 of file civetweb.c.
References mg_domain_context::auth_nonce_mask, AUTHENTICATION_DOMAIN, mg_domain_context::config, config_options, mg_context::dd, DEBUG_TRACE, error(), get_option_index(), get_random(), mg_domain_context::handlers, init_ssl_ctx(), mg_calloc_ctx, mg_cry_ctx_internal, MG_ERROR_DATA_CODE_DUPLICATE_DOMAIN, MG_ERROR_DATA_CODE_INIT_TLS_FAILED, MG_ERROR_DATA_CODE_INVALID_OPTION, MG_ERROR_DATA_CODE_INVALID_PARAM, MG_ERROR_DATA_CODE_MISSING_OPTION, MG_ERROR_DATA_CODE_OK, MG_ERROR_DATA_CODE_OUT_OF_MEMORY, MG_ERROR_DATA_CODE_SERVER_STOPPED, mg_free(), mg_lock_context(), mg_snprintf(), mg_strcasecmp(), mg_strdup_ctx(), mg_unlock_context(), mg_option::name, name, mg_domain_context::next, mg_domain_context::nonce_count, NULL, mg_context::stop_flag, STOP_FLAG_IS_ZERO, and value.
Referenced by mg_start_domain().
CIVETWEB_API int mg_start_thread | ( | mg_thread_func_t | func, |
void * | param ) |
Definition at line 5700 of file civetweb.c.
|
static |
Definition at line 5726 of file civetweb.c.
References NULL.
Referenced by mg_connect_websocket_client_impl(), and mg_start2().
|
static |
Definition at line 5650 of file civetweb.c.
References mg_file_stat::is_directory, mg_file_stat::last_modified, mg_path_suspicious(), and mg_file_stat::size.
Referenced by dav_mkcol(), dav_move_file(), delete_file(), handle_static_file_request(), interpret_uri(), mg_fopen(), mg_send_http_error_impl(), mg_send_mime_file2(), open_auth_file(), put_dir(), put_file(), remove_directory(), scan_directory(), set_gpass_option(), and substitute_index_file().
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" | ) |
CIVETWEB_API void mg_stop | ( | struct mg_context * | ctx | ) |
Definition at line 20346 of file civetweb.c.
References free_context(), mg_context::masterthreadid, mg_join_thread(), mg_sleep, mg_context::stop_flag, STOP_FLAG_ASSIGN, and STOP_FLAG_IS_TWO.
Referenced by start_http_server(), and stop_civetweb().
CIVETWEB_API long long mg_store_body | ( | struct mg_connection * | conn, |
const char * | path ) |
Definition at line 10622 of file civetweb.c.
References mg_file::access, mg_connection::consumed_content, mg_file_access::fp, fwrite(), MG_BUF_LEN, mg_cry_internal, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_WRITE, mg_read(), put_dir(), and remove_bad_file().
|
static |
Definition at line 21493 of file civetweb.c.
Referenced by mg_get_context_info(), and mg_get_system_info().
CIVETWEB_API int mg_strcasecmp | ( | const char * | s1, |
const char * | s2 ) |
Definition at line 3034 of file civetweb.c.
References lowercase().
Referenced by check_password_digest(), forward_body_data(), get_header(), get_rel_url_at_current_server(), get_req_headers(), get_request(), get_response(), handle_cgi_request(), handle_propfind(), handle_request(), init_connection(), init_ssl_ctx_impl(), interpret_uri(), is_not_modified(), mg_construct_local_link(), mg_get_builtin_mime_type(), mg_send_mime_file2(), mg_start_domain2(), refresh_trust(), send_file_data(), should_decode_query_string(), should_decode_url(), should_keep_alive(), ssl_servername_callback(), sslize(), and start_civetweb().
|
static |
Definition at line 3075 of file civetweb.c.
References mg_strncasecmp(), and NULL.
Referenced by mg_get_cookie(), and should_switch_to_protocol().
|
static |
Definition at line 3068 of file civetweb.c.
References mg_strndup_ctx(), and NULL.
Referenced by dir_scan_callback(), get_system_name(), and handle_request().
|
static |
Definition at line 3062 of file civetweb.c.
References mg_strndup_ctx().
Referenced by authorize(), connect_socket(), dav_move_file(), mg_set_handler_type(), mg_start2(), mg_start_domain2(), and ssl_get_client_cert_info().
|
static |
Definition at line 3002 of file civetweb.c.
Referenced by dav_lock_file(), gmt_time_string(), handle_directory_request(), log_access(), mg_get_cookie(), mg_strndup_ctx(), parse_auth_header(), parse_match_net(), parse_port_string(), print_dir_entry(), sockaddr_to_string(), and substitute_index_file().
CIVETWEB_API int mg_strncasecmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | len ) |
Definition at line 3019 of file civetweb.c.
References lowercase().
Referenced by get_mime_type(), get_rel_url_at_current_server(), get_uri_type(), header_has_option(), mg_get_var2(), mg_start2(), mg_strcasestr(), parse_auth_header(), and switch_domain_context().
|
static |
Definition at line 3047 of file civetweb.c.
References mg_malloc_ctx, mg_strlcpy(), and NULL.
Referenced by mg_strdup(), and mg_strdup_ctx().
CIVETWEB_API void mg_unlock_connection | ( | struct mg_connection * | conn | ) |
Definition at line 13009 of file civetweb.c.
References mg_connection::mutex.
Referenced by close_connection().
CIVETWEB_API void mg_unlock_context | ( | struct mg_context * | ctx | ) |
Definition at line 13027 of file civetweb.c.
References CONTEXT_SERVER, mg_context::context_type, and mg_context::nonce_mutex.
Referenced by dav_lock_file(), dav_unlock_file(), get_request_handler(), mg_set_handler_type(), mg_start_domain2(), refresh_trust(), release_handler_ref(), send_authorization_request(), ssl_servername_callback(), sslize(), and switch_domain_context().
CIVETWEB_API int mg_url_decode | ( | const char * | src, |
int | src_len, | ||
char * | dst, | ||
int | dst_len, | ||
int | is_form_url_encoded ) |
Definition at line 7048 of file civetweb.c.
References HEXTOI.
Referenced by dav_move_file(), mg_get_var2(), and url_decode_in_place().
CIVETWEB_API int mg_url_encode | ( | const char * | src, |
char * | dst, | ||
size_t | dst_len ) |
Definition at line 9581 of file civetweb.c.
References NULL.
Referenced by mg_construct_local_link(), and print_dir_entry().
CIVETWEB_API const char * mg_version | ( | void | ) |
Definition at line 3514 of file civetweb.c.
References CIVETWEB_VERSION.
Referenced by init_server_name(), mg_get_system_info(), prepare_cgi_environment(), and show_server_name().
|
static |
Definition at line 7016 of file civetweb.c.
References alloc_vprintf(), MG_BUF_LEN, mg_free(), mg_write(), and NULL.
Referenced by mg_download(), and mg_printf().
|
static |
Definition at line 3094 of file civetweb.c.
References mg_cry_internal, and vsnprintf_impl.
Referenced by addenv(), mg_send_http_error_impl(), and mg_snprintf().
CIVETWEB_API int mg_write | ( | struct mg_connection * | conn, |
const void * | buf, | ||
size_t | len ) |
Definition at line 6779 of file civetweb.c.
References mg_connection::client, mg_connection::last_throttle_bytes, mg_connection::last_throttle_time, NULL, mg_connection::num_bytes_sent, mg_connection::phys_ctx, mg_connection::protocol_type, PROTOCOL_TYPE_HTTP2, push_all(), mg_connection::request_state, socket::sock, mg_connection::ssl, mg_context::stop_flag, STOP_FLAG_IS_ZERO, and mg_connection::throttle.
Referenced by handle_cgi_request(), mg_send_chunk(), mg_send_http_error_impl(), mg_send_http_redirect(), mg_vprintf(), send_file_data(), and send_ssi_file().
|
static |
Definition at line 9763 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, HIDE_FILES, and PASSWORDS_FILE_NAME.
Referenced by handle_request(), and scan_directory().
Definition at line 3899 of file civetweb.c.
References vec::len, NULL, and vec::ptr.
Referenced by check_acl(), check_authorization(), get_mime_type(), header_has_option(), interpret_uri(), mg_start2(), prepare_cgi_environment(), set_ports_option(), set_throttle(), and substitute_index_file().
|
static |
Definition at line 8472 of file civetweb.c.
References mg_domain_context::config, DEBUG_TRACE, mg_connection::dom_ctx, ERRNO, GLOBAL_PASSWORDS_FILE, mg_file_stat::is_directory, mg_cry_internal, mg_fopen(), MG_FOPEN_MODE_READ, mg_snprintf(), mg_stat(), name, NULL, PASSWORDS_FILE_NAME, mg_file::stat, and UTF8_PATH_MAX.
Referenced by check_authorization().
|
static |
Definition at line 8555 of file civetweb.c.
References mg_domain_context::auth_nonce_mask, ah::cnonce, mg_connection::dom_ctx, mg_base64_decode(), mg_get_header(), mg_strlcpy(), mg_strncasecmp(), name, ah::nc, ah::nonce, mg_domain_context::nonce_count, NULL, mg_connection::phys_ctx, ah::plain_password, ah::qop, ah::response, s, skip_quoted(), mg_context::start_time, ah::type, ah::uri, ah::user, and value.
Referenced by authorize().
|
static |
Definition at line 8005 of file civetweb.c.
References get_month_index().
Referenced by is_not_modified().
|
static |
Definition at line 10725 of file civetweb.c.
References MG_MAX_HEADERS.
Referenced by handle_cgi_request(), parse_http_request(), and parse_http_response().
|
static |
Definition at line 10915 of file civetweb.c.
References get_http_header_len(), mg_request_info::http_headers, mg_request_info::http_version, is_valid_http_method(), NULL, mg_request_info::num_headers, parse_http_headers(), mg_request_info::remote_user, mg_request_info::request_method, mg_request_info::request_uri, and skip_to_end_of_word_and_terminate().
Referenced by get_request().
|
static |
Definition at line 11001 of file civetweb.c.
References get_http_header_len(), mg_response_info::http_headers, mg_response_info::http_version, NULL, mg_response_info::num_headers, parse_http_headers(), skip_to_end_of_word_and_terminate(), mg_response_info::status_code, and mg_response_info::status_text.
Referenced by get_response().
Definition at line 13966 of file civetweb.c.
References vec::len, mask, mg_inet_pton(), mg_strlcpy(), vec::ptr, usa::sa, and usa::sin.
Referenced by check_acl(), and set_throttle().
|
static |
Definition at line 15501 of file civetweb.c.
References socket::is_ssl, is_valid_port(), vec::len, socket::lsa, mg_inet_pton(), mg_strlcpy(), NULL, vec::ptr, usa::sin, and socket::ssl_redir.
Referenced by set_ports_option().
|
static |
Definition at line 10169 of file civetweb.c.
References INT64_FMT.
Referenced by handle_static_file_request(), and put_file().
|
static |
Definition at line 11354 of file civetweb.c.
References addenv(), AUTHENTICATION_DOMAIN, cgi_environment::buf, cgi_environment::buflen, cgi_environment::bufused, CGI_ENVIRONMENT, CGI_ENVIRONMENT_SIZE, mg_connection::client, mg_domain_context::config, cgi_environment::conn, DOCUMENT_ROOT, mg_connection::dom_ctx, mg_request_info::http_headers, IP_ADDR_STR_LEN, vec::len, mg_request_info::local_uri, mg_request_info::local_uri_raw, MAX_CGI_ENVIR_VARS, mg_cry_internal, mg_free(), mg_get_header(), mg_malloc_ctx, mg_snprintf(), mg_version(), mg_header::name, next_option(), NULL, mg_request_info::num_headers, mg_connection::path_info, mg_connection::phys_ctx, vec::ptr, mg_request_info::query_string, mg_request_info::remote_port, mg_request_info::remote_user, mg_connection::request_info, mg_request_info::request_method, mg_request_info::request_uri, socket::rsa, s, mg_request_info::server_port, sockaddr_to_string(), mg_connection::ssl, mg_connection::status_code, mg_header::value, cgi_environment::var, cgi_environment::varlen, and cgi_environment::varused.
Referenced by handle_cgi_request().
|
static |
Definition at line 12745 of file civetweb.c.
References de::file, de::file_name, mg_request_info::local_uri, print_props(), and mg_connection::request_info.
Referenced by handle_propfind().
|
static |
Definition at line 9609 of file civetweb.c.
References de::file, de::file_name, mg_file_stat::is_directory, mg_file_stat::last_modified, mg_free(), mg_malloc(), mg_printf(), mg_snprintf(), mg_strlcpy(), mg_url_encode(), NULL, and mg_file_stat::size.
Referenced by handle_directory_request().
|
static |
Definition at line 12660 of file civetweb.c.
References gmt_time_string(), INT64_FMT, mg_file_stat::is_directory, mg_file_stat::last_modified, LOCK_DURATION_S, mg_construct_local_link(), mg_free(), mg_malloc_ctx, mg_printf(), name, NULL, NUM_WEBDAV_LOCKS, twebdav_lock::path, mg_connection::phys_ctx, mg_file_stat::size, twebdav_lock::token, twebdav_lock::user, UTF8_PATH_MAX, and mg_context::webdav_lock.
Referenced by handle_propfind(), and print_dav_dir_entry().
|
static |
Definition at line 19368 of file civetweb.c.
References mg_connection::buf, mg_connection::buf_size, close_connection(), mg_connection::conn_birth_time, mg_connection::consumed_content, mg_connection::content_len, mg_connection::data_len, DEBUG_ASSERT, DEBUG_TRACE, get_rel_url_at_current_server(), get_request(), get_uri_type(), handle_request_stat_log(), mg_connection::handled_requests, mg_request_info::http_version, mg_connection::is_chunked, mg_request_info::local_uri, mg_request_info::local_uri_raw, mg_atomic_dec(), mg_atomic_inc(), mg_free(), mg_send_http_error(), mg_snprintf(), mg_connection::must_close, NULL, mg_connection::phys_ctx, mg_connection::protocol_type, PROTOCOL_TYPE_HTTP1, PROTOCOL_TYPE_HTTP2, mg_request_info::remote_addr, mg_request_info::remote_user, mg_connection::request_info, mg_connection::request_len, mg_request_info::request_uri, should_keep_alive(), should_switch_to_protocol(), mg_context::stop_flag, and STOP_FLAG_IS_ZERO.
Referenced by worker_thread_run().
|
static |
Definition at line 19661 of file civetweb.c.
References DEBUG_TRACE, socket::sock, mg_context::sq_blocked, mg_context::sq_empty, mg_context::sq_full, mg_context::sq_head, mg_context::sq_size, mg_context::sq_tail, mg_context::squeue, mg_context::stop_flag, STOP_FLAG_IS_ZERO, and mg_context::thread_mutex.
Referenced by accept_new_connection().
|
static |
Definition at line 6439 of file civetweb.c.
References mg_domain_context::config, config_options, mg_connection::dom_ctx, mg_get_current_time_ns(), NULL, mg_connection::phys_ctx, pull_inner(), REQUEST_TIMEOUT, mg_context::stop_flag, and STOP_FLAG_IS_ZERO.
Referenced by handle_cgi_request(), and mg_read_inner().
|
static |
Definition at line 6210 of file civetweb.c.
References mg_connection::client, DEBUG_TRACE, ERRNO, ERROR_TRY_AGAIN, mg_poll(), mg_pollfd, NULL, mg_connection::phys_ctx, socket::sock, mg_connection::ssl, mg_context::stop_flag, and STOP_FLAG_IS_ZERO.
Referenced by close_socket_gracefully(), pull_all(), and read_message().
|
static |
Definition at line 6162 of file civetweb.c.
References mg_domain_context::config, config_options, mg_context::dd, NULL, push_inner(), REQUEST_TIMEOUT, mg_context::stop_flag, and STOP_FLAG_IS_ZERO.
Referenced by forward_body_data(), and mg_write().
|
static |
Definition at line 6003 of file civetweb.c.
References DEBUG_TRACE, ERRNO, ERROR_TRY_AGAIN, fwrite(), mg_get_current_time_ns(), mg_poll(), mg_pollfd, mg_sleep, MSG_NOSIGNAL, NULL, SOCKET_TIMEOUT_QUANTUM, mg_context::stop_flag, and STOP_FLAG_IS_ZERO.
Referenced by push_all().
|
static |
Definition at line 10572 of file civetweb.c.
References DEBUG_TRACE, mg_mkdir, mg_stat(), NULL, s, mg_file::stat, STRUCT_FILE_INITIALIZER, and UTF8_PATH_MAX.
Referenced by mg_store_body(), and put_file().
|
static |
Definition at line 12158 of file civetweb.c.
References mg_file::access, DEBUG_TRACE, ERRNO, fclose_on_exec(), forward_body_data(), mg_file_access::fp, INVALID_SOCKET, mg_file_stat::is_directory, mg_fclose(), mg_fopen(), MG_FOPEN_MODE_WRITE, mg_get_header(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_send_http_error(), mg_stat(), NULL, parse_range_header(), put_dir(), send_additional_header(), send_no_cache_header(), mg_file::stat, mg_connection::status_code, and STRUCT_FILE_INITIALIZER.
Referenced by handle_request().
|
static |
Definition at line 8733 of file civetweb.c.
References mg_file::access, read_auth_file_struct::ah, read_auth_file_struct::buf, check_password_digest(), ah::cnonce, read_auth_file_struct::conn, depth, read_auth_file_struct::domain, read_auth_file_struct::f_domain, read_auth_file_struct::f_ha1, read_auth_file_struct::f_user, mg_cry_internal, mg_fclose(), mg_fgets(), mg_fopen(), MG_FOPEN_MODE_READ, mg_md5(), ah::nc, ah::nonce, NULL, ah::plain_password, ah::qop, read_auth_file(), mg_connection::request_info, mg_request_info::request_method, ah::response, ah::type, ah::uri, and ah::user.
Referenced by authorize(), and read_auth_file().
|
static |
Definition at line 11107 of file civetweb.c.
References mg_domain_context::config, config_options, mg_connection::dom_ctx, get_http_header_len(), mg_connection::handled_requests, KEEP_ALIVE_TIMEOUT, mg_difftimespec(), NULL, mg_connection::phys_ctx, pull_inner(), mg_connection::req_time, REQUEST_TIMEOUT, mg_context::stop_flag, and STOP_FLAG_IS_ZERO.
Referenced by get_message(), and handle_cgi_request().
|
static |
Definition at line 14235 of file civetweb.c.
References MG_BUF_LEN, mg_construct_local_link(), mg_send_http_error(), mg_send_http_redirect(), mg_connection::must_close, NULL, mg_connection::protocol_type, PROTOCOL_TYPE_WEBSOCKET, mg_request_info::query_string, and mg_connection::request_info.
Referenced by handle_request().
|
static |
Definition at line 16377 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, mg_cry_ctx_internal, mg_lock_context(), mg_strcasecmp(), mg_unlock_context(), NULL, mg_connection::phys_ctx, SSL_CA_FILE, SSL_CA_PATH, mg_domain_context::ssl_cert_last_mtime, SSL_CERTIFICATE, SSL_CERTIFICATE_CHAIN, mg_domain_context::ssl_ctx, SSL_DO_VERIFY_PEER, ssl_error(), and ssl_use_pem_file().
Referenced by sslize().
|
static |
Definition at line 14687 of file civetweb.c.
References mg_lock_context(), mg_unlock_context(), NULL, mg_connection::phys_ctx, and mg_handler_info::refcount.
Referenced by handle_request().
|
static |
Definition at line 10609 of file civetweb.c.
References mg_cry_internal, and mg_remove.
Referenced by mg_store_body().
|
static |
Definition at line 9836 of file civetweb.c.
References ERRNO, de::file, IGNORE_UNUSED_RESULT, mg_file_stat::is_directory, mg_closedir, mg_cry_internal, mg_opendir, mg_readdir, mg_remove, mg_snprintf(), mg_stat(), NULL, remove_directory(), and UTF8_PATH_MAX.
Referenced by delete_file(), and remove_directory().
|
static |
Definition at line 8069 of file civetweb.c.
Referenced by dav_move_file(), and handle_request().
|
static |
Definition at line 17676 of file civetweb.c.
References mg_connection::accept_gzip, mg_connection::consumed_content, mg_connection::content_len, mg_request_info::content_length, mg_response_info::content_length, mg_request_info::http_version, mg_response_info::http_version, mg_connection::is_chunked, mg_request_info::local_uri, mg_request_info::local_uri_raw, mg_free(), mg_connection::must_close, NULL, mg_connection::num_bytes_sent, mg_request_info::num_headers, mg_response_info::num_headers, mg_connection::path_info, mg_request_info::remote_user, mg_connection::request_info, mg_connection::request_len, mg_request_info::request_method, mg_connection::request_state, mg_request_info::request_uri, mg_connection::response_info, mg_connection::status_code, mg_response_info::status_code, mg_response_info::status_text, and mg_connection::throttle.
Referenced by get_message().
|
static |
Definition at line 9777 of file civetweb.c.
References ERRNO, de::file, de::file_name, mg_closedir, mg_cry_internal, mg_opendir, mg_readdir, mg_snprintf(), mg_stat(), must_hide_file(), NULL, and UTF8_PATH_MAX.
Referenced by handle_directory_request(), and handle_propfind().
|
static |
Definition at line 4122 of file civetweb.c.
References ADDITIONAL_HEADER, mg_domain_context::config, mg_connection::dom_ctx, mg_response_header_add(), mg_response_header_add_lines(), mg_snprintf(), NULL, and STRICT_HTTPS_MAX_AGE.
Referenced by dav_lock_file(), dav_mkcol(), dav_proppatch(), delete_file(), handle_directory_request(), handle_not_modified_static_file_request(), handle_propfind(), handle_ssi_file_request(), handle_static_file_request(), mg_send_http_error_impl(), mg_send_http_ok(), mg_send_http_redirect(), put_file(), send_authorization_request(), and send_options().
|
static |
Definition at line 8974 of file civetweb.c.
References mg_domain_context::auth_nonce_mask, AUTHENTICATION_DOMAIN, mg_domain_context::config, mg_connection::dom_ctx, mg_lock_context(), mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_snprintf(), mg_unlock_context(), mg_connection::must_close, mg_domain_context::nonce_count, mg_connection::phys_ctx, send_additional_header(), send_no_cache_header(), mg_context::start_time, and UINT64_FMT.
Referenced by handle_request(), and mg_send_digest_access_authentication_request().
|
static |
Definition at line 4149 of file civetweb.c.
References ACCESS_CONTROL_ALLOW_ORIGIN, mg_domain_context::config, mg_connection::dom_ctx, mg_get_header(), and mg_response_header_add().
Referenced by handle_ssi_file_request(), handle_static_file_request(), mg_send_http_error_impl(), mg_send_http_ok(), and mg_send_http_redirect().
|
static |
Definition at line 10055 of file civetweb.c.
References mg_file::access, mg_connection::client, mg_domain_context::config, mg_connection::dom_ctx, ERRNO, mg_file_access::fp, fread(), INT64_MAX, MG_BUF_LEN, mg_cry_internal, mg_send_http_error(), mg_strcasecmp(), mg_write(), NULL, mg_file_stat::size, socket::sock, mg_connection::ssl, mg_file::stat, and mg_connection::throttle.
Referenced by do_ssi_exec(), do_ssi_include(), handle_cgi_request(), handle_static_file_request(), and mg_send_file_body().
|
static |
Definition at line 4056 of file civetweb.c.
References mg_response_header_add(), mg_connection::protocol_type, and PROTOCOL_TYPE_HTTP1.
Referenced by delete_file(), handle_ssi_file_request(), mg_send_http_error_impl(), mg_send_http_ok(), mg_send_http_redirect(), put_file(), send_authorization_request(), and send_static_cache_header().
|
static |
Definition at line 12632 of file civetweb.c.
References all_methods, mg_response_header_add(), mg_response_header_send(), mg_response_header_start(), mg_connection::protocol_type, PROTOCOL_TYPE_HTTP1, and send_additional_header().
Referenced by handle_request().
|
static |
Definition at line 12482 of file civetweb.c.
References do_ssi_exec(), do_ssi_include(), MG_BUF_LEN, mg_cry_internal, mg_fgetc(), and mg_write().
Referenced by do_ssi_include(), and handle_ssi_file_request().
|
static |
Definition at line 4074 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, mg_response_header_add(), mg_snprintf(), NULL, send_no_cache_header(), STATIC_FILE_CACHE_CONTROL, and STATIC_FILE_MAX_AGE.
Referenced by dav_lock_file(), dav_mkcol(), dav_proppatch(), handle_directory_request(), handle_not_modified_static_file_request(), handle_propfind(), handle_static_file_request(), and mg_send_http_redirect().
|
static |
Definition at line 17662 of file civetweb.c.
References check_acl(), and usa::sa.
Referenced by mg_start2().
|
static |
Definition at line 5890 of file civetweb.c.
Referenced by close_socket_gracefully().
|
static |
Definition at line 5677 of file civetweb.c.
References ERRNO, fake_connection(), and mg_cry_internal.
Referenced by accept_new_connection(), connect_socket(), set_ports_option(), and spawn_process().
|
static |
Definition at line 17636 of file civetweb.c.
References mg_domain_context::config, mg_context::dd, mg_connection::dom_ctx, ERRNO, fake_connection(), GLOBAL_PASSWORDS_FILE, mg_cry_ctx_internal, mg_stat(), NULL, mg_connection::phys_ctx, mg_file::stat, and STRUCT_FILE_INITIALIZER.
Referenced by mg_start2().
|
static |
Definition at line 5876 of file civetweb.c.
Referenced by accept_new_connection(), and connect_socket().
|
static |
Definition at line 15736 of file civetweb.c.
References close_all_listening_sockets(), closesocket, mg_domain_context::config, config_options, mg_context::dd, ERRNO, INVALID_SOCKET, socket::is_ssl, vec::len, LISTEN_BACKLOG_SIZE, LISTENING_PORTS, mg_context::listening_socket_fds, mg_context::listening_sockets, socket::lsa, mg_cry_ctx_internal, mg_free(), mg_pollfd, mg_realloc_ctx, name, next_option(), NULL, mg_context::num_listening_sockets, parse_port_string(), vec::ptr, usa::sa, set_close_on_exec(), usa::sin, socket::sock, and mg_domain_context::ssl_ctx.
Referenced by mg_start2().
|
static |
Definition at line 17718 of file civetweb.c.
References socket::lsa, usa::sa, and socket::sock.
Referenced by accept_new_connection().
|
static |
Definition at line 14075 of file civetweb.c.
References vec::len, lowercase(), next_option(), NULL, parse_match_net(), and vec::ptr.
Referenced by handle_request().
|
static |
Definition at line 16267 of file civetweb.c.
References mg_domain_context::config, mg_context::dd, mg_cry_ctx_internal, NULL, and RUN_AS_USER.
Referenced by mg_start2().
|
static |
Definition at line 4034 of file civetweb.c.
References mg_domain_context::config, DECODE_QUERY_STRING, mg_connection::dom_ctx, and mg_strcasecmp().
Referenced by handle_request().
|
static |
Definition at line 4023 of file civetweb.c.
References mg_domain_context::config, DECODE_URL, mg_connection::dom_ctx, and mg_strcasecmp().
Referenced by handle_request().
|
static |
Definition at line 3984 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, ENABLE_KEEP_ALIVE, get_http_version(), header_has_option(), mg_get_header(), mg_strcasecmp(), mg_connection::must_close, and NULL.
Referenced by handle_cgi_request(), process_new_connection(), and suggest_connection_header().
|
static |
Definition at line 13912 of file civetweb.c.
References get_req_headers(), mg_get_header(), mg_strcasestr(), NULL, PROTOCOL_TYPE_HTTP1, PROTOCOL_TYPE_HTTP2, PROTOCOL_TYPE_WEBSOCKET, and mg_connection::request_info.
Referenced by process_new_connection().
|
static |
Definition at line 3757 of file civetweb.c.
Referenced by parse_auth_header().
|
static |
Definition at line 10680 of file civetweb.c.
Referenced by parse_http_request(), and parse_http_response().
|
static |
Definition at line 3292 of file civetweb.c.
References mg_connection::buf, mg_strlcpy(), NULL, usa::sa, and usa::sin.
Referenced by accept_new_connection(), log_access(), mg_construct_local_link(), mg_cry_internal_impl(), prepare_cgi_environment(), and worker_thread_run().
|
static |
Definition at line 5768 of file civetweb.c.
References CGI_INTERPRETER, CGI_INTERPRETER_ARGS, mg_domain_context::config, mg_connection::dom_ctx, ERRNO, mg_cry_internal, NULL, and set_close_on_exec().
Referenced by handle_cgi_request().
|
static |
Definition at line 16585 of file civetweb.c.
References NULL.
Referenced by init_ssl_ctx_impl(), initialize_openssl(), mg_connect_client_impl(), refresh_trust(), ssl_use_pem_file(), and sslize().
|
static |
Definition at line 16620 of file civetweb.c.
References mg_client_cert::finger, hexdump2string(), mg_client_cert::issuer, mg_free(), mg_malloc_ctx, mg_strdup_ctx(), NULL, mg_client_cert::peer_cert, mg_connection::phys_ctx, mg_client_cert::serial, mg_connection::ssl, and mg_client_cert::subject.
Referenced by worker_thread_run().
|
static |
Definition at line 17017 of file civetweb.c.
Referenced by init_ssl_ctx_impl().
|
static |
Definition at line 17050 of file civetweb.c.
Referenced by init_ssl_ctx_impl().
|
static |
Definition at line 16697 of file civetweb.c.
References ssl_mutexes.
Referenced by initialize_openssl().
|
static |
Definition at line 17066 of file civetweb.c.
References arg, AUTHENTICATION_DOMAIN, mg_domain_context::config, mg_context::dd, DEBUG_ASSERT, DEBUG_TRACE, mg_connection::dom_ctx, mg_lock_context(), mg_strcasecmp(), mg_unlock_context(), mg_domain_context::next, NULL, mg_connection::phys_ctx, mg_connection::ssl, and mg_domain_context::ssl_ctx.
Referenced by init_ssl_ctx_impl().
|
static |
Definition at line 16940 of file civetweb.c.
References mg_cry_ctx_internal, mg_domain_context::ssl_ctx, and ssl_error().
Referenced by init_ssl_ctx_impl(), mg_connect_client_impl(), and refresh_trust().
|
static |
Definition at line 16455 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, ERRNO, mg_client_options::host_name, mg_cry_internal, mg_lock_context(), mg_poll(), mg_pollfd, mg_sleep, mg_strcasecmp(), mg_unlock_context(), NULL, mg_connection::phys_ctx, refresh_trust(), REQUEST_TIMEOUT, mg_connection::ssl, mg_domain_context::ssl_ctx, ssl_error(), SSL_SHORT_TRUST, and STOP_FLAG_IS_ZERO.
Referenced by mg_connect_client_impl(), and worker_thread_run().
|
static |
Definition at line 7574 of file civetweb.c.
References mg_domain_context::config, mg_connection::dom_ctx, INDEX_FILES, vec::len, mg_stat(), mg_strlcpy(), next_option(), NULL, and vec::ptr.
Referenced by interpret_uri().
|
static |
Definition at line 4046 of file civetweb.c.
References should_keep_alive().
Referenced by handle_request().
|
static |
Definition at line 14174 of file civetweb.c.
References AUTHENTICATION_DOMAIN, mg_domain_context::config, mg_context::dd, DEBUG_TRACE, mg_connection::dom_ctx, get_host_from_request_info(), vec::len, mg_lock_context(), mg_strncasecmp(), mg_unlock_context(), mg_domain_context::next, mg_connection::phys_ctx, vec::ptr, mg_connection::request_info, and mg_connection::ssl.
Referenced by get_request().
|
static |
Definition at line 16321 of file civetweb.c.
References mg_workerTLS::is_master, mg_free(), NULL, and sTlsKey.
Referenced by mg_init_library().
|
static |
Definition at line 17594 of file civetweb.c.
References cryptolib_users, mg_atomic_dec(), mg_free(), NULL, and ssl_mutexes.
Referenced by mg_exit_library().
|
static |
Definition at line 7080 of file civetweb.c.
References mg_url_decode().
Referenced by handle_request(), and mg_split_form_urlencoded().
|
static |
Definition at line 19937 of file civetweb.c.
References NULL, and worker_thread_run().
Referenced by mg_start2().
|
static |
Definition at line 19704 of file civetweb.c.
References mg_workerTLS::alpn_proto, mg_connection::buf, mg_connection::buf_size, mg_context::callbacks, mg_context::cfg_worker_threads, mg_connection::client, mg_request_info::client_cert, close_connection(), mg_connection::conn_birth_time, mg_connection::connection_type, CONNECTION_TYPE_REQUEST, consume_socket(), mg_connection::content_len, mg_context::dd, DEBUG_TRACE, mg_connection::dom_ctx, mg_callbacks::exit_thread, FALSE, mg_client_cert::finger, init_connection(), mg_callbacks::init_thread, mg_connection::is_chunked, mg_workerTLS::is_master, socket::is_ssl, mg_request_info::is_ssl, mg_client_cert::issuer, mg_request_info::local_uri, mg_request_info::local_uri_raw, socket::lsa, mg_context::max_request_size, mg_atomic_inc(), mg_cry_ctx_internal, mg_free(), mg_malloc_ctx, mg_set_thread_name(), mg_connection::mutex, NULL, mg_client_cert::peer_cert, mg_connection::phys_ctx, process_new_connection(), mg_connection::protocol_type, PROTOCOL_TYPE_HTTP1, PROTOCOL_TYPE_HTTP2, pthread_mutex_attr, mg_request_info::remote_addr, mg_request_info::remote_port, mg_connection::request_info, socket::rsa, mg_client_cert::serial, mg_request_info::server_port, socket::sock, sockaddr_to_string(), mg_connection::ssl, mg_domain_context::ssl_ctx, ssl_get_client_cert_info(), sslize(), sTlsKey, mg_client_cert::subject, mg_workerTLS::thread_idx, thread_idx_max, mg_connection::tls_user_ptr, USA_IN_PORT_UNSAFE, mg_context::user_data, mg_request_info::user_data, mg_workerTLS::user_ptr, and mg_context::worker_connections.
Referenced by worker_thread().
const struct { ... } abs_uri_protocols[] |
Referenced by get_rel_url_at_current_server(), and get_uri_type().
|
static |
Definition at line 10876 of file civetweb.c.
Referenced by mg_exit_library(), mg_init_library(), and send_options().
const struct { ... } builtin_mime_types[] |
Referenced by mg_get_builtin_mime_type().
|
static |
Definition at line 2062 of file civetweb.c.
Referenced by get_option_index(), handle_cgi_request(), init_ssl_ctx(), legacy_init(), mg_connect_client_impl(), mg_get_valid_options(), mg_start2(), mg_start_domain2(), pull_all(), push_all(), read_message(), and set_ports_option().
|
static |
Definition at line 16806 of file civetweb.c.
Referenced by initialize_openssl().
|
static |
Definition at line 16815 of file civetweb.c.
Referenced by initialize_openssl(), and uninitialize_openssl().
unsigned default_port |
Definition at line 18380 of file civetweb.c.
Referenced by mg_construct_local_link().
size_t ext_len |
Definition at line 8223 of file civetweb.c.
Referenced by mg_get_builtin_mime_type().
const char* extension |
Definition at line 8222 of file civetweb.c.
Referenced by mg_get_builtin_mime_type().
|
static |
Definition at line 1089 of file civetweb.c.
Referenced by mg_exit_library(), mg_global_lock(), mg_global_unlock(), and mg_init_library().
|
static |
Definition at line 10813 of file civetweb.c.
Referenced by get_http_method_info(), and mg_init_library().
|
static |
Definition at line 1552 of file civetweb.c.
Referenced by mg_exit_library(), mg_init_library(), and mg_start2().
const char* mime_type |
Definition at line 8224 of file civetweb.c.
Referenced by handle_static_file_request(), mg_send_http_ok(), mg_send_mime_file(), and mg_send_mime_file2().
|
static |
Definition at line 1815 of file civetweb.c.
Referenced by get_month_index().
const char* proto |
Definition at line 18378 of file civetweb.c.
Referenced by duk__load_func(), duk__load_func(), duk_bi_object_constructor_create(), duk_bi_object_getprototype_shared(), duk_get_prototype(), duk_js_instanceof(), duk_js_push_closure(), duk_new(), duk_push_error_object_va_raw(), duk_push_object_helper_proto(), duk_set_prototype(), duk_to_object(), get_proto_name(), get_rel_url_at_current_server(), get_uri_type(), and mg_construct_local_link().
size_t proto_len |
Definition at line 18379 of file civetweb.c.
Referenced by get_rel_url_at_current_server(), and get_uri_type().
|
static |
Definition at line 1074 of file civetweb.c.
Referenced by initialize_openssl(), mg_connect_client_impl(), mg_exit_library(), mg_init_library(), mg_start2(), and worker_thread_run().
|
static |
Definition at line 16451 of file civetweb.c.
Referenced by initialize_openssl(), ssl_locking_callback(), and uninitialize_openssl().
|
static |
Definition at line 16805 of file civetweb.c.
Referenced by initialize_openssl().
char static_assert_replacement[1] |
Definition at line 125 of file civetweb.c.
|
static |
Definition at line 1580 of file civetweb.c.
Referenced by master_thread_run(), mg_current_thread_id(), mg_exit_library(), mg_get_request_info(), mg_get_thread_pointer(), mg_init_library(), mg_start2(), tls_dtor(), and worker_thread_run().
|
static |
Definition at line 1581 of file civetweb.c.
Referenced by mg_current_thread_id(), mg_start2(), and worker_thread_run().