Commit d9f9911d authored by Sergey Lyubka's avatar Sergey Lyubka

removed max request size from options, moved to the #define

parent 93b45625
...@@ -228,6 +228,7 @@ typedef int SOCKET; ...@@ -228,6 +228,7 @@ typedef int SOCKET;
#define CGI_ENVIRONMENT_SIZE 4096 #define CGI_ENVIRONMENT_SIZE 4096
#define MAX_CGI_ENVIR_VARS 64 #define MAX_CGI_ENVIR_VARS 64
#define MG_BUF_LEN 8192 #define MG_BUF_LEN 8192
#define MAX_REQUEST_SIZE 16384
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#ifdef _WIN32 #ifdef _WIN32
...@@ -427,7 +428,7 @@ struct socket { ...@@ -427,7 +428,7 @@ struct socket {
// NOTE(lsm): this enum shoulds be in sync with the config_options below. // NOTE(lsm): this enum shoulds be in sync with the config_options below.
enum { enum {
CGI_EXTENSIONS, CGI_ENVIRONMENT, PUT_DELETE_PASSWORDS_FILE, CGI_INTERPRETER, CGI_EXTENSIONS, CGI_ENVIRONMENT, PUT_DELETE_PASSWORDS_FILE, CGI_INTERPRETER,
MAX_REQUEST_SIZE, PROTECT_URI, AUTHENTICATION_DOMAIN, SSI_EXTENSIONS, PROTECT_URI, AUTHENTICATION_DOMAIN, SSI_EXTENSIONS,
ACCESS_LOG_FILE, SSL_CHAIN_FILE, ENABLE_DIRECTORY_LISTING, ERROR_LOG_FILE, ACCESS_LOG_FILE, SSL_CHAIN_FILE, ENABLE_DIRECTORY_LISTING, ERROR_LOG_FILE,
GLOBAL_PASSWORDS_FILE, INDEX_FILES, ENABLE_KEEP_ALIVE, ACCESS_CONTROL_LIST, GLOBAL_PASSWORDS_FILE, INDEX_FILES, ENABLE_KEEP_ALIVE, ACCESS_CONTROL_LIST,
EXTRA_MIME_TYPES, LISTENING_PORTS, DOCUMENT_ROOT, SSL_CERTIFICATE, EXTRA_MIME_TYPES, LISTENING_PORTS, DOCUMENT_ROOT, SSL_CERTIFICATE,
...@@ -440,7 +441,6 @@ static const char *config_options[] = { ...@@ -440,7 +441,6 @@ static const char *config_options[] = {
"E", "cgi_environment", NULL, "E", "cgi_environment", NULL,
"G", "put_delete_passwords_file", NULL, "G", "put_delete_passwords_file", NULL,
"I", "cgi_interpreter", NULL, "I", "cgi_interpreter", NULL,
"M", "max_request_size", "16384",
"P", "protect_uri", NULL, "P", "protect_uri", NULL,
"R", "authentication_domain", "mydomain.com", "R", "authentication_domain", "mydomain.com",
"S", "ssi_pattern", "**.shtml$|**.shtm$", "S", "ssi_pattern", "**.shtml$|**.shtm$",
...@@ -4182,13 +4182,12 @@ static int consume_socket(struct mg_context *ctx, struct socket *sp) { ...@@ -4182,13 +4182,12 @@ static int consume_socket(struct mg_context *ctx, struct socket *sp) {
static void worker_thread(struct mg_context *ctx) { static void worker_thread(struct mg_context *ctx) {
struct mg_connection *conn; struct mg_connection *conn;
int buf_size = atoi(ctx->config[MAX_REQUEST_SIZE]);
conn = (struct mg_connection *) calloc(1, sizeof(*conn) + buf_size); conn = (struct mg_connection *) calloc(1, sizeof(*conn) + MAX_REQUEST_SIZE);
if (conn == NULL) { if (conn == NULL) {
cry(fc(), "%s", "Cannot create new connection struct, OOM"); cry(fc(), "%s", "Cannot create new connection struct, OOM");
} else { } else {
conn->buf_size = buf_size; conn->buf_size = MAX_REQUEST_SIZE;
conn->buf = (char *) (conn + 1); conn->buf = (char *) (conn + 1);
// Call consume_socket() even when ctx->stop_flag > 0, to let it signal // Call consume_socket() even when ctx->stop_flag > 0, to let it signal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment