Classes | Macros | Typedefs | Enumerations | Functions | Variables
mongoose.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <dirent.h>
#include <dlfcn.h>
#include <inttypes.h>
#include <pwd.h>
#include "mongoose.h"
#include <sys/mman.h>
Include dependency graph for mongoose.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cgi_env_block
 
union  char64long16
 
struct  connection
 
struct  ctl_msg
 
struct  dir_entry
 
union  endpoint
 
struct  iobuf
 
struct  MD5Context
 
struct  mg_server
 
struct  ns_connection
 
struct  ns_mgr
 
struct  ns_str
 
struct  SHA1_CTX
 
union  socket_address
 
struct  vec
 

Macros

#define __cdecl
 
#define __STDC_FORMAT_MACROS
 
#define __STDC_LIMIT_MACROS
 
#define _CRT_SECURE_NO_WARNINGS
 
#define _FILE_OFFSET_BITS   64
 
#define _INTEGRAL_MAX_BITS   64
 
#define _LARGEFILE_SOURCE
 
#define _MBCS
 
#define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
 
#define blk(i)
 
#define CGI_ENVIRONMENT_SIZE   8192
 
#define closesocket(x)   close(x)
 
#define DBG(x)
 
#define DEFAULT_CGI_PATTERN   "**.cgi$|**.pl$|**.php$"
 
#define ENV_EXPORT_TO_CGI   "MONGOOSE_CGI"
 
#define F1(x, y, z)   (z ^ (x & (y ^ z)))
 
#define F2(x, y, z)   F1(z, x, y)
 
#define F3(x, y, z)   (x ^ y ^ z)
 
#define F4(x, y, z)   (y ^ (x | ~z))
 
#define HEXTOI(x)   (isdigit(x) ? (x) - '0' : (x) - 'W')
 
#define INT64_FMT   PRId64
 
#define INVALID_SOCKET   (-1)
 
#define IOBUF_SIZE   8192
 
#define MAX_CGI_ENVIR_VARS   64
 
#define MAX_PATH_SIZE   8192
 
#define MAX_REQUEST_SIZE   16384
 
#define MD5STEP(f, w, x, y, z, data, s)   ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
 
#define MG_CGI_CONN   NSF_USER_3
 
#define MG_CONN_2_CONN(c)
 
#define MG_HEADERS_SENT   NSF_USER_1
 
#define MG_PROXY_CONN   NSF_USER_4
 
#define MG_PROXY_DONT_PARSE   NSF_USER_5
 
#define MG_USING_CHUNKED_API   NSF_USER_2
 
#define MONGOOSE_IDLE_TIMEOUT_SECONDS   300
 
#define MONGOOSE_POST_SIZE_LIMIT   0
 
#define MONGOOSE_USE_EXTRA_HTTP_HEADERS   ""
 
#define MONGOOSE_USE_WEBSOCKET_PING_INTERVAL   5
 
#define NS_ACCEPT   1
 
#define NS_CALLOC   calloc
 
#define NS_CLOSE   5
 
#define NS_CONNECT   2
 
#define NS_CTL_MSG_MESSAGE_SIZE   (8 * 1024)
 
#define NS_DISABLE_THREADS
 
#define NS_FREE   free
 
#define NS_MALLOC   malloc
 
#define NS_POLL   0
 
#define NS_READ_BUFFER_SIZE   2048
 
#define NS_REALLOC   realloc
 
#define NS_RECV   3
 
#define NS_SEND   4
 
#define NS_SKELETON_HEADER_INCLUDED
 
#define NS_SKELETON_VERSION   "2.1.0"
 
#define NS_UDP_RECEIVE_BUFFER_SIZE   2000
 
#define NS_VPRINTF_BUFFER_SIZE   500
 
#define NSF_BUFFER_BUT_DONT_SEND   (1 << 1)
 
#define NSF_CLOSE_IMMEDIATELY   (1 << 4)
 
#define NSF_CONNECTING   (1 << 3)
 
#define NSF_FINISHED_SENDING_DATA   (1 << 0)
 
#define NSF_LISTENING   (1 << 7)
 
#define NSF_SSL_HANDSHAKE_DONE   (1 << 2)
 
#define NSF_UDP   (1 << 8)
 
#define NSF_USER_1   (1 << 20)
 
#define NSF_USER_2   (1 << 21)
 
#define NSF_USER_3   (1 << 22)
 
#define NSF_USER_4   (1 << 23)
 
#define NSF_USER_5   (1 << 24)
 
#define NSF_USER_6   (1 << 25)
 
#define NSF_WANT_READ   (1 << 5)
 
#define NSF_WANT_WRITE   (1 << 6)
 
#define O_BINARY   0
 
#define PASSWORDS_FILE_NAME   ".htpasswd"
 
#define R0(v, w, x, y, z, i)   z+=((w&(x^y))^y)+blk0(block, i)+0x5A827999+rol(v,5);w=rol(w,30);
 
#define R1(v, w, x, y, z, i)   z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
 
#define R2(v, w, x, y, z, i)   z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
 
#define R3(v, w, x, y, z, i)   z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
 
#define R4(v, w, x, y, z, i)   z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
 
#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))
 
#define SHA1HANDSOFF
 
#define to64(x)   strtoll(x, NULL, 10)
 

Typedefs

typedef struct stat file_stat_t
 
typedef struct MD5Context MD5_CTX
 
typedef void(* ns_callback_t) (struct ns_connection *, int event_num, void *evp)
 
typedef struct stat ns_stat_t
 
typedef pid_t process_id_t
 
typedef int sock_t
 
typedef void * SSL
 
typedef void * SSL_CTX
 

Enumerations

enum  {
  ACCESS_CONTROL_LIST, ACCESS_LOG_FILE, AUTH_DOMAIN, CGI_INTERPRETER,
  CGI_PATTERN, DAV_AUTH_FILE, DAV_ROOT, DOCUMENT_ROOT,
  ENABLE_DIRECTORY_LISTING, ENABLE_PROXY, EXTRA_MIME_TYPES, GLOBAL_AUTH_FILE,
  HIDE_FILES_PATTERN, HEXDUMP_FILE, INDEX_FILES, LISTENING_PORT,
  RUN_AS_USER, SSI_PATTERN, URL_REWRITES, NUM_OPTIONS
}
 
enum  endpoint_type {
  EP_NONE, EP_FILE, EP_CGI, EP_USER,
  EP_PUT, EP_CLIENT, EP_PROXY
}
 

Functions

static struct ns_connectionaccept_conn (struct ns_connection *ls)
 
static char * addenv (struct cgi_env_block *block, const char *fmt,...)
 
