mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-04-11 03:28:55 +02:00
MHD_start_daemon doesn't like NULL options
This commit is contained in:
parent
7c3e849a4a
commit
1c153b7266
|
|
@ -451,17 +451,28 @@ int http_api__start(struct mosquitto__listener *listener)
|
|||
if(rp->ai_family == AF_INET6){
|
||||
flags |= MHD_USE_IPv6;
|
||||
}
|
||||
listener->mhd = MHD_start_daemon(flags, port, NULL, NULL, &http_api_handler, listener,
|
||||
MHD_OPTION_SOCK_ADDR, rp->ai_addr,
|
||||
MHD_OPTION_HTTPS_MEM_CERT, x509_cert,
|
||||
MHD_OPTION_HTTPS_MEM_KEY, x509_key,
|
||||
MHD_OPTION_END);
|
||||
if(x509_cert && x509_key){
|
||||
listener->mhd = MHD_start_daemon(flags, port, NULL, NULL, &http_api_handler, listener,
|
||||
MHD_OPTION_SOCK_ADDR, rp->ai_addr,
|
||||
MHD_OPTION_HTTPS_MEM_CERT, x509_cert,
|
||||
MHD_OPTION_HTTPS_MEM_KEY, x509_key,
|
||||
MHD_OPTION_END);
|
||||
}else{
|
||||
listener->mhd = MHD_start_daemon(flags, port, NULL, NULL, &http_api_handler, listener,
|
||||
MHD_OPTION_SOCK_ADDR, rp->ai_addr,
|
||||
MHD_OPTION_END);
|
||||
}
|
||||
freeaddrinfo(ainfo);
|
||||
}else{
|
||||
listener->mhd = MHD_start_daemon(flags | MHD_USE_DUAL_STACK, port, NULL, NULL, &http_api_handler, listener,
|
||||
MHD_OPTION_HTTPS_MEM_CERT, x509_cert,
|
||||
MHD_OPTION_HTTPS_MEM_KEY, x509_key,
|
||||
MHD_OPTION_END);
|
||||
if(x509_cert && x509_key){
|
||||
listener->mhd = MHD_start_daemon(flags | MHD_USE_DUAL_STACK, port, NULL, NULL, &http_api_handler, listener,
|
||||
MHD_OPTION_HTTPS_MEM_CERT, x509_cert,
|
||||
MHD_OPTION_HTTPS_MEM_KEY, x509_key,
|
||||
MHD_OPTION_END);
|
||||
}else{
|
||||
listener->mhd = MHD_start_daemon(flags | MHD_USE_DUAL_STACK, port, NULL, NULL, &http_api_handler, listener,
|
||||
MHD_OPTION_END);
|
||||
}
|
||||
}
|
||||
|
||||
mosquitto_FREE(x509_cert);
|
||||
|
|
|
|||
Loading…
Reference in a new issue