mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
Add comments for mg_get_valid_options and format spaces in the header
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/* Copyright (c) 2004-2013 Sergey Lyubka
|
||||
/* Copyright (c) 2013-2014 the Civetweb developers
|
||||
* Copyright (c) 2004-2013 Sergey Lyubka
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -154,6 +155,7 @@ struct mg_callbacks {
|
||||
int (*http_error)(struct mg_connection *, int status);
|
||||
};
|
||||
|
||||
|
||||
/* Start web server.
|
||||
|
||||
Parameters:
|
||||
@@ -191,6 +193,7 @@ CIVETWEB_API struct mg_context *mg_start(const struct mg_callbacks *callbacks,
|
||||
threads are stopped. Context pointer becomes invalid. */
|
||||
CIVETWEB_API void mg_stop(struct mg_context *);
|
||||
|
||||
|
||||
/* mg_request_handler
|
||||
|
||||
Called when a new request comes in. This callback is URI based
|
||||
@@ -204,6 +207,7 @@ CIVETWEB_API void mg_stop(struct mg_context *);
|
||||
1: the handler processed the request. */
|
||||
typedef int (* mg_request_handler)(struct mg_connection *conn, void *cbdata);
|
||||
|
||||
|
||||
/* mg_set_request_handler
|
||||
|
||||
Sets or removes a URI mapping for a request handler.
|
||||
@@ -258,8 +262,11 @@ enum {
|
||||
CONFIG_TYPE_EXT_PATTERN = 0x6
|
||||
};
|
||||
|
||||
CIVETWEB_API const struct mg_option *mg_get_valid_options(void);
|
||||
|
||||
/* Return array of struct mg_option, representing all valid configuration
|
||||
options of civetweb.c.
|
||||
The array is terminated by a NULL name option. */
|
||||
CIVETWEB_API const struct mg_option *mg_get_valid_options(void);
|
||||
|
||||
|
||||
/* Get the list of ports that civetweb is listening on.
|
||||
@@ -271,6 +278,7 @@ CIVETWEB_API const struct mg_option *mg_get_valid_options(void);
|
||||
configuration at run time. */
|
||||
CIVETWEB_API size_t mg_get_ports(const struct mg_context *ctx, size_t size, int* ports, int* ssl);
|
||||
|
||||
|
||||
/* Add, edit or delete the entry in the passwords file.
|
||||
|
||||
This function allows an application to manipulate .htpasswd files on the
|
||||
@@ -316,6 +324,7 @@ CIVETWEB_API int mg_write(struct mg_connection *, const void *buf, size_t len);
|
||||
CIVETWEB_API int mg_websocket_write(struct mg_connection* conn, int opcode,
|
||||
const char *data, size_t data_len);
|
||||
|
||||
|
||||
/* Blocks until unique access is obtained to this connection. Intended for use
|
||||
with websockets only.
|
||||
Invoke this before mg_write or mg_printf when communicating with a
|
||||
@@ -324,6 +333,7 @@ CIVETWEB_API int mg_websocket_write(struct mg_connection* conn, int opcode,
|
||||
CIVETWEB_API void mg_lock(struct mg_connection* conn);
|
||||
CIVETWEB_API void mg_unlock(struct mg_connection* conn);
|
||||
|
||||
|
||||
/* Opcodes, from http://tools.ietf.org/html/rfc6455 */
|
||||
enum {
|
||||
WEBSOCKET_OPCODE_CONTINUATION = 0x0,
|
||||
@@ -355,7 +365,6 @@ enum {
|
||||
#endif
|
||||
|
||||
/* Send data to the client using printf() semantics.
|
||||
|
||||
Works exactly like mg_write(), but allows to do message formatting. */
|
||||
CIVETWEB_API int mg_printf(struct mg_connection *,
|
||||
PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
|
||||
@@ -403,6 +412,7 @@ CIVETWEB_API const char *mg_get_header(const struct mg_connection *, const char
|
||||
CIVETWEB_API int mg_get_var(const char *data, size_t data_len,
|
||||
const char *var_name, char *dst, size_t dst_len);
|
||||
|
||||
|
||||
/* Get a value of particular form variable.
|
||||
|
||||
Parameters:
|
||||
@@ -429,6 +439,7 @@ CIVETWEB_API int mg_get_var(const char *data, size_t data_len,
|
||||
CIVETWEB_API int mg_get_var2(const char *data, size_t data_len,
|
||||
const char *var_name, char *dst, size_t dst_len, size_t occurrence);
|
||||
|
||||
|
||||
/* Fetch value of certain cookie variable into the destination buffer.
|
||||
|
||||
Destination buffer is guaranteed to be '\0' - terminated. In case of
|
||||
@@ -491,6 +502,7 @@ CIVETWEB_API const char *mg_get_builtin_mime_type(const char *file_name);
|
||||
/* Return Civetweb version. */
|
||||
CIVETWEB_API const char *mg_version(void);
|
||||
|
||||
|
||||
/* URL-decode input buffer into destination buffer.
|
||||
0-terminate the destination buffer.
|
||||
form-url-encoded data differs from URI encoding in a way that it
|
||||
@@ -500,11 +512,13 @@ CIVETWEB_API const char *mg_version(void);
|
||||
CIVETWEB_API int mg_url_decode(const char *src, int src_len, char *dst,
|
||||
int dst_len, int is_form_url_encoded);
|
||||
|
||||
|
||||
/* URL-encode input buffer into destination buffer.
|
||||
returns the length of the resulting buffer or -1
|
||||
is the buffer is too small. */
|
||||
CIVETWEB_API int mg_url_encode(const char *src, char *dst, size_t dst_len);
|
||||
|
||||
|
||||
/* MD5 hash given strings.
|
||||
Buffer 'buf' must be 33 bytes long. Varargs is a NULL terminated list of
|
||||
ASCIIz strings. When function returns, buf will contain human-readable
|
||||
@@ -524,9 +538,11 @@ CIVETWEB_API char *mg_md5(char buf[33], ...);
|
||||
CIVETWEB_API void mg_cry(struct mg_connection *conn,
|
||||
PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
|
||||
|
||||
|
||||
/* utility method to compare two buffers, case incensitive. */
|
||||
CIVETWEB_API int mg_strncasecmp(const char *s1, const char *s2, size_t len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Reference in New Issue
Block a user