static void addenv2 (struct cgi_env_block *blk, const char *name)
 
static void base64_encode (const unsigned char *src, int src_len, char *dst)
 
static void bin2str (char *to, const unsigned char *p, size_t len)
 
static uint32_t blk0 (union char64long16 *block, int i)
 
static void byteReverse (unsigned char *buf, unsigned longs)
 
static void call_http_client_handler (struct connection *conn)
 
static int call_request_handler (struct connection *conn)
 
static void call_request_handler_if_data_is_buffered (struct connection *conn)
 
static int call_user (struct connection *conn, enum mg_event ev)
 
static int check_acl (const char *acl, uint32_t remote_ip)
 
static int check_password (const char *method, const char *ha1, const char *uri, const char *nonce, const char *nc, const char *cnonce, const char *qop, const char *response)
 
static void close_local_endpoint (struct connection *conn)
 
static int __cdecl compare_dir_entries (const void *p1, const void *p2)
 
static void construct_etag (char *buf, size_t buf_len, const file_stat_t *st)
 
static int convert_uri_to_file_name (struct connection *conn, char *buf, size_t buf_len, file_stat_t *st)
 
static size_t deliver_websocket_frame (struct connection *conn)
 
static void do_proxy (struct connection *conn)
 
static void do_ssi_exec (struct mg_connection *conn, char *tag)
 
static void do_ssi_include (struct mg_connection *conn, const char *ssi, char *tag, int include_level)
 
static int find_index_file (struct connection *conn, char *path, size_t path_len, file_stat_t *stp)
 
static void forward_put_data (struct connection *conn)
 
static int get_line_len (const char *buf, int buf_len)
 
static void get_mime_type (const struct mg_server *server, const char *path, struct vec *vec)
 
static int get_month_index (const char *s)
 
static int get_option_index (const char *name)
 
static int get_request_len (const char *s, size_t buf_len)
 
static int get_var (const char *data, size_t data_len, const char *name, char *dst, size_t dst_len)
 
static void gmt_time_string (char *buf, size_t buf_len, time_t *t)
 
static void handle_delete (struct connection *conn, const char *path)
 
static void handle_mkcol (struct connection *conn, const char *path)
 
static void handle_propfind (struct connection *conn, const char *path, file_stat_t *stp, int exists)
 
static void handle_put (struct connection *conn, const char *path)
 
static void handle_ssi_request (struct connection *conn, const char *path)
 
static void hexdump (struct ns_connection *nc, const char *path, int num_bytes, int ev)
 
size_t iobuf_append (struct iobuf *, const void *data, size_t data_size)
 
void iobuf_free (struct iobuf *)
 
void iobuf_init (struct iobuf *, size_t initial_size)
 
void iobuf_remove (struct iobuf *, size_t data_size)
 
void iobuf_resize (struct iobuf *, size_t new_size)
 
static int is_authorized (struct connection *conn, const char *path, int is_directory)
 
static int is_authorized_for_dav (struct connection *conn)
 
static int is_big_endian (void)
 
static int is_dav_request (const struct connection *conn)
 
static int is_not_modified (const struct connection *conn, const file_stat_t *stp)
 
static int is_valid_http_method (const char *s)
 
static int is_valid_uri (const char *uri)
 
static int isbyte (int n)
 
static void iter2 (struct ns_connection *nc, int ev, void *param)
 
static void log_access (const struct connection *conn, const char *path)
 
static void log_header (const struct mg_connection *conn, const char *header, FILE *fp)
 
static int lowercase (const char *s)
 
static void MD5Final (unsigned char digest[16], MD5_CTX *ctx)
 
static void MD5Init (MD5_CTX *ctx)
 
static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
 
static void MD5Update (MD5_CTX *ctx, unsigned char const *buf, unsigned len)
 
int mg_authorize_digest (struct mg_connection *c, FILE *fp)
 
struct mg_connectionmg_connect (struct mg_server *server, const char *addr)
 
void mg_copy_listeners (struct mg_server *s, struct mg_server *to)
 
struct mg_servermg_create_server (void *server_data, mg_handler_t handler)
 
void mg_destroy_server (struct mg_server **server)
 
static void mg_ev_handler (struct ns_connection *nc, int ev, void *p)
 
int mg_forward (struct mg_connection *c, const char *addr)
 
const char * mg_get_header (const struct mg_connection *ri, const char *s)
 
const char * mg_get_mime_type (const char *path, const char *default_mime_type)
 
const char * mg_get_option (const struct mg_server *server, const char *name)
 
const char ** mg_get_valid_option_names (void)
 
int mg_get_var (const struct mg_connection *conn, const char *name, char *dst, size_t dst_len)
 
int mg_match_prefix (const char *pattern, ssize_t pattern_len, const char *str)
 
char * mg_md5 (char buf[33],...)
 
void * mg_mmap (FILE *fp, size_t size)
 
void mg_munmap (void *p, size_t size)
 
struct mg_connectionmg_next (struct mg_server *s, struct mg_connection *c)
 
int mg_parse_header (const char *s, const char *var_name, char *buf, size_t buf_size)
 
int mg_parse_multipart (const char *buf, int buf_len, char *var_name, int var_name_len, char *file_name, int file_name_len, const char **data, int *data_len)
 
time_t mg_poll_server (struct mg_server *server, int milliseconds)
 
size_t mg_printf (struct mg_connection *conn, const char *fmt,...)
 
size_t mg_printf_data (struct mg_connection *c, const char *fmt,...)
 
size_t mg_send_data (struct mg_connection *c, const void *data, int data_len)
 
void mg_send_digest_auth_request (struct mg_connection *c)
 
void mg_send_file (struct mg_connection *c, const char *file_name, const char *extra_headers)
 
void mg_send_file_data (struct mg_connection *c, int fd)
 
void mg_send_file_internal (struct mg_connection *c, const char *file_name, file_stat_t *st, int exists, const char *extra_headers)
 
void mg_send_header (struct mg_connection *c, const char *name, const char *v)
 
void mg_send_status (struct mg_connection *c, int status)
 
const char * mg_set_option (struct mg_server *server, const char *name, const char *value)
 
static int mg_snprintf (char *buf, size_t buflen, const char *fmt,...)
 
static int mg_strcasecmp (const char *s1, const char *s2)
 
static char * mg_strdup (const char *str)
 
static int mg_strncasecmp (const char *s1, const char *s2, size_t len)
 
void mg_template (struct mg_connection *conn, const char *s, struct mg_expansion *expansions)
 
int mg_url_decode (const char *src, size_t src_len, char *dst, size_t dst_len, int is_form_url_encoded)
 
