Merge branch '2.2' into 2.3

This commit is contained in:
Markus Mäkelä
2019-07-16 12:59:03 +03:00
5 changed files with 48 additions and 65 deletions

View File

@ -375,6 +375,19 @@ static bool load_ssl_certificates()
return rval;
}
static bool log_daemon_errors = true;
void admin_log_error(void* arg, const char* fmt, va_list ap)
{
if (log_daemon_errors)
{
char buf[1024];
vsnprintf(buf, sizeof(buf), fmt, ap);
trim(buf);
MXS_ERROR("HTTP daemon error: %s\n", buf);
}
}
bool mxs_admin_init()
{
struct sockaddr_storage addr;
@ -383,7 +396,7 @@ bool mxs_admin_init()
config_get_global_options()->admin_port,
&addr))
{
int options = MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY;
int options = MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY | MHD_USE_DEBUG;
if (addr.ss_family == AF_INET6)
{
@ -397,27 +410,20 @@ bool mxs_admin_init()
}
// The port argument is ignored and the port in the struct sockaddr is used instead
http_daemon = MHD_start_daemon(options,
0,
NULL,
NULL,
handle_client,
NULL,
MHD_OPTION_NOTIFY_COMPLETED,
close_client,
NULL,
MHD_OPTION_SOCK_ADDR,
&addr,
http_daemon = MHD_start_daemon(options, 0, NULL, NULL, handle_client, NULL,
MHD_OPTION_EXTERNAL_LOGGER, admin_log_error, NULL,
MHD_OPTION_NOTIFY_COMPLETED, close_client, NULL,
MHD_OPTION_SOCK_ADDR, &addr,
!using_ssl ? MHD_OPTION_END :
MHD_OPTION_HTTPS_MEM_KEY,
admin_ssl_key,
MHD_OPTION_HTTPS_MEM_CERT,
admin_ssl_cert,
MHD_OPTION_HTTPS_MEM_TRUST,
admin_ssl_cert,
MHD_OPTION_HTTPS_MEM_KEY, admin_ssl_key,
MHD_OPTION_HTTPS_MEM_CERT, admin_ssl_cert,
MHD_OPTION_HTTPS_MEM_TRUST, admin_ssl_cert,
MHD_OPTION_END);
}
// Silence all other errors to prevent malformed requests from flooding the log
log_daemon_errors = false;
return http_daemon != NULL;
}

View File

@ -365,9 +365,9 @@
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
"version": "4.17.14",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz",
"integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw=="
},
"mime-db": {
"version": "1.37.0",

View File

@ -903,6 +903,7 @@ static int gw_read_and_write(DCB* dcb)
if (auth_change_requested(read_buffer)
&& handle_auth_change_response(read_buffer, proto, dcb))
{
gwbuf_free(read_buffer);
return 0;
}
else