support options method

This commit is contained in:
lxsang 2020-09-21 20:10:07 +02:00
parent 8c11f06ff0
commit 1e4856b08a
2 changed files with 8 additions and 8 deletions

Binary file not shown.

View File

@ -110,13 +110,13 @@ static int config_handler(void *conf, const char *section, const char *name,
} }
else if (MATCH("SERVER", "plugins_ext")) else if (MATCH("SERVER", "plugins_ext"))
{ {
if(pconfig->plugins_ext) if (pconfig->plugins_ext)
free(pconfig->plugins_ext); free(pconfig->plugins_ext);
pconfig->plugins_ext = strdup(value); pconfig->plugins_ext = strdup(value);
} }
else if (MATCH("SERVER", "database")) else if (MATCH("SERVER", "database"))
{ {
if(pconfig->db_path) if (pconfig->db_path)
free(pconfig->db_path); free(pconfig->db_path);
pconfig->db_path = strdup(value); pconfig->db_path = strdup(value);
if (stat(pconfig->db_path, &st) == -1) if (stat(pconfig->db_path, &st) == -1)
@ -124,7 +124,7 @@ static int config_handler(void *conf, const char *section, const char *name,
} }
else if (MATCH("SERVER", "tmpdir")) else if (MATCH("SERVER", "tmpdir"))
{ {
if(pconfig->tmpdir) if (pconfig->tmpdir)
free(pconfig->tmpdir); free(pconfig->tmpdir);
pconfig->tmpdir = strdup(value); pconfig->tmpdir = strdup(value);
if (stat(pconfig->tmpdir, &st) == -1) if (stat(pconfig->tmpdir, &st) == -1)
@ -136,7 +136,7 @@ static int config_handler(void *conf, const char *section, const char *name,
} }
else if (MATCH("SERVER", "statistic_fifo")) else if (MATCH("SERVER", "statistic_fifo"))
{ {
if(pconfig->stat_fifo_path) if (pconfig->stat_fifo_path)
free(pconfig->stat_fifo_path); free(pconfig->stat_fifo_path);
pconfig->stat_fifo_path = strdup(value); pconfig->stat_fifo_path = strdup(value);
} }
@ -169,19 +169,19 @@ static int config_handler(void *conf, const char *section, const char *name,
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
else if (MATCH("SERVER", "ssl.cert")) else if (MATCH("SERVER", "ssl.cert"))
{ {
if(pconfig->sslcert) if (pconfig->sslcert)
free(pconfig->sslcert); free(pconfig->sslcert);
pconfig->sslcert = strdup(value); pconfig->sslcert = strdup(value);
} }
else if (MATCH("SERVER", "ssl.key")) else if (MATCH("SERVER", "ssl.key"))
{ {
if(pconfig->sslkey) if (pconfig->sslkey)
free(pconfig->sslkey); free(pconfig->sslkey);
pconfig->sslkey = strdup(value); pconfig->sslkey = strdup(value);
} }
else if (MATCH("SERVER", "ssl.cipher")) else if (MATCH("SERVER", "ssl.cipher"))
{ {
if(pconfig->ssl_cipher) if (pconfig->ssl_cipher)
free(pconfig->ssl_cipher); free(pconfig->ssl_cipher);
pconfig->ssl_cipher = strdup(value); pconfig->ssl_cipher = strdup(value);
} }
@ -873,7 +873,7 @@ void *decode_request(void *data)
ws = 1; ws = 1;
method = (char *)dvalue(rq->request, "METHOD"); method = (char *)dvalue(rq->request, "METHOD");
task = antd_create_task(NULL, (void *)rq, NULL, rq->client->last_io); task = antd_create_task(NULL, (void *)rq, NULL, rq->client->last_io);
if (strcmp(method, "GET") == 0 || strcmp(method, "HEAD") == 0) if (strcmp(method, "GET") == 0 || strcmp(method, "HEAD") == 0 || strcmp(method, "OPTIONS") == 0)
{ {
//if(ctype) free(ctype); //if(ctype) free(ctype);
if (ws && ws_key != NULL) if (ws && ws_key != NULL)