size_t mg_url_encode (const char *src, size_t s_len, char *dst, size_t dst_len)
 
static int mg_vsnprintf (char *buf, size_t buflen, const char *fmt, va_list ap)
 
void mg_wakeup_server (struct mg_server *server)
 
void mg_wakeup_server_ex (struct mg_server *server, mg_handler_t cb, const char *fmt,...)
 
size_t mg_websocket_printf (struct mg_connection *conn, int opcode, const char *fmt,...)
 
size_t mg_websocket_write (struct mg_connection *conn, int opcode, const char *data, size_t data_len)
 
size_t mg_write (struct mg_connection *c, const void *buf, size_t len)
 
static int must_hide_file (struct connection *conn, const char *path)
 
static const char * next_option (const char *list, struct vec *val, struct vec *eq_val)
 
static void ns_add_conn (struct ns_mgr *mgr, struct ns_connection *c)
 
struct ns_connectionns_add_sock (struct ns_mgr *, sock_t, ns_callback_t, void *)
 
static void ns_add_to_set (sock_t sock, fd_set *set, sock_t *max_fd)
 
int ns_avprintf (char **buf, size_t size, const char *fmt, va_list ap)
 
struct ns_connectionns_bind (struct ns_mgr *, const char *, ns_callback_t, void *)
 
void ns_broadcast (struct ns_mgr *, ns_callback_t, void *, size_t)
 
static void ns_call (struct ns_connection *nc, int ev, void *p)
 
static void ns_close_conn (struct ns_connection *conn)
 
struct ns_connectionns_connect (struct ns_mgr *, const char *, ns_callback_t, void *)
 
static void ns_destroy_conn (struct ns_connection *conn)
 
static void ns_forward (struct ns_connection *from, struct ns_connection *to)
 
static void ns_handle_udp (struct ns_connection *ls)
 
int ns_hexdump (const void *buf, int len, char *dst, int dst_len)
 
static int ns_is_error (int n)
 
void ns_mgr_free (struct ns_mgr *)
 
void ns_mgr_init (struct ns_mgr *, void *user_data)
 
time_t ns_mgr_poll (struct ns_mgr *, int milli)
 
struct ns_connectionns_next (struct ns_mgr *, struct ns_connection *)
 
static sock_t ns_open_listening_socket (union socket_address *sa, int proto)
 
static size_t ns_out (struct ns_connection *nc, const void *buf, size_t len)
 
static int ns_parse_address (const char *str, union socket_address *sa, int *proto, int *use_ssl, char *cert, char *ca)
 
int ns_printf (struct ns_connection *, const char *fmt,...)
 
static void ns_read_from_socket (struct ns_connection *conn)
 
static void ns_remove_conn (struct ns_connection *conn)
 
int ns_resolve (const char *domain_name, char *ip_addr_buf, size_t buf_len)
 
static int ns_resolve2 (const char *host, struct in_addr *ina)
 
int ns_send (struct ns_connection *, const void *buf, size_t len)
 
void ns_set_close_on_exec (sock_t)
 
static void ns_set_non_blocking_mode (sock_t sock)
 
void ns_sock_to_str (sock_t sock, char *buf, size_t len, int flags)
 
int ns_socketpair (sock_t[2])
 
int ns_socketpair2 (sock_t[2], int sock_type)
 
void * ns_start_thread (void *(*f)(void *), void *p)
 
int ns_vprintf (struct ns_connection *, const char *fmt, va_list ap)
 
static void ns_write_to_socket (struct ns_connection *conn)
 
static int num_leap_years (int year)
 
static void on_accept (struct ns_connection *nc, union socket_address *sa)
 
static void on_cgi_data (struct ns_connection *nc)
 
static void on_recv_data (struct connection *conn)
 
static FILE * open_auth_file (struct connection *conn, const char *path, int is_directory)
 
static void open_cgi_endpoint (struct connection *conn, const char *prog)
 
static void open_file_endpoint (struct connection *conn, const char *path, file_stat_t *st, const char *extra_headers)
 
static void open_local_endpoint (struct connection *conn, int skip_user)
 
static time_t parse_date_string (const char *datetime)
 
static int parse_header (const char *str, size_t str_len, const char *var_name, char *buf, size_t buf_size)
 
static void parse_http_headers (char **buf, struct mg_connection *ri)
 
static size_t parse_http_message (char *buf, size_t len, struct mg_connection *ri)
 
static int parse_net (const char *spec, uint32_t *net, uint32_t *mask)
 
static int parse_range_header (const char *header, int64_t *a, int64_t *b)
 
static void ping_idle_websocket_connection (struct connection *conn, time_t t)
 
static void prepare_cgi_environment (struct connection *conn, const char *prog, struct cgi_env_block *blk)
 
static void print_dir_entry (const struct dir_entry *de)
 
static void print_props (struct connection *conn, const char *uri, file_stat_t *stp)
 
static void process_response (struct connection *conn)
 
static void process_udp (struct ns_connection *nc)
 
static void proxify_connection (struct connection *conn)
 
static void proxy_request (struct ns_connection *pc, struct mg_connection *c)
 
static int put_dir (const char *path)
 
static int remove_directory (const char *dir)
 
static void remove_double_dots_and_double_slashes (char *s)
 
static int scan_directory (struct connection *conn, const char *dir, struct dir_entry **arr)
 
static void send_continue_if_expected (struct connection *conn)
 
static void send_directory_listing (struct connection *conn, const char *dir)
 
static void send_file_data (struct mg_connection *conn, FILE *fp)
 
static void send_http_error (struct connection *conn, int code, const char *fmt,...)
 
static void send_options (struct connection *conn)
 
static void send_ssi_file (struct mg_connection *, const char *, FILE *, int)
 
static void send_websocket_handshake (struct mg_connection *conn, const char *key)
 
static void send_websocket_handshake_if_requested (struct mg_connection *conn)
 
static void set_default_option_values (char **opts)
 
static void set_ips (struct ns_connection *nc, int is_rem)
 
static void SHA1Final (unsigned char digest[20], SHA1_CTX *context)
 
static void SHA1Init (SHA1_CTX *context)
 
static void SHA1Transform (uint32_t state[5], const unsigned char buffer[64])
 
static void SHA1Update (SHA1_CTX *context, const unsigned char *data, size_t len)
 
static int should_keep_alive (const struct mg_connection *conn)
 
static char * skip (char **buf, const char *delimiters)
 
static process_id_t start_process (const char *interp, const char *cmd, const char *env, const char *envp[], const char *dir, sock_t sock)
 
