ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Typedefs | Enumerations | Functions | Variables
civetweb.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <stdint.h>
#include <inttypes.h>
#include <netdb.h>
#include <pwd.h>
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
#include <pthread.h>
#include "civetweb.h"
#include "md5.inl"
Include dependency graph for civetweb.c:

Go to the source code of this file.

Macros

#define _LARGEFILE_SOURCE   /* Enable 64-bit file offsets */
 
#define __STDC_FORMAT_MACROS   /* <inttypes.h> wants this for C++ */
 
#define __STDC_LIMIT_MACROS   /* C++ wants that for INT64_MAX */
 
#define IGNORE_UNUSED_RESULT(a)   (void)((a) && 1)
 
#define MAX_WORKER_THREADS   1024
 
#define SSL_LIB   "libssl.so"
 
#define CRYPTO_LIB   "libcrypto.so"
 
#define O_BINARY   0
 
#define closesocket(a)   close(a)
 
#define mg_mkdir(x, y)   mkdir(x, y)
 
#define mg_remove(x)   remove(x)
 
#define mg_sleep(x)   usleep((x) * 1000)
 
#define ERRNO   errno
 
#define INVALID_SOCKET   (-1)
 
#define INT64_FMT   PRId64
 
#define WINCDECL
 
#define PASSWORDS_FILE_NAME   ".htpasswd"
 
#define CGI_ENVIRONMENT_SIZE   4096
 
#define MAX_CGI_ENVIR_VARS   64
 
#define MG_BUF_LEN   8192
 
#define MAX_REQUEST_SIZE   16384
 
#define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
 
#define MD5_STATIC   static
 
#define DEBUG_TRACE(x)
 
#define _DARWIN_UNLIMITED_SELECT
 
#define IP_ADDR_STR_LEN   50 /* IPv6 hex string is 46 chars */
 
#define MSG_NOSIGNAL   0
 
#define SOMAXCONN   100
 
#define PATH_MAX   4096
 
#define MGSQLEN   20
 
#define SSL_free   (* (void (*)(SSL *)) ssl_sw[0].ptr)
 
#define SSL_accept   (* (int (*)(SSL *)) ssl_sw[1].ptr)
 
#define SSL_connect   (* (int (*)(SSL *)) ssl_sw[2].ptr)
 
#define SSL_read   (* (int (*)(SSL *, void *, int)) ssl_sw[3].ptr)
 
#define SSL_write   (* (int (*)(SSL *, const void *,int)) ssl_sw[4].ptr)
 
#define SSL_get_error   (* (int (*)(SSL *, int)) ssl_sw[5].ptr)
 
#define SSL_set_fd   (* (int (*)(SSL *, SOCKET)) ssl_sw[6].ptr)
 
#define SSL_new   (* (SSL * (*)(SSL_CTX *)) ssl_sw[7].ptr)
 
#define SSL_CTX_new   (* (SSL_CTX * (*)(SSL_METHOD *)) ssl_sw[8].ptr)
 
#define SSLv23_server_method   (* (SSL_METHOD * (*)(void)) ssl_sw[9].ptr)
 
#define SSL_library_init   (* (int (*)(void)) ssl_sw[10].ptr)
 
#define SSL_CTX_use_PrivateKey_file
 
#define SSL_CTX_use_certificate_file
 
#define SSL_CTX_set_default_passwd_cb   (* (void (*)(SSL_CTX *, mg_callback_t)) ssl_sw[13].ptr)
 
#define SSL_CTX_free   (* (void (*)(SSL_CTX *)) ssl_sw[14].ptr)
 
#define SSL_load_error_strings   (* (void (*)(void)) ssl_sw[15].ptr)
 
#define SSL_CTX_use_certificate_chain_file   (* (int (*)(SSL_CTX *, const char *)) ssl_sw[16].ptr)
 
#define SSLv23_client_method   (* (SSL_METHOD * (*)(void)) ssl_sw[17].ptr)
 
#define SSL_pending   (* (int (*)(SSL *)) ssl_sw[18].ptr)
 
#define SSL_CTX_set_verify   (* (void (*)(SSL_CTX *, int, int)) ssl_sw[19].ptr)
 
#define SSL_shutdown   (* (int (*)(SSL *)) ssl_sw[20].ptr)
 
#define CRYPTO_num_locks   (* (int (*)(void)) crypto_sw[0].ptr)
 
#define CRYPTO_set_locking_callback   (* (void (*)(void (*)(int, int, const char *, int))) crypto_sw[1].ptr)
 
#define CRYPTO_set_id_callback   (* (void (*)(unsigned long (*)(void))) crypto_sw[2].ptr)
 
#define ERR_get_error   (* (unsigned long (*)(void)) crypto_sw[3].ptr)
 
#define ERR_error_string   (* (char * (*)(unsigned long,char *)) crypto_sw[4].ptr)
 
#define STRUCT_FILE_INITIALIZER   {0, 0, 0, NULL, NULL, 0}
 
#define HEXTOI(x)   (isdigit(x) ? x - '0' : x - 'W')
 

Typedefs

typedef int SOCKET
 
typedef struct ssl_st SSL
 
typedef struct ssl_method_st SSL_METHOD
 
typedef struct ssl_ctx_st SSL_CTX
 

Enumerations

enum  {
  CGI_EXTENSIONS, CGI_ENVIRONMENT, PUT_DELETE_PASSWORDS_FILE, CGI_INTERPRETER,
  PROTECT_URI, AUTHENTICATION_DOMAIN, SSI_EXTENSIONS, THROTTLE,
  ACCESS_LOG_FILE, ENABLE_DIRECTORY_LISTING, ERROR_LOG_FILE, GLOBAL_PASSWORDS_FILE,
  INDEX_FILES, ENABLE_KEEP_ALIVE, ACCESS_CONTROL_LIST, EXTRA_MIME_TYPES,
  LISTENING_PORTS, DOCUMENT_ROOT, SSL_CERTIFICATE, NUM_THREADS,
  RUN_AS_USER, REWRITE, HIDE_FILES, REQUEST_TIMEOUT,
  NUM_OPTIONS
}
 

Functions

const char ** mg_get_valid_option_names (void)
 
static int is_file_in_memory (struct mg_connection *conn, const char *path, struct file *filep)
 
