Fix config handling

This commit is contained in:
Tobias Reisinger 2020-11-12 21:58:01 +01:00
parent fad3d80f39
commit fca35ade9e
18 changed files with 125 additions and 139 deletions

View file

@ -14,7 +14,7 @@ endpoint_func_index(struct mg_connection *nc, struct http_message *hm, endpoint_
response->status_code = 0;
mg_serve_http(nc, hm, global_config.http_server_opts);
mg_serve_http(nc, hm, global_config->http_server_opts);
}
void
@ -24,19 +24,19 @@ endpoint_func_not_found(struct mg_connection *nc, struct http_message *hm, endpo
(void)hm;
(void)nc;
if(access(global_config.not_found_file, R_OK) != -1)
if(access(global_config->not_found_file, R_OK) != -1)
{
struct mg_str mime_type = mg_mk_str(global_config.not_found_file_type);
struct mg_str mime_type = mg_mk_str(global_config->not_found_file_type);
response->status_code = 0;
mg_http_serve_file(nc, hm, global_config.not_found_file, mime_type, mg_mk_str(""));
mg_http_serve_file(nc, hm, global_config->not_found_file, mime_type, mg_mk_str(""));
}
else
{
LOGGER_DEBUG("404 file not found\n");
response->status_code = 404;
response->content_type = global_config.not_found_content_type;
response->content_length = strlen(global_config.not_found_content);
response->content = global_config.not_found_content;
response->content_type = global_config->not_found_content_type;
response->content_length = strlen(global_config->not_found_content);
response->content = global_config->not_found_content;
response->alloced_content = false;
}