static const char * status_code_to_str (int status_code)
 
static const char * suggest_connection_header (const struct mg_connection *conn)
 
static void terminate_headers (struct mg_connection *c)
 
static void transfer_file_data (struct connection *conn)
 
static void try_parse (struct connection *conn)
 
static void write_chunk (struct connection *conn, const char *buf, int len)
 
static void write_terminating_chunk (struct connection *conn)
 

Variables

static const char cgi_status [] = "HTTP/1.1 200 OK\r\n"
 
struct {
   size_t   ext_len
 
   const char *   extension
 
   const char *   mime_type
 
static_builtin_mime_types []
 
static const char * static_config_options []
 

Macro Definition Documentation

#define __cdecl

Definition at line 144 of file mongoose.c.

#define __STDC_FORMAT_MACROS

Definition at line 54 of file mongoose.c.

#define __STDC_LIMIT_MACROS

Definition at line 55 of file mongoose.c.

#define _CRT_SECURE_NO_WARNINGS

Definition at line 48 of file mongoose.c.

#define _FILE_OFFSET_BITS   64

Definition at line 59 of file mongoose.c.

#define _INTEGRAL_MAX_BITS   64

Definition at line 46 of file mongoose.c.

#define _LARGEFILE_SOURCE

Definition at line 57 of file mongoose.c.

#define _MBCS

Definition at line 45 of file mongoose.c.

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

Definition at line 163 of file mongoose.c.

#define blk (   i)
Value:
(block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
^block->l[(i+2)&15]^block->l[i&15],1))
unsigned int i
Definition: unit1303.c:79
#define rol(value, bits)
Definition: mongoose.c:2823

Definition at line 2842 of file mongoose.c.

#define CGI_ENVIRONMENT_SIZE   8192

Definition at line 1356 of file mongoose.c.

#define closesocket (   x)    close(x)

Definition at line 142 of file mongoose.c.

#define DBG (   x)

Definition at line 159 of file mongoose.c.

#define DEFAULT_CGI_PATTERN   "**.cgi$|**.pl$|**.php$"

Definition at line 1355 of file mongoose.c.

#define ENV_EXPORT_TO_CGI   "MONGOOSE_CGI"

Definition at line 1358 of file mongoose.c.

#define F1 (   x,
  y,
  z 
)    (z ^ (x & (y ^ z)))

Definition at line 3938 of file mongoose.c.

#define F2 (   x,
  y,
  z 
)    F1(z, x, y)

Definition at line 3939 of file mongoose.c.

#define F3 (   x,
  y,
  z 
)    (x ^ y ^ z)

Definition at line 3940 of file mongoose.c.

#define F4 (   x,
  y,
  z 
)    (y ^ (x | ~z))

Definition at line 3941 of file mongoose.c.

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

Definition at line 1345 of file mongoose.c.

#define INVALID_SOCKET   (-1)

Definition at line 149 of file mongoose.c.

#define IOBUF_SIZE   8192

Definition at line 1353 of file mongoose.c.

#define MAX_CGI_ENVIR_VARS   64

Definition at line 1357 of file mongoose.c.

#define MAX_PATH_SIZE   8192

Definition at line 1354 of file mongoose.c.

#define MAX_REQUEST_SIZE   16384

Definition at line 1352 of file mongoose.c.

#define MD5STEP (   f,
  w,
  x,
  y,
  z,
  data,
  s 
)    ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )

Definition at line 3943 of file mongoose.c.

#define MG_CGI_CONN   NSF_USER_3

Definition at line 1504 of file mongoose.c.

#define MG_CONN_2_CONN (   c)
Value:
((struct connection *) ((char *) (c) - \
offsetof(struct connection, mg_conn)))
struct mg_connection mg_conn
Definition: mongoose.c:1510

Definition at line 1521 of file mongoose.c.

#define MG_HEADERS_SENT   NSF_USER_1

Definition at line 1502 of file mongoose.c.

#define MG_PROXY_CONN   NSF_USER_4

Definition at line 1505 of file mongoose.c.

#define MG_PROXY_DONT_PARSE   NSF_USER_5

Definition at line 1506 of file mongoose.c.

#define MG_USING_CHUNKED_API   NSF_USER_2

Definition at line 1503 of file mongoose.c.

#define MONGOOSE_IDLE_TIMEOUT_SECONDS   300

Definition at line 1375 of file mongoose.c.

#define MONGOOSE_POST_SIZE_LIMIT   0

Definition at line 1371 of file mongoose.c.

#define MONGOOSE_USE_EXTRA_HTTP_HEADERS   ""

Definition at line 1367 of file mongoose.c.

#define MONGOOSE_USE_WEBSOCKET_PING_INTERVAL   5

Definition at line 1362 of file mongoose.c.

#define NS_ACCEPT   1

Definition at line 216 of file mongoose.c.

#define NS_CALLOC   calloc

Definition at line 330 of file mongoose.c.

#define NS_CLOSE   5

Definition at line 220 of file mongoose.c.

#define NS_CONNECT   2

Definition at line 217 of file mongoose.c.

#define NS_CTL_MSG_MESSAGE_SIZE   (8 * 1024)

Definition at line 333 of file mongoose.c.

#define NS_DISABLE_THREADS

Definition at line 71 of file mongoose.c.

#define NS_FREE   free

Definition at line 326 of file mongoose.c.

#define NS_MALLOC   malloc

Definition at line 318 of file mongoose.c.

#define NS_POLL   0

Definition at line 215 of file mongoose.c.

#define NS_READ_BUFFER_SIZE   2048

Definition at line 334 of file mongoose.c.

#define NS_REALLOC   realloc

Definition at line 322 of file mongoose.c.

#define NS_RECV   3

Definition at line 218 of file mongoose.c.

#define NS_SEND   4

Definition at line 219 of file mongoose.c.

#define NS_SKELETON_HEADER_INCLUDED

Definition at line 39 of file mongoose.c.

#define NS_SKELETON_VERSION   "2.1.0"

Definition at line 41 of file mongoose.c.

#define NS_UDP_RECEIVE_BUFFER_SIZE   2000

Definition at line 335 of file mongoose.c.

#define NS_VPRINTF_BUFFER_SIZE   500

Definition at line 336 of file mongoose.c.

#define NSF_BUFFER_BUT_DONT_SEND   (1 << 1)

Definition at line 249 of file mongoose.c.

#define NSF_CLOSE_IMMEDIATELY   (1 << 4)

Definition at line 252 of file mongoose.c.

#define NSF_CONNECTING   (1 << 3)

Definition at line 251 of file mongoose.c.