static int is_file_opened (const struct file *filep)
 
const struct mg_context * mg_get_context (const struct mg_connection *conn)
 
voidmg_get_user_data (const struct mg_context *ctx)
 
static int mg_fopen (struct mg_connection *conn, const char *path, const char *mode, struct file *filep)
 
static void mg_fclose (struct file *filep)
 
static int get_option_index (const char *name)
 
const char * mg_get_option (const struct mg_context *ctx, const char *name)
 
size_t mg_get_ports (const struct mg_context *ctx, size_t size, int *ports, int *ssl)
 
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)
 
void mg_cry (struct mg_connection *conn, const char *fmt,...)
 
static struct mg_connection * fc (struct mg_context *ctx)
 
const char * mg_version (void)
 
struct mg_request_infomg_get_request_info (struct mg_connection *conn)
 
static void mg_strlcpy (register char *dst, register const char *src, size_t n)
 
static int lowercase (const char *s)
 
int mg_strncasecmp (const char *s1, const char *s2, size_t len)
 
static int mg_strcasecmp (const char *s1, const char *s2)
 
static char * mg_strndup (const char *ptr, size_t len)
 
static char * mg_strdup (const char *str)
 
static const char * mg_strcasestr (const char *big_str, const char *small_str)
 
static int mg_vsnprintf (struct mg_connection *conn, char *buf, size_t buflen, const char *fmt, va_list ap)
 
static int mg_snprintf (struct mg_connection *conn, char *buf, size_t buflen, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(4
 
static int static int mg_snprintf (struct mg_connection *conn, char *buf, size_t buflen, const char *fmt,...)
 
static char * skip_quoted (char **buf, const char *delimiters, const char *whitespace, char quotechar)
 
static char * skip (char **buf, const char *delimiters)
 
static const char * get_header (const struct mg_request_info *ri, const char *name)
 
const char * mg_get_header (const struct mg_connection *conn, const char *name)
 
static const char * next_option (const char *list, struct vec *val, struct vec *eq_val)
 
static int match_prefix (const char *pattern, int pattern_len, const char *str)
 
static int should_keep_alive (const struct mg_connection *conn)
 
static const char * suggest_connection_header (const struct mg_connection *conn)
 
static void send_http_error (struct mg_connection *, int, const char *, PRINTF_FORMAT_STRING(const char *fmt),...)
 
static int mg_stat (struct mg_connection *conn, const char *path, struct file *filep)
 
static void set_close_on_exec (int fd, struct mg_connection *conn)
 
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, int fdout, const char *dir)
 
static int set_non_blocking_mode (SOCKET sock)
 
static int64_t push (FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len)
 
static int pull (FILE *fp, struct mg_connection *conn, char *buf, int len)
 
static int pull_all (FILE *fp, struct mg_connection *conn, char *buf, int len)
 
int mg_read (struct mg_connection *conn, void *buf, size_t len)
 
int mg_write (struct mg_connection *conn, const void *buf, size_t len)
 
static int alloc_vprintf2 (char **buf, const char *fmt, va_list ap)
 
static int alloc_vprintf (char **buf, size_t size, const char *fmt, va_list ap)
 
int mg_vprintf (struct mg_connection *conn, const char *fmt, va_list ap)
 
int mg_printf (struct mg_connection *conn, const char *fmt,...)
 
int mg_url_decode (const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded)
 
int mg_get_var (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len)
 
int mg_get_var2 (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len, size_t occurrence)
 
int mg_get_cookie (const char *cookie_header, const char *var_name, char *dst, size_t dst_size)
 
static void convert_uri_to_file_name (struct mg_connection *conn, char *buf, size_t buf_len, struct file *filep, int *is_script_ressource)
 
static int get_request_len (const char *buf, int buflen)
 
static int get_month_index (const char *s)
 
static int num_leap_years (int year)
 
static time_t parse_date_string (const char *datetime)
 
static void remove_double_dots_and_double_slashes (char *s)
 
const char * mg_get_builtin_mime_type (const char *path)
 
static void get_mime_type (struct mg_context *ctx, const char *path, struct vec *vec)
 
static void bin2str (char *to, const unsigned char *p, size_t len)
 
char * mg_md5 (char buf[33],...)
 
static int check_password (const char *method, const char *ha1, const char *uri, const char *nonce, const char *nc, const char *cnonce, const char *qop, const char *response)
 
static void open_auth_file (struct mg_connection *conn, const char *path, struct file *filep)
 
static int parse_auth_header (struct mg_connection *conn, char *buf, size_t buf_size, struct ah *ah)
 
static char * mg_fgets (char *buf, size_t size, struct file *filep, char **p)
 
static int authorize (struct mg_connection *conn, struct file *filep)
 
static int check_authorization (struct mg_connection *conn, const char *path)
 
static void send_authorization_request (struct mg_connection *conn)
 
static int is_authorized_for_put (struct mg_connection *conn)
 
int mg_modify_passwords_file (const char *fname, const char *domain, const char *user, const char *pass)
 
static SOCKET conn2 (struct mg_context *ctx, const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len)
 
int mg_url_encode (const char *src, char *dst, size_t dst_len)
 
static void print_dir_entry (struct de *de)
 
static int WINCDECL compare_dir_entries (const void *p1, const void *p2)
 
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, void(*cb)(struct de *, void *))
 
static int remove_directory (struct mg_connection *conn, const char *dir)
 
static voidrealloc2 (void *ptr, size_t size)
 
static void 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 file *filep, int64_t offset, int64_t len)
 
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 file *filep)
 
static void fclose_on_exec (struct file *filep, struct mg_connection *conn)
 
static void handle_file_request (struct mg_connection *conn, const char *path, struct file *filep)
 
void mg_send_file (struct mg_connection *conn, const char *path)
 
static void parse_http_headers (char **buf, struct mg_request_info *ri)
 
static int is_valid_http_method (const char *method)
 
static int parse_http_message (char *buf, int len, struct mg_request_info *ri)
 
static int read_request (FILE *fp, struct mg_connection *conn, char *buf, int bufsiz, int *nread)
 
static int substitute_index_file (struct mg_connection *conn, char *path, size_t path_len, struct file *filep)
 