#define NSF_FINISHED_SENDING_DATA   (1 << 0)

Definition at line 248 of file mongoose.c.

#define NSF_LISTENING   (1 << 7)

Definition at line 255 of file mongoose.c.

#define NSF_SSL_HANDSHAKE_DONE   (1 << 2)

Definition at line 250 of file mongoose.c.

#define NSF_UDP   (1 << 8)

Definition at line 256 of file mongoose.c.

#define NSF_USER_1   (1 << 20)

Definition at line 258 of file mongoose.c.

#define NSF_USER_2   (1 << 21)

Definition at line 259 of file mongoose.c.

#define NSF_USER_3   (1 << 22)

Definition at line 260 of file mongoose.c.

#define NSF_USER_4   (1 << 23)

Definition at line 261 of file mongoose.c.

#define NSF_USER_5   (1 << 24)

Definition at line 262 of file mongoose.c.

#define NSF_USER_6   (1 << 25)

Definition at line 263 of file mongoose.c.

#define NSF_WANT_READ   (1 << 5)

Definition at line 253 of file mongoose.c.

#define NSF_WANT_WRITE   (1 << 6)

Definition at line 254 of file mongoose.c.

#define O_BINARY   0

Definition at line 1343 of file mongoose.c.

#define PASSWORDS_FILE_NAME   ".htpasswd"

Definition at line 1359 of file mongoose.c.

#define R0 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=((w&(x^y))^y)+blk0(block, i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 2844 of file mongoose.c.

#define R1 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 2845 of file mongoose.c.

#define R2 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);

Definition at line 2846 of file mongoose.c.

#define R3 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);

Definition at line 2847 of file mongoose.c.

#define R4 (   v,
  w,
  x,
  y,
  z,
  i 
)    z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);

Definition at line 2848 of file mongoose.c.

#define rol (   value,
  bits 
)    (((value) << (bits)) | ((value) >> (32 - (bits))))

Definition at line 2823 of file mongoose.c.

#define SHA1HANDSOFF

Definition at line 2816 of file mongoose.c.

#define to64 (   x)    strtoll(x, NULL, 10)

Definition at line 150 of file mongoose.c.

Typedef Documentation

typedef struct stat file_stat_t

Definition at line 1346 of file mongoose.c.

typedef struct MD5Context MD5_CTX
typedef void(* ns_callback_t) (struct ns_connection *, int event_num, void *evp)

Definition at line 212 of file mongoose.c.

typedef struct stat ns_stat_t

Definition at line 152 of file mongoose.c.

typedef pid_t process_id_t

Definition at line 1347 of file mongoose.c.

typedef int sock_t

Definition at line 151 of file mongoose.c.

typedef void* SSL

Definition at line 172 of file mongoose.c.

typedef void* SSL_CTX

Definition at line 173 of file mongoose.c.

Enumeration Type Documentation

anonymous enum
Enumerator
ACCESS_CONTROL_LIST 
ACCESS_LOG_FILE 
AUTH_DOMAIN 
CGI_INTERPRETER 
CGI_PATTERN 
DAV_AUTH_FILE 
DAV_ROOT 
DOCUMENT_ROOT 
ENABLE_DIRECTORY_LISTING 
ENABLE_PROXY 
EXTRA_MIME_TYPES 
GLOBAL_AUTH_FILE 
HIDE_FILES_PATTERN 
HEXDUMP_FILE 
INDEX_FILES 
LISTENING_PORT 
RUN_AS_USER 
SSI_PATTERN 
URL_REWRITES 
NUM_OPTIONS 

Definition at line 1407 of file mongoose.c.

Enumerator
EP_NONE 
EP_FILE 
EP_CGI 
EP_USER 
EP_PUT 
EP_CLIENT 
EP_PROXY 

Definition at line 1498 of file mongoose.c.

Function Documentation

static struct ns_connection* accept_conn ( struct ns_connection ls)
static

Definition at line 825 of file mongoose.c.

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

Definition at line 2159 of file mongoose.c.

static void addenv2 ( struct cgi_env_block blk,
const char *  name 
)
static

Definition at line 2188 of file mongoose.c.

static void base64_encode ( const unsigned char *  src,
int  src_len,
char *  dst 
)
static

Definition at line 2952 of file mongoose.c.

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

Definition at line 4111 of file mongoose.c.

static uint32_t blk0 ( union char64long16 block,
int  i 
)
static

Definition at line 2825 of file mongoose.c.

static void byteReverse ( unsigned char *  buf,
unsigned  longs 
)
static

Definition at line 3924 of file mongoose.c.

static void call_http_client_handler ( struct connection conn)
static

Definition at line 4788 of file mongoose.c.

static int call_request_handler ( struct connection conn)
static

Definition at line 3145 of file mongoose.c.

static void call_request_handler_if_data_is_buffered ( struct connection conn)
static

Definition at line 3401 of file mongoose.c.

static int call_user ( struct connection conn,
enum mg_event  ev 
)
static

Definition at line 1885 of file mongoose.c.

static int check_acl ( const char *  acl,
uint32_t  remote_ip 
)
static

Definition at line 2411 of file mongoose.c.

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 4142 of file mongoose.c.

static void close_local_endpoint ( struct connection conn)
static

Definition at line 4884 of file mongoose.c.

static int __cdecl compare_dir_entries ( const void *  p1,
const void *  p2 
)
static

Definition at line 3599 of file mongoose.c.

static void construct_etag ( char *  buf,
size_t  buf_len,
const file_stat_t st 
)
static

Definition at line 3253 of file mongoose.c.

static int convert_uri_to_file_name ( struct connection conn,
char *  buf,
size_t  buf_len,
file_stat_t st 
)
static

Definition at line 2663 of file mongoose.c.

static size_t deliver_websocket_frame ( struct connection conn)
static

Definition at line 2997 of file mongoose.c.

static void do_proxy ( struct connection conn)
static

Definition at line 4721 of file mongoose.c.

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

Definition at line 4320 of file mongoose.c.

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

Definition at line 4274 of file mongoose.c.

static int find_index_file ( struct connection conn,
char *  path,
size_t  path_len,
file_stat_t stp 
)
static

Definition at line 3272 of file mongoose.c.

static void forward_put_data ( struct connection conn)
static

Definition at line 3839 of file mongoose.c.

static int get_line_len ( const char *  buf,
int  buf_len 
)
static

Definition at line 5050 of file mongoose.c.

static void get_mime_type ( const struct mg_server server,
const char *  path,
struct vec vec 
)
static

Definition at line 3225 of file mongoose.c.

static int get_month_index ( const char *  s)
static

Definition at line 3177 of file mongoose.c.

static int get_option_index ( const char *  name)
static

Definition at line 5120 of file mongoose.c.

static int get_request_len ( const char *  s,
size_t  buf_len 
)
static

Definition at line 1760 of file mongoose.c.

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

Definition at line 4993 of file mongoose.c.

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

Definition at line 3327 of file mongoose.c.

static void handle_delete ( struct connection conn,
const char *  path 
)
static

Definition at line 3769 of file mongoose.c.

static void handle_mkcol ( struct connection conn,
const char *  path 
)
static

Definition at line 3728 of file mongoose.c.

static void handle_propfind ( struct connection conn,
const char *  path,
file_stat_t stp,
int  exists 
)
static

Definition at line 3679 of file mongoose.c.

static void handle_put ( struct connection conn,
const char *  path 
)
static

Definition at line 3804 of file mongoose.c.

static void handle_ssi_request ( struct connection conn,
const char *  path 
)
static

Definition at line 4398 of file mongoose.c.

static void hexdump ( struct ns_connection nc,
const char *  path,
int  num_bytes,
int  ev 
)
static

Definition at line 507 of file mongoose.c.

size_t iobuf_append ( struct iobuf io,
const void *  data,
size_t  data_size 
)

Definition at line 365 of file mongoose.c.

void iobuf_free ( struct iobuf iobuf)

Definition at line 358 of file mongoose.c.

void iobuf_init ( struct iobuf iobuf,
size_t  initial_size 
)

Definition at line 352 of file mongoose.c.

void iobuf_remove ( struct iobuf io,
size_t  data_size 
)

Definition at line 392 of file mongoose.c.

void iobuf_resize ( struct iobuf io,
size_t  new_size 
)

Definition at line 343 of file mongoose.c.

static int is_authorized ( struct connection conn,
const char *  path,
int  is_directory 
)
static

Definition at line 4193 of file mongoose.c.

static int is_authorized_for_dav ( struct connection conn)
static

Definition at line 4206 of file mongoose.c.

static int is_big_endian ( void  )
static

Definition at line 2807 of file mongoose.c.

static int is_dav_request ( const struct connection conn)
static

Definition at line 2649 of file mongoose.c.

static int is_not_modified ( const struct connection conn,
const file_stat_t stp 
)
static

Definition at line 3259 of file mongoose.c.

static int is_valid_http_method ( const char *  s)
static

Definition at line 2481 of file mongoose.c.

static int is_valid_uri ( const char *  uri)
static

Definition at line 4687 of file mongoose.c.

static int isbyte ( int  n)
static

Definition at line 2390 of file mongoose.c.

static void iter2 ( struct ns_connection nc,
int  ev,
void *  param 
)
static

Definition at line 5391 of file mongoose.c.

static void log_access ( const struct connection conn,
const char *  path 
)
static

Definition at line 4855 of file mongoose.c.

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

Definition at line 4844 of file mongoose.c.

static int lowercase ( const char *  s)
static

Definition at line 2540 of file mongoose.c.

static void MD5Final ( unsigned char  digest[16],
MD5_CTX ctx 
)
static

Definition at line 4076 of file mongoose.c.

static void MD5Init ( MD5_CTX ctx)
static

Definition at line 3948 of file mongoose.c.

static void MD5Transform ( uint32_t  buf[4],
uint32_t const  in[16] 
)
static

Definition at line 3958 of file mongoose.c.

static void MD5Update ( MD5_CTX ctx,
unsigned char const *  buf,
unsigned  len 
)
static

Definition at line 4040 of file mongoose.c.

int mg_authorize_digest ( struct mg_connection c,
FILE *  fp 
)

Definition at line 4163 of file mongoose.c.

struct mg_connection* mg_connect ( struct mg_server server,
const char *  addr 
)

Definition at line 4818 of file mongoose.c.

void mg_copy_listeners ( struct mg_server s,
struct mg_server to 
)

Definition at line 5099 of file mongoose.c.

struct mg_server* mg_create_server ( void *  server_data,
mg_handler_t  handler 
)

Definition at line 5431 of file mongoose.c.

void mg_destroy_server ( struct mg_server **  server)

Definition at line 4969 of file mongoose.c.

static void mg_ev_handler ( struct ns_connection nc,
int  ev,
void *  p 
)
static

Definition at line 5267 of file mongoose.c.

int mg_forward ( struct mg_connection c,
const char *  addr 
)

Definition at line 4474 of file mongoose.c.

const char* mg_get_header ( const struct mg_connection ri,
const char *  s 
)

Definition at line 2566 of file mongoose.c.

const char* mg_get_mime_type ( const char *  path,
const char *  default_mime_type 
)

Definition at line 3158 of file mongoose.c.

const char* mg_get_option ( const struct mg_server server,
const char *  name 
)

Definition at line 5425 of file mongoose.c.

const char** mg_get_valid_option_names ( void  )

Definition at line 5095 of file mongoose.c.

int mg_get_var ( const struct mg_connection conn,
const char *  name,
char *  dst,
size_t  dst_len 
)

Definition at line 5040 of file mongoose.c.

int mg_match_prefix ( const char *  pattern,
ssize_t  pattern_len,
const char *  str 
)

Definition at line 2577 of file mongoose.c.

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

Definition at line 4122 of file mongoose.c.

void* mg_mmap ( FILE *  fp,
size_t  size 
)

Definition at line 1638 of file mongoose.c.

void mg_munmap ( void *  p,
size_t  size 
)

Definition at line 1643 of file mongoose.c.

struct mg_connection* mg_next ( struct mg_server s,
struct mg_connection c 
)

Definition at line 4983 of file mongoose.c.

int mg_parse_header ( const char *  s,
const char *  var_name,
char *  buf,
size_t  buf_size 
)

Definition at line 4258 of file mongoose.c.

int mg_parse_multipart ( const char *  buf,
int  buf_len,
char *  var_name,
int  var_name_len,
char *  file_name,
int  file_name_len,
const char **  data,
int *  data_len 
)

Definition at line 5056 of file mongoose.c.

time_t mg_poll_server ( struct mg_server server,
int  milliseconds 
)

Definition at line 4965 of file mongoose.c.

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

Definition at line 1949 of file mongoose.c.

size_t mg_printf_data ( struct mg_connection c,
const char *  fmt,
  ... 
)

Definition at line 2785 of file mongoose.c.

size_t mg_send_data ( struct mg_connection c,
const void *  data,
int  data_len 
)

Definition at line 2778 of file mongoose.c.

void mg_send_digest_auth_request ( struct mg_connection c)

Definition at line 3862 of file mongoose.c.