static int is_not_modified (const struct mg_connection *conn, const struct file *filep)
 
static int forward_body_data (struct mg_connection *conn, FILE *fp, SOCKET sock, SSL *ssl)
 
static char * addenv (struct cgi_env_block *block, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2
 
static char static char * addenv (struct cgi_env_block *block, const char *fmt,...)
 
static void prepare_cgi_environment (struct mg_connection *conn, const char *prog, struct cgi_env_block *blk)
 
static void handle_cgi_request (struct mg_connection *conn, const char *prog)
 
static int put_dir (struct mg_connection *conn, const char *path)
 
static void mkcol (struct mg_connection *conn, const char *path)
 
static void put_file (struct mg_connection *conn, const char *path)
 
static void send_ssi_file (struct mg_connection *, const char *, struct 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 file *filep, int offset)
 
static void handle_ssi_file_request (struct mg_connection *conn, const char *path)
 
static void send_options (struct mg_connection *conn)
 
static void print_props (struct mg_connection *conn, const char *uri, struct file *filep)
 
static void print_dav_dir_entry (struct de *de, void *data)
 
static void handle_propfind (struct mg_connection *conn, const char *path, struct file *filep)
 
void mg_lock (struct mg_connection *conn)
 
void mg_unlock (struct mg_connection *conn)
 
static int isbyte (int n)
 
static int parse_net (const char *spec, uint32_t *net, uint32_t *mask)
 
static int set_throttle (const char *spec, uint32_t remote_ip, const char *uri)
 
static uint32_t get_remote_ip (const struct mg_connection *conn)
 
int mg_upload (struct mg_connection *conn, const char *destination_dir)
 
static int is_put_or_delete_request (const struct mg_connection *conn)
 
static int get_first_ssl_listener_index (const struct mg_context *ctx)
 
static void redirect_to_https_port (struct mg_connection *conn, int ssl_index)
 
void mg_set_request_handler (struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata)
 
static int use_request_handler (struct mg_connection *conn)
 
static void handle_request (struct mg_connection *conn)
 
static void close_all_listening_sockets (struct mg_context *ctx)
 
static int is_valid_port (unsigned int port)
 
static int parse_port_string (const struct vec *vec, struct socket *so)
 
static int set_ports_option (struct mg_context *ctx)
 
static void log_header (const struct mg_connection *conn, const char *header, FILE *fp)
 
static void log_access (const struct mg_connection *conn)
 
static int check_acl (struct mg_context *ctx, uint32_t remote_ip)
 
static int set_uid_option (struct mg_context *ctx)
 
static int sslize (struct mg_connection *conn, SSL_CTX *s, int(*func)(SSL *))
 
static const char * ssl_error (void)
 
static void ssl_locking_callback (int mode, int mutex_num, const char *file, int line)
 
static unsigned long ssl_id_callback (void)
 
static voidload_dll (struct mg_context *ctx, const char *dll_name, struct ssl_func *sw)
 
static int set_ssl_option (struct mg_context *ctx)
 
static void uninitialize_ssl (struct mg_context *ctx)
 
static int set_gpass_option (struct mg_context *ctx)
 
static int set_acl_option (struct mg_context *ctx)
 
static void reset_per_request_attributes (struct mg_connection *conn)
 
static void close_socket_gracefully (struct mg_connection *conn)
 
static void close_connection (struct mg_connection *conn)
 
void mg_close_connection (struct mg_connection *conn)
 
struct mg_connection * mg_connect (const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len)
 
static int is_valid_uri (const char *uri)
 
static int getreq (struct mg_connection *conn, char *ebuf, size_t ebuf_len)
 
struct mg_connection * mg_download (const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, const char *fmt,...)
 
static void process_new_connection (struct mg_connection *conn)
 
static int consume_socket (struct mg_context *ctx, struct socket *sp)
 
static voidworker_thread_run (void *thread_func_param)
 
static voidworker_thread (void *thread_func_param)
 
static void produce_socket (struct mg_context *ctx, const struct socket *sp)
 
static int set_sock_timeout (SOCKET sock, int milliseconds)
 
static void accept_new_connection (const struct socket *listener, struct mg_context *ctx)
 
static void master_thread_run (void *thread_func_param)
 
static voidmaster_thread (void *thread_func_param)
 
static void free_context (struct mg_context *ctx)
 
void mg_stop (struct mg_context *ctx)
 
struct mg_context * mg_start (const struct mg_callbacks *callbacks, void *user_data, const char **options)
 

Variables

static const char * http_500_error = "Internal Server Error"
 
static struct ssl_func ssl_sw []
 
static struct ssl_func crypto_sw []
 
static const char * month_names []
 
static const char * config_options []
 
static pthread_key_t sTlsKey
 
static int sTlsInit = 0
 
struct {
   const char *   extension
 
   size_t   ext_len
 
   const char *   mime_type
 
builtin_mime_types []
 
static pthread_mutex_t * ssl_mutexes
 

Macro Definition Documentation

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

Definition at line 31 of file civetweb.c.

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

Definition at line 32 of file civetweb.c.

#define _DARWIN_UNLIMITED_SELECT

Definition at line 358 of file civetweb.c.

#define _LARGEFILE_SOURCE   /* Enable 64-bit file offsets */

Definition at line 30 of file civetweb.c.

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

Definition at line 290 of file civetweb.c.

#define closesocket (   a)    close(a)
#define CRYPTO_LIB   "libcrypto.so"

Definition at line 269 of file civetweb.c.

Referenced by set_ssl_option().

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

Definition at line 424 of file civetweb.c.

Referenced by set_ssl_option(), and uninitialize_ssl().

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

Definition at line 427 of file civetweb.c.

Referenced by set_ssl_option(), and uninitialize_ssl().

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

Definition at line 425 of file civetweb.c.

Referenced by set_ssl_option(), and uninitialize_ssl().

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

Definition at line 430 of file civetweb.c.

Referenced by TAuthenticate::SendRSAPublicKey(), and ssl_error().

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

Definition at line 429 of file civetweb.c.

Referenced by TAuthenticate::SendRSAPublicKey(), and ssl_error().

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

Referenced by mg_url_decode().

#define IGNORE_UNUSED_RESULT (   a)    (void)((a) && 1)
#define INT64_FMT   PRId64
#define INVALID_SOCKET   (-1)
#define IP_ADDR_STR_LEN   50 /* IPv6 hex string is 46 chars */

Definition at line 360 of file civetweb.c.

Referenced by accept_new_connection(), log_access(), mg_cry(), and prepare_cgi_environment().

#define MAX_CGI_ENVIR_VARS   64

Definition at line 291 of file civetweb.c.

#define MAX_REQUEST_SIZE   16384

Definition at line 294 of file civetweb.c.

Referenced by mg_connect(), and worker_thread_run().

#define MAX_WORKER_THREADS   1024

Definition at line 82 of file civetweb.c.

Referenced by mg_start().

#define MD5_STATIC   static

Definition at line 331 of file civetweb.c.

#define MG_BUF_LEN   8192
#define mg_mkdir (   x,
  y 
)    mkdir(x, y)

Definition at line 276 of file civetweb.c.

Referenced by mkcol(), and put_dir().

#define mg_remove (   x)    remove(x)

Definition at line 277 of file civetweb.c.

Referenced by handle_request(), and remove_directory().

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

Definition at line 278 of file civetweb.c.

Referenced by mg_stop().

#define MGSQLEN   20

Definition at line 376 of file civetweb.c.

#define MSG_NOSIGNAL   0

Definition at line 363 of file civetweb.c.

Referenced by push().

#define O_BINARY   0
#define PASSWORDS_FILE_NAME   ".htpasswd"

Definition at line 289 of file civetweb.c.

Referenced by must_hide_file(), and open_auth_file().

#define PATH_MAX   4096
#define SOMAXCONN   100

Definition at line 367 of file civetweb.c.

Referenced by set_ports_option().

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

Definition at line 399 of file civetweb.c.

Referenced by worker_thread_run().

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

Definition at line 400 of file civetweb.c.

Referenced by mg_connect(), and TSSLSocket::WrapWithSSL().

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

Definition at line 415 of file civetweb.c.

Referenced by free_context(), mg_close_connection(), and TSSLSocket::~TSSLSocket().

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

Definition at line 406 of file civetweb.c.

Referenced by mg_connect(), set_ssl_option(), and TSSLSocket::WrapWithSSL().

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

Definition at line 413 of file civetweb.c.

#define SSL_CTX_set_verify   (* (void (*)(SSL_CTX *, int, int)) ssl_sw[19].ptr)

Definition at line 421 of file civetweb.c.

Referenced by mg_connect().

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

Definition at line 417 of file civetweb.c.

Referenced by set_ssl_option(), and TSSLSocket::WrapWithSSL().

#define SSL_CTX_use_certificate_file
Value:
(* (int (*)(SSL_CTX *, \
const char *, int)) ssl_sw[12].ptr)
static struct ssl_func ssl_sw[]
Definition: civetweb.c:436
struct ssl_ctx_st SSL_CTX
Definition: civetweb.c:391

Definition at line 411 of file civetweb.c.

Referenced by set_ssl_option().

#define SSL_CTX_use_PrivateKey_file
Value:
(* (int (*)(SSL_CTX *, \
const char *, int)) ssl_sw[11].ptr)
static struct ssl_func ssl_sw[]
Definition: civetweb.c:436
struct ssl_ctx_st SSL_CTX
Definition: civetweb.c:391

Definition at line 409 of file civetweb.c.

Referenced by set_ssl_option(), and TSSLSocket::WrapWithSSL().

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

Definition at line 398 of file civetweb.c.

Referenced by close_connection(), and TSSLSocket::~TSSLSocket().

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

Definition at line 403 of file civetweb.c.

Referenced by TSSLSocket::RecvRaw(), and TSSLSocket::SendRaw().

#define SSL_LIB   "libssl.so"

Definition at line 266 of file civetweb.c.

Referenced by set_ssl_option().

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

Definition at line 408 of file civetweb.c.

Referenced by TAuthenticate::GenRSAKeys(), set_ssl_option(), and TSSLSocket::WrapWithSSL().

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

Definition at line 416 of file civetweb.c.

Referenced by TAuthenticate::GenRSAKeys(), and set_ssl_option().

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

Definition at line 405 of file civetweb.c.

Referenced by sslize(), and TSSLSocket::WrapWithSSL().

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

Definition at line 420 of file civetweb.c.

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

Definition at line 401 of file civetweb.c.

Referenced by pull(), and TSSLSocket::RecvRaw().

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

Definition at line 404 of file civetweb.c.

Referenced by sslize(), and TSSLSocket::WrapWithSSL().

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

Definition at line 422 of file civetweb.c.

Referenced by TSSLSocket::Close(), and close_connection().

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

Definition at line 402 of file civetweb.c.

Referenced by push(), and TSSLSocket::SendRaw().

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

Definition at line 419 of file civetweb.c.

Referenced by conn2(), and mg_connect().

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

Definition at line 407 of file civetweb.c.

Referenced by set_ssl_option().

#define STRUCT_FILE_INITIALIZER   {0, 0, 0, NULL, NULL, 0}
#define WINCDECL

Definition at line 283 of file civetweb.c.

Typedef Documentation

typedef int SOCKET

Definition at line 282 of file civetweb.c.

typedef struct ssl_st SSL

Definition at line 389 of file civetweb.c.

typedef struct ssl_ctx_st SSL_CTX

Definition at line 391 of file civetweb.c.

typedef struct ssl_method_st SSL_METHOD

Definition at line 390 of file civetweb.c.

Enumeration Type Documentation

anonymous enum
Enumerator
CGI_EXTENSIONS 
CGI_ENVIRONMENT 
PUT_DELETE_PASSWORDS_FILE 
CGI_INTERPRETER 
PROTECT_URI 
AUTHENTICATION_DOMAIN 
SSI_EXTENSIONS 
THROTTLE 
ACCESS_LOG_FILE 
ENABLE_DIRECTORY_LISTING 
ERROR_LOG_FILE 
GLOBAL_PASSWORDS_FILE 
INDEX_FILES 
ENABLE_KEEP_ALIVE 
ACCESS_CONTROL_LIST 
EXTRA_MIME_TYPES 
LISTENING_PORTS 
DOCUMENT_ROOT 
SSL_CERTIFICATE 
NUM_THREADS 
RUN_AS_USER 
REWRITE 
HIDE_FILES 
REQUEST_TIMEOUT 
NUM_OPTIONS 

Definition at line 520 of file civetweb.c.

Function Documentation

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

Definition at line 6140 of file civetweb.c.

Referenced by master_thread_run().

static char* addenv ( struct cgi_env_block *  block,
PRINTF_FORMAT_STRING(const char *fmt)  ,
  ... 
)
static

Referenced by prepare_cgi_environment().

static char static char* addenv ( struct cgi_env_block *  block,
const char *  fmt,
  ... 
)
static

Definition at line 3672 of file civetweb.c.

static int alloc_vprintf ( char **  buf,
size_t  size,
const char *  fmt,
va_list  ap 
)
static

Definition at line 2099 of file civetweb.c.

Referenced by mg_vprintf().

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

Definition at line 2077 of file civetweb.c.

Referenced by alloc_vprintf().

static int authorize ( struct mg_connection *  conn,
struct file *  filep 
)
static

Definition at line 2807 of file civetweb.c.

Referenced by check_authorization(), and is_authorized_for_put().

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

Definition at line 2603 of file civetweb.c.

Referenced by mg_md5().

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

Definition at line 5510 of file civetweb.c.

Referenced by accept_new_connection(), and set_acl_option().

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

Definition at line 2833 of file civetweb.c.

Referenced by handle_request().

static int check_password ( const char *  method,
const char *  ha1,
const char *  uri,
const char *  nonce,
const char *  nc,
const char *  cnonce,
const char *  qop,
const char *  response 
)
static

Definition at line 2636 of file civetweb.c.

Referenced by authorize().

static void close_all_listening_sockets ( struct mg_context *  ctx)
static

Definition at line 5325 of file civetweb.c.

Referenced by master_thread_run(), and set_ports_option().

static void close_connection ( struct mg_connection *  conn)
static

Definition at line 5773 of file civetweb.c.

Referenced by mg_close_connection(), and worker_thread_run().

static void close_socket_gracefully ( struct mg_connection *  conn)
static

Definition at line 5736 of file civetweb.c.

Referenced by close_connection().

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

Definition at line 3064 of file civetweb.c.

Referenced by handle_directory_request().

static SOCKET conn2 ( struct mg_context *  ctx,
const char *  host,
int  port,
int  use_ssl,
char *  ebuf,
size_t  ebuf_len 
)
static

Definition at line 2965 of file civetweb.c.

Referenced by mg_connect().

static void construct_etag ( char *  buf,
size_t  buf_len,
const struct file *  filep 
)
static

Definition at line 3333 of file civetweb.c.

Referenced by handle_file_request(), and is_not_modified().

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

Definition at line 5990 of file civetweb.c.

Referenced by worker_thread_run().

static void convert_uri_to_file_name ( struct mg_connection *  conn,
char *  buf,
size_t  buf_len,
struct file *  filep,
int *  is_script_ressource 
)
static

Definition at line 2284 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 3206 of file civetweb.c.

Referenced by handle_directory_request().

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

Definition at line 4165 of file civetweb.c.

Referenced by send_ssi_file().

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

Definition at line 4118 of file civetweb.c.

Referenced by send_ssi_file().

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

Definition at line 839 of file civetweb.c.

Referenced by accept_new_connection(), TSpider::AddVariable(), TProof::AssertDataSet(), check_acl(), TAlienCollection::CheckIfOnline(), ClassImp(), TProof::ClearData(), conn2(), TProofBench::CopyDataSet(), TSpider::DeleteVariable(), do_anadist(), do_info_server(), do_ls_files_server(), TDataSetManagerAliEn::ExistsDataSet(), TEfficiency::FeldmanCousinsInterval(), RooBrentRootFinder::findRoot(), FourBinInstructional(), TAliEnFind::GetCollection(), TDataSetManagerFile::GetDataSet(), GetDataSet(), TDataSetManagerAliEn::GetDataSet(), GetDataSets(), TFileCollection::GetFilesOnServer(), TFileCollection::GetFilesPerServer(), TProof::GetMissingFiles(), XrdProofdAux::GetNumCPUs(), TProofLite::GetStagingStatusDataSet(), TProof::GetStagingStatusDataSet(), TDataSetManager::GetSubDataSets(), TProofBenchDataSet::Handle(), TProofServ::HandleDataSets(), TProof::HandleOutputOptions(), TProofServ::HandleProcess(), IntervalExamples(), load_dll(), TBasket::LoadBasketBuffers(), TProofBench::MakeDataSet(), TProofPlayerRemote::MergeOutputFiles(), mg_set_request_handler(), mg_start(), TView3D::MoveFocus(), OneSidedFrequentistUpperLimitWithBands(), pq2register(), TProofLite::Process(), TBasket::ReadBasketBuffers(), TEveCaloLegoOverlay::RenderLogaritmicScales(), TProofLite::RequestStagingDataSet(), TMVA::ROCCalc::Root(), TMVA::RootFinder::Root(), rs101_limitexample(), rs401c_FeldmanCousins(), rs401d_FeldmanCousins(), TProofBenchRunDataRead::Run(), set_gpass_option(), set_ports_option(), set_ssl_option(), set_uid_option(), TSpider::SetNx(), TSpider::SetNy(), TSpider::SetSegmentDisplay(), TDataSetManager::ShowDataSets(), TProof::ShowStagingStatusDataSet(), TAlienCollection::Stage(), StandardFeldmanCousinsDemo(), TAlienCollection::Status(), TDSet::TDSet(), TestAuth(), testDistr1D(), TwoSidedFrequentistUpperLimitWithBands(), unuranDistr(), worker_thread_run(), TView3D::ZoomIn(), and TView3D::ZoomOut().

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

Definition at line 3591 of file civetweb.c.

Referenced by handle_cgi_request(), and put_file().

static void free_context ( struct mg_context *  ctx)
static

Definition at line 6290 of file civetweb.c.

Referenced by mg_start(), and mg_stop().

static int get_first_ssl_listener_index ( const struct mg_context *  ctx)
static

Definition at line 5054 of file civetweb.c.

Referenced by handle_request().

static const char* get_header ( const struct mg_request_info ri,
const char *  name 
)
static

Definition at line 1021 of file civetweb.c.

Referenced by getreq(), handle_cgi_request(), and mg_get_header().

static void get_mime_type ( struct mg_context *  ctx,
const char *  path,
struct vec *  vec 
)
static

Definition at line 2576 of file civetweb.c.

Referenced by handle_file_request().

static int get_month_index ( const char *  s)
static

Definition at line 2396 of file civetweb.c.

Referenced by parse_date_string().

static int get_option_index ( const char *  name)
static

Definition at line 731 of file civetweb.c.

Referenced by mg_get_option(), and mg_start().

static uint32_t get_remote_ip ( const struct mg_connection *  conn)
static

Definition at line 4923 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 2372 of file civetweb.c.

Referenced by mg_upload(), parse_http_message(), and read_request().

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

Definition at line 5875 of file civetweb.c.

Referenced by mg_download(), and process_new_connection().

static void gmt_time_string ( char *  buf,
size_t  buf_len,
time_t *  t 
)
static
static void handle_cgi_request ( struct mg_connection *  conn,
const char *  prog 
)
static

Definition at line 3820 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 3226 of file civetweb.c.

Referenced by handle_request().

static void handle_file_request ( struct mg_connection *  conn,
const char *  path,
struct file *  filep 
)
static

Definition at line 3354 of file civetweb.c.

Referenced by handle_request(), and mg_send_file().

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

Definition at line 4332 of file civetweb.c.

Referenced by handle_request().

static void handle_request ( struct mg_connection *  conn)
static

Definition at line 5194 of file civetweb.c.

Referenced by process_new_connection().

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

Definition at line 4256 of file civetweb.c.

Referenced by handle_request().

static int is_authorized_for_put ( struct mg_connection *  conn)
static

Definition at line 2886 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 678 of file civetweb.c.

Referenced by mg_fopen(), and mg_stat().

static int is_file_opened ( const struct file *  filep)
static

Definition at line 691 of file civetweb.c.

Referenced by check_authorization(), and mg_fopen().

static int is_not_modified ( const struct mg_connection *  conn,
const struct file *  filep 
)
static

Definition at line 3580 of file civetweb.c.

Referenced by handle_request().

static int is_put_or_delete_request ( const struct mg_connection *  conn)
static

Definition at line 5046 of file civetweb.c.

Referenced by handle_request().

static int is_valid_http_method ( const char *  method)
static

Definition at line 3462 of file civetweb.c.

Referenced by parse_http_message().

static int is_valid_port ( unsigned int  port)
static

Definition at line 5334 of file civetweb.c.

Referenced by parse_port_string().

static int is_valid_uri ( const char *  uri)
static

Definition at line 5867 of file civetweb.c.

Referenced by process_new_connection().

static int isbyte ( int  n)
static

Definition at line 4873 of file civetweb.c.

Referenced by parse_net().

static void* load_dll ( struct mg_context *  ctx,
const char *  dll_name,
struct ssl_func *  sw 
)
static

Definition at line 5598 of file civetweb.c.

Referenced by set_ssl_option().

static void log_access ( const struct mg_connection *  conn)
static

Definition at line 5469 of file civetweb.c.

Referenced by process_new_connection().

static void log_header ( const struct mg_connection *  conn,
const char *  header,
FILE *  fp 
)
static

Definition at line 5457 of file civetweb.c.

Referenced by log_access().

static int lowercase ( const char *  s)
static

Definition at line 864 of file civetweb.c.

Referenced by match_prefix(), mg_strcasecmp(), mg_strncasecmp(), and set_throttle().

static void* master_thread ( void thread_func_param)
static

Definition at line 6283 of file civetweb.c.

Referenced by mg_start().

static void master_thread_run ( void thread_func_param)
static

Definition at line 6180 of file civetweb.c.

Referenced by master_thread().

static int match_prefix ( const char *  pattern,
int  pattern_len,
const char *  str 
)
static
void mg_close_connection ( struct mg_connection *  conn)

Definition at line 5805 of file civetweb.c.

Referenced by mg_download().

struct mg_connection * mg_connect ( const char *  host,
int  port,
int  use_ssl,
char *  ebuf,
size_t  ebuf_len 
)

Definition at line 5820 of file civetweb.c.

Referenced by mg_download().

void mg_cry ( struct mg_connection *  conn,
const char *  fmt,
  ... 
)
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 5907 of file civetweb.c.

static void mg_fclose ( struct file *  filep)
static
static int mg_fgetc ( struct file *  filep,
int  offset 
)
static

Definition at line 4181 of file civetweb.c.

Referenced by send_ssi_file().

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

Definition at line 2778 of file civetweb.c.

Referenced by authorize().

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

Definition at line 2556 of file civetweb.c.

Referenced by get_mime_type().

const struct mg_context* mg_get_context ( const struct mg_connection *  conn)

Definition at line 696 of file civetweb.c.

Referenced by log_message_handler().

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

Definition at line 2244 of file civetweb.c.

const char* mg_get_header ( const struct mg_connection *  conn,
const char *  name 
)
const char* mg_get_option ( const struct mg_context *  ctx,
const char *  name 
)

Definition at line 743 of file civetweb.c.

size_t mg_get_ports ( const struct mg_context *  ctx,
size_t  size,
int *  ports,
int *  ssl 
)

Definition at line 755 of file civetweb.c.

struct mg_request_info* mg_get_request_info ( struct mg_connection *  conn)

Definition at line 851 of file civetweb.c.

Referenced by begin_request_handler(), and use_request_handler().

void* mg_get_user_data ( const struct mg_context *  ctx)

Definition at line 701 of file civetweb.c.

Referenced by log_message_handler().

const char** mg_get_valid_option_names ( void  )

Definition at line 673 of file civetweb.c.

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

Definition at line 2189 of file civetweb.c.

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

Definition at line 2195 of file civetweb.c.

Referenced by mg_get_var().

static int mg_join_thread ( pthread_t  threadid)
static

Definition at line 1845 of file civetweb.c.

Referenced by master_thread_run(), and mg_stop().

void mg_lock ( struct mg_connection *  conn)

Definition at line 4366 of file civetweb.c.

Referenced by close_connection().

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

Definition at line 2615 of file civetweb.c.

Referenced by check_password(), and mg_modify_passwords_file().

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

Definition at line 2900 of file civetweb.c.

int mg_printf ( struct mg_connection *  conn,
const char *  fmt,
  ... 
)
int mg_read ( struct mg_connection *  conn,
void buf,
size_t  len 
)

Definition at line 1996 of file civetweb.c.

Referenced by begin_request_handler(), and mg_upload().

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

Definition at line 3435 of file civetweb.c.

Referenced by begin_request_handler().

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

Definition at line 5092 of file civetweb.c.

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

Definition at line 952 of file civetweb.c.

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

Definition at line 6357 of file civetweb.c.

Referenced by TCivetweb::Create().

int mg_start_thread ( mg_thread_func_t  func,
void param 
)

Definition at line 1797 of file civetweb.c.

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

Definition at line 1820 of file civetweb.c.

Referenced by mg_start().

static int mg_stat ( struct mg_connection *  conn,
const char *  path,
struct file *  filep 
)
static
void mg_stop ( struct mg_context *  ctx)

Definition at line 6341 of file civetweb.c.

Referenced by TCivetweb::~TCivetweb().

static int mg_strcasecmp ( const char *  s1,
const char *  s2 
)
static
static const char* mg_strcasestr ( const char *  big_str,
const char *  small_str 
)
static

Definition at line 908 of file civetweb.c.

Referenced by mg_get_cookie(), and mg_upload().

static char* mg_strdup ( const char *  str)
static

Definition at line 903 of file civetweb.c.

Referenced by dir_scan_callback(), mg_set_request_handler(), mg_start(), and parse_auth_header().

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

Definition at line 856 of file civetweb.c.

Referenced by mg_get_cookie(), mg_strndup(), parse_auth_header(), and substitute_index_file().

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

Definition at line 869 of file civetweb.c.

Referenced by get_mime_type(), mg_get_var2(), mg_strcasestr(), and parse_auth_header().

static char* mg_strndup ( const char *  ptr,
size_t  len 
)
static

Definition at line 892 of file civetweb.c.

Referenced by mg_strdup().

void mg_unlock ( struct mg_connection *  conn)

Definition at line 4371 of file civetweb.c.

Referenced by close_connection().

int mg_upload ( struct mg_connection *  conn,
const char *  destination_dir 
)

Definition at line 4928 of file civetweb.c.

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

Definition at line 2163 of file civetweb.c.

Referenced by handle_request(), and mg_get_var2().

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

Definition at line 2997 of file civetweb.c.

Referenced by print_dav_dir_entry(), and print_dir_entry().

const char* mg_version ( void  )

Definition at line 846 of file civetweb.c.

Referenced by prepare_cgi_environment().

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

Definition at line 2136 of file civetweb.c.

Referenced by mg_download(), and mg_printf().

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

Definition at line 925 of file civetweb.c.

Referenced by addenv(), mg_snprintf(), and send_http_error().

int mg_write ( struct mg_connection *  conn,
const void buf,
size_t  len 
)
static void mkcol ( struct mg_connection *  conn,
const char *  path 
)
static

Definition at line 4026 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 3091 of file civetweb.c.

Referenced by handle_request(), and scan_directory().

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

Definition at line 2407 of file civetweb.c.

Referenced by parse_date_string().

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

Definition at line 2666 of file civetweb.c.

Referenced by check_authorization().

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

Definition at line 2713 of file civetweb.c.

Referenced by authorize().

static time_t parse_date_string ( const char *  datetime)
static

Definition at line 2413 of file civetweb.c.

Referenced by is_not_modified().

static void parse_http_headers ( char **  buf,
struct mg_request_info ri 
)
static

Definition at line 3448 of file civetweb.c.

Referenced by handle_cgi_request(), and parse_http_message().

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

Definition at line 3475 of file civetweb.c.

Referenced by getreq().

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

Definition at line 4878 of file civetweb.c.

Referenced by check_acl(), and set_throttle().

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

Definition at line 5342 of file civetweb.c.

Referenced by set_ports_option().

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

Definition at line 3328 of file civetweb.c.

Referenced by handle_file_request(), and put_file().

static void prepare_cgi_environment ( struct mg_connection *  conn,
const char *  prog,
struct cgi_env_block *  blk 
)
static

Definition at line 3704 of file civetweb.c.

Referenced by handle_cgi_request().

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

Definition at line 4321 of file civetweb.c.

Referenced by handle_propfind().

static void print_dir_entry ( struct de *  de)
static

Definition at line 3022 of file civetweb.c.

Referenced by handle_directory_request().

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

Definition at line 4298 of file civetweb.c.

Referenced by handle_propfind(), and print_dav_dir_entry().

static void process_new_connection ( struct mg_connection *  conn)
static

Definition at line 5931 of file civetweb.c.

Referenced by worker_thread_run().

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

Definition at line 6106 of file civetweb.c.

Referenced by accept_new_connection().

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

Definition at line 1975 of file civetweb.c.

Referenced by mg_read().

static int64_t push ( FILE *  fp,
SOCKET  sock,
SSL ssl,
const char *  buf,
int64_t  len 
)
static

Definition at line 1917 of file civetweb.c.

Referenced by TGeoChecker::CheckBoundaryReference(), forward_body_data(), and mg_write().

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

Definition at line 3994 of file civetweb.c.

Referenced by put_file().

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

Definition at line 4075 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 3514 of file civetweb.c.

Referenced by getreq(), and handle_cgi_request().

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

Definition at line 3197 of file civetweb.c.

Referenced by dir_scan_callback().

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

Definition at line 5063 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 3141 of file civetweb.c.

Referenced by handle_request().

static void remove_double_dots_and_double_slashes ( char *  s)
static

Definition at line 2444 of file civetweb.c.

Referenced by handle_request().

static void reset_per_request_attributes ( struct mg_connection *  conn)
static

Definition at line 5728 of file civetweb.c.

Referenced by getreq().

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

Definition at line 3099 of file civetweb.c.

Referenced by handle_directory_request(), and handle_propfind().

static void send_authorization_request ( struct mg_connection *  conn)
static

Definition at line 2865 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 3285 of file civetweb.c.

Referenced by do_ssi_exec(), do_ssi_include(), handle_cgi_request(), and handle_file_request().

static void send_http_error ( struct mg_connection *  ,
int  ,
const char *  ,
PRINTF_FORMAT_STRING(const char *fmt)  ,
  ... 
)
static
static void send_options ( struct mg_connection *  conn)
static

Definition at line 4280 of file civetweb.c.

Referenced by handle_request().

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

Definition at line 4192 of file civetweb.c.

Referenced by do_ssi_include(), and handle_ssi_file_request().

static int set_acl_option ( struct mg_context *  ctx)
static

Definition at line 5723 of file civetweb.c.

Referenced by mg_start().

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

Definition at line 1788 of file civetweb.c.

Referenced by accept_new_connection(), conn2(), handle_cgi_request(), and set_ports_option().

static int set_gpass_option ( struct mg_context *  ctx)
static

Definition at line 5712 of file civetweb.c.

Referenced by mg_start().

static int set_non_blocking_mode ( SOCKET  sock)
static

Definition at line 1904 of file civetweb.c.

Referenced by close_socket_gracefully().

static int set_ports_option ( struct mg_context *  ctx)
static

Definition at line 5383 of file civetweb.c.

Referenced by mg_start().

static int set_sock_timeout ( SOCKET  sock,
int  milliseconds 
)
static

Definition at line 6127 of file civetweb.c.

Referenced by accept_new_connection().

static int set_ssl_option ( struct mg_context *  ctx)
static

Definition at line 5637 of file civetweb.c.

Referenced by mg_start().

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

Definition at line 4894 of file civetweb.c.

Referenced by handle_request().

static int set_uid_option ( struct mg_context *  ctx)
static

Definition at line 5537 of file civetweb.c.

Referenced by mg_start().

static int should_keep_alive ( const struct mg_connection *  conn)
static

Definition at line 1122 of file civetweb.c.

Referenced by process_new_connection(), and suggest_connection_header().

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

Definition at line 969 of file civetweb.c.

Referenced by parse_auth_header(), parse_http_headers(), and skip().

static void sockaddr_to_string ( char *  buf,
size_t  len,
const union usa *  usa 
)
static
static pid_t spawn_process ( struct mg_connection *  conn,
const char *  prog,
char *  envblk,
char *  envp[],
int  fdin,
int  fdout,
const char *  dir 
)
static

Definition at line 1854 of file civetweb.c.

Referenced by handle_cgi_request().

static const char* ssl_error ( void  )
static

Definition at line 5572 of file civetweb.c.

Referenced by set_ssl_option().

static unsigned long ssl_id_callback ( void  )
static

Definition at line 5592 of file civetweb.c.

Referenced by set_ssl_option().

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

Definition at line 5579 of file civetweb.c.

Referenced by set_ssl_option().

static int sslize ( struct mg_connection *  conn,
SSL_CTX s,
int(*)(SSL *)  func 
)
static

Definition at line 5564 of file civetweb.c.

Referenced by mg_connect(), and worker_thread_run().

static int substitute_index_file ( struct mg_connection *  conn,
char *  path,
size_t  path_len,
struct file *  filep 
)
static

Definition at line 3534 of file civetweb.c.

Referenced by handle_request().

static const char* suggest_connection_header ( const struct mg_connection *  conn)
static
static void uninitialize_ssl ( struct mg_context *  ctx)
static

Definition at line 5698 of file civetweb.c.

Referenced by master_thread_run().

static int use_request_handler ( struct mg_connection *  conn)
static

Definition at line 5157 of file civetweb.c.

Referenced by handle_request().

static void* worker_thread ( void thread_func_param)
static

Definition at line 6098 of file civetweb.c.

Referenced by mg_start().

static void* worker_thread_run ( void thread_func_param)
static

Definition at line 6020 of file civetweb.c.

Referenced by worker_thread().

Variable Documentation

const { ... } builtin_mime_types[]
const char* config_options[]
static

Definition at line 541 of file civetweb.c.

Referenced by mg_get_valid_option_names().

struct ssl_func crypto_sw[]
static
Initial value:
= {
{"CRYPTO_num_locks", NULL},
{"CRYPTO_set_locking_callback", NULL},
{"CRYPTO_set_id_callback", NULL},
{"ERR_get_error", NULL},
{"ERR_error_string", NULL},
}
#define NULL
Definition: Rtypes.h:82

Definition at line 464 of file civetweb.c.

size_t ext_len

Definition at line 2468 of file civetweb.c.

Referenced by THttpServer::GetMimeType(), and mg_get_builtin_mime_type().

const char* extension
const char* http_500_error = "Internal Server Error"
static

Definition at line 379 of file civetweb.c.

const char* mime_type

Definition at line 2469 of file civetweb.c.

Referenced by THttpServer::GetMimeType().

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

Definition at line 475 of file civetweb.c.

pthread_mutex_t* ssl_mutexes
static

Definition at line 5562 of file civetweb.c.

struct ssl_func ssl_sw[]
static
Initial value:
= {
{"SSL_free", NULL},
{"SSL_accept", NULL},
{"SSL_connect", NULL},
{"SSL_read", NULL},
{"SSL_write", NULL},
{"SSL_get_error", NULL},
{"SSL_set_fd", NULL},
{"SSL_new", NULL},
{"SSL_CTX_new", NULL},
{"SSLv23_server_method", NULL},
{"SSL_library_init", NULL},
{"SSL_CTX_use_PrivateKey_file", NULL},
{"SSL_CTX_use_certificate_file",NULL},
{"SSL_CTX_set_default_passwd_cb",NULL},
{"SSL_CTX_free", NULL},
{"SSL_load_error_strings", NULL},
{"SSL_CTX_use_certificate_chain_file", NULL},
{"SSLv23_client_method", NULL},
{"SSL_pending", NULL},
{"SSL_CTX_set_verify", NULL},
{"SSL_shutdown", NULL},
}
#define NULL
Definition: Rtypes.h:82

Definition at line 436 of file civetweb.c.

int sTlsInit = 0
static

Definition at line 653 of file civetweb.c.

pthread_key_t sTlsKey
static

Definition at line 652 of file civetweb.c.