void mg_send_file ( struct mg_connection c,
const char *  file_name,
const char *  extra_headers 
)

Definition at line 4585 of file mongoose.c.

void mg_send_file_data ( struct mg_connection c,
int  fd 
)

Definition at line 3393 of file mongoose.c.

void mg_send_file_internal ( struct mg_connection c,
const char *  file_name,
file_stat_t st,
int  exists,
const char *  extra_headers 
)

Definition at line 4526 of file mongoose.c.

void mg_send_header ( struct mg_connection c,
const char *  name,
const char *  v 
)

Definition at line 2759 of file mongoose.c.

void mg_send_status ( struct mg_connection c,
int  status 
)

Definition at line 2750 of file mongoose.c.

const char* mg_set_option ( struct mg_server server,
const char *  name,
const char *  value 
)

Definition at line 5143 of file mongoose.c.

static int mg_snprintf ( char *  buf,
size_t  buflen,
const char *  fmt,
  ... 
)
static

Definition at line 1747 of file mongoose.c.

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

Definition at line 2544 of file mongoose.c.

static char* mg_strdup ( const char *  str)
static

Definition at line 2382 of file mongoose.c.

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

Definition at line 2554 of file mongoose.c.

void mg_template ( struct mg_connection conn,
const char *  s,
struct mg_expansion expansions 
)

Definition at line 2618 of file mongoose.c.

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

Definition at line 2455 of file mongoose.c.

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

Definition at line 3541 of file mongoose.c.

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

Definition at line 1734 of file mongoose.c.

void mg_wakeup_server ( struct mg_server server)

Definition at line 5421 of file mongoose.c.

void mg_wakeup_server_ex ( struct mg_server server,
mg_handler_t  cb,
const char *  fmt,
  ... 
)

Definition at line 5405 of file mongoose.c.

size_t mg_websocket_printf ( struct mg_connection conn,
int  opcode,
const char *  fmt,
  ... 
)

Definition at line 3101 of file mongoose.c.

size_t mg_websocket_write ( struct mg_connection conn,
int  opcode,
const char *  data,
size_t  data_len 
)

Definition at line 3045 of file mongoose.c.

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

Definition at line 2744 of file mongoose.c.

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

Definition at line 2655 of file mongoose.c.

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

Definition at line 1699 of file mongoose.c.

static void ns_add_conn ( struct ns_mgr mgr,
struct ns_connection c 
)
static

Definition at line 433 of file mongoose.c.

struct ns_connection* ns_add_sock ( struct ns_mgr s,
sock_t  sock,
ns_callback_t  callback,
void *  user_data 
)

Definition at line 1209 of file mongoose.c.

static void ns_add_to_set ( sock_t  sock,
fd_set *  set,
sock_t max_fd 
)
static

Definition at line 1062 of file mongoose.c.

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

Definition at line 449 of file mongoose.c.

struct ns_connection* ns_bind ( struct ns_mgr srv,
const char *  str,
ns_callback_t  callback,
void *  user_data 
)

Definition at line 784 of file mongoose.c.

void ns_broadcast ( struct ns_mgr mgr,
ns_callback_t  cb,
void *  data,
size_t  len 
)

Definition at line 1231 of file mongoose.c.

static void ns_call ( struct ns_connection nc,
int  ev,
void *  p 
)
static

Definition at line 532 of file mongoose.c.

static void ns_close_conn ( struct ns_connection conn)
static

Definition at line 556 of file mongoose.c.

struct ns_connection* ns_connect ( struct ns_mgr mgr,
const char *  address,
ns_callback_t  callback,
void *  user_data 
)

Definition at line 1166 of file mongoose.c.

static void ns_destroy_conn ( struct ns_connection conn)
static

Definition at line 541 of file mongoose.c.

static void ns_forward ( struct ns_connection from,
struct ns_connection to 
)
static

Definition at line 1960 of file mongoose.c.

static void ns_handle_udp ( struct ns_connection ls)
static

Definition at line 1036 of file mongoose.c.

int ns_hexdump ( const void *  buf,
int  len,
char *  dst,
int  dst_len 
)

Definition at line 895 of file mongoose.c.

static int ns_is_error ( int  n)
static

Definition at line 854 of file mongoose.c.

void ns_mgr_free ( struct ns_mgr s)

Definition at line 1267 of file mongoose.c.

void ns_mgr_init ( struct ns_mgr s,
void *  user_data 
)

Definition at line 1243 of file mongoose.c.

time_t ns_mgr_poll ( struct ns_mgr mgr,
int  milli 
)

Definition at line 1071 of file mongoose.c.

struct ns_connection* ns_next ( struct ns_mgr s,
struct ns_connection conn 
)

Definition at line 1227 of file mongoose.c.

static sock_t ns_open_listening_socket ( union socket_address sa,
int  proto 
)
static

Definition at line 723 of file mongoose.c.

static size_t ns_out ( struct ns_connection nc,
const void *  buf,
size_t  len 
)
static

Definition at line 399 of file mongoose.c.

static int ns_parse_address ( const char *  str,
union socket_address sa,
int *  proto,
int *  use_ssl,
char *  cert,
char *  ca 
)
static

Definition at line 666 of file mongoose.c.

int ns_printf ( struct ns_connection conn,
const char *  fmt,
  ... 
)

Definition at line 498 of file mongoose.c.

static void ns_read_from_socket ( struct ns_connection conn)
static

Definition at line 926 of file mongoose.c.

static void ns_remove_conn ( struct ns_connection conn)
static

Definition at line 440 of file mongoose.c.

int ns_resolve ( const char *  domain_name,
char *  ip_addr_buf,
size_t  buf_len 
)

Definition at line 660 of file mongoose.c.

static int ns_resolve2 ( const char *  host,
struct in_addr *  ina 
)
static

Definition at line 624 of file mongoose.c.

int ns_send ( struct ns_connection conn,
const void *  buf,
size_t  len 
)

Definition at line 1032 of file mongoose.c.

void ns_set_close_on_exec ( sock_t  sock)

Definition at line 563 of file mongoose.c.

static void ns_set_non_blocking_mode ( sock_t  sock)
static

Definition at line 571 of file mongoose.c.

void ns_sock_to_str ( sock_t  sock,
char *  buf,
size_t  len,
int  flags 
)

Definition at line 864 of file mongoose.c.

int ns_socketpair ( sock_t  sp[2])

Definition at line 618 of file mongoose.c.

int ns_socketpair2 ( sock_t  sp[2],
int  sock_type 
)

Definition at line 582 of file mongoose.c.

void* ns_start_thread ( void *(*)(void *)  f,
void *  p 
)
int ns_vprintf ( struct ns_connection nc,
const char *  fmt,
va_list  ap 
)

Definition at line 484 of file mongoose.c.

static void ns_write_to_socket ( struct ns_connection conn)
static

Definition at line 1001 of file mongoose.c.

static int num_leap_years ( int  year)
static

Definition at line 3191 of file mongoose.c.

static void on_accept ( struct ns_connection nc,
union socket_address sa 
)
static

Definition at line 5234 of file mongoose.c.

static void on_cgi_data ( struct ns_connection nc)
static

Definition at line 2340 of file mongoose.c.

static void on_recv_data ( struct connection conn)
static

Definition at line 4736 of file mongoose.c.

static FILE* open_auth_file ( struct connection conn,
const char *  path,
int  is_directory 
)
static

Definition at line 3877 of file mongoose.c.

static void open_cgi_endpoint ( struct connection conn,
const char *  prog 
)
static

Definition at line 2295 of file mongoose.c.

static void open_file_endpoint ( struct connection conn,
const char *  path,
file_stat_t st,
const char *  extra_headers 
)
static

Definition at line 3331 of file mongoose.c.

static void open_local_endpoint ( struct connection conn,
int  skip_user 
)
static

Definition at line 4593 of file mongoose.c.

static time_t parse_date_string ( const char *  datetime)
static

Definition at line 3196 of file mongoose.c.

static int parse_header ( const char *  str,
size_t  str_len,
const char *  var_name,
char *  buf,
size_t  buf_size 
)
static

Definition at line 4224 of file mongoose.c.

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

Definition at line 1801 of file mongoose.c.

static size_t parse_http_message ( char *  buf,
size_t  len,
struct mg_connection ri 
)
static

Definition at line 2492 of file mongoose.c.

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

Definition at line 2394 of file mongoose.c.

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

Definition at line 3323 of file mongoose.c.

static void ping_idle_websocket_connection ( struct connection conn,
time_t  t 
)
static

Definition at line 3132 of file mongoose.c.

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

Definition at line 2193 of file mongoose.c.

static void print_dir_entry ( const struct dir_entry de)
static

Definition at line 3565 of file mongoose.c.

static void print_props ( struct connection conn,
const char *  uri,
file_stat_t stp 
)
static

Definition at line 3658 of file mongoose.c.

static void process_response ( struct connection conn)
static

Definition at line 4805 of file mongoose.c.

static void process_udp ( struct ns_connection nc)
static

Definition at line 5255 of file mongoose.c.

static void proxify_connection ( struct connection conn)
static

Definition at line 4504 of file mongoose.c.

static void proxy_request ( struct ns_connection pc,
struct mg_connection c 
)
static

Definition at line 4420 of file mongoose.c.

static int put_dir ( const char *  path)
static

Definition at line 3787 of file mongoose.c.

static int remove_directory ( const char *  dir)
static

Definition at line 3745 of file mongoose.c.

static void remove_double_dots_and_double_slashes ( char *  s)
static

Definition at line 2436 of file mongoose.c.

static int scan_directory ( struct connection conn,
const char *  dir,
struct dir_entry **  arr 
)
static

Definition at line 3495 of file mongoose.c.

static void send_continue_if_expected ( struct connection conn)
static

Definition at line 4677 of file mongoose.c.

static void send_directory_listing ( struct connection conn,
const char *  dir 
)
static

Definition at line 3623 of file mongoose.c.

static void send_file_data ( struct mg_connection conn,
FILE *  fp 
)
static

Definition at line 4266 of file mongoose.c.

static void send_http_error ( struct connection conn,
int  code,
const char *  fmt,
  ... 
)
static

Definition at line 1891 of file mongoose.c.

static void send_options ( struct connection conn)
static

Definition at line 3853 of file mongoose.c.

static void send_ssi_file ( struct mg_connection conn,
const char *  path,
FILE *  fp,
int  include_level 
)
static

Definition at line 4335 of file mongoose.c.

static void send_websocket_handshake ( struct mg_connection conn,
const char *  key 
)
static

Definition at line 2977 of file mongoose.c.

static void send_websocket_handshake_if_requested ( struct mg_connection conn)
static

Definition at line 3120 of file mongoose.c.

static void set_default_option_values ( char **  opts)
static

Definition at line 5131 of file mongoose.c.

static void set_ips ( struct ns_connection nc,
int  is_rem 
)
static

Definition at line 5222 of file mongoose.c.

static void SHA1Final ( unsigned char  digest[20],
SHA1_CTX context 
)
static

Definition at line 2928 of file mongoose.c.

static void SHA1Init ( SHA1_CTX context)
static

Definition at line 2898 of file mongoose.c.

static void SHA1Transform ( uint32_t  state[5],
const unsigned char  buffer[64] 
)
static

Definition at line 2856 of file mongoose.c.

static void SHA1Update ( SHA1_CTX context,
const unsigned char *  data,
size_t  len 
)
static

Definition at line 2907 of file mongoose.c.

static int should_keep_alive ( const struct mg_connection conn)
static

Definition at line 2733 of file mongoose.c.

static char* skip ( char **  buf,
const char *  delimiters 
)
static

Definition at line 1783 of file mongoose.c.

static process_id_t start_process ( const char *  interp,
const char *  cmd,
const char *  env,
const char *  envp[],
const char *  dir,
sock_t  sock 
)
static

Definition at line 2106 of file mongoose.c.

static const char* status_code_to_str ( int  status_code)
static

Definition at line 1813 of file mongoose.c.

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

Definition at line 3249 of file mongoose.c.

static void terminate_headers ( struct mg_connection c)
static

Definition at line 2769 of file mongoose.c.

static void transfer_file_data ( struct connection conn)
static

Definition at line 4942 of file mongoose.c.

static void try_parse ( struct connection conn)
static

Definition at line 4695 of file mongoose.c.

static void write_chunk ( struct connection conn,
const char *  buf,
int  len 
)
static

Definition at line 1941 of file mongoose.c.

static void write_terminating_chunk ( struct connection conn)
static

Definition at line 3141 of file mongoose.c.

Variable Documentation

const char cgi_status[] = "HTTP/1.1 200 OK\r\n"
static

Definition at line 2293 of file mongoose.c.

size_t ext_len

Definition at line 1530 of file mongoose.c.

const char* extension

Definition at line 1529 of file mongoose.c.

const char* mime_type

Definition at line 1531 of file mongoose.c.

const { ... } static_builtin_mime_types[]
const char* static_config_options[]
static

Definition at line 1446 of file mongoose.c.



rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:17