Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
9f44fe66
Commit
9f44fe66
authored
May 27, 2019
by
Micha Mueller
Browse files
RestServer: Log error before crashing if invalid file path for certificates is given
parent
b9de46ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/src/RESTHttpsServer.cpp
View file @
9f44fe66
...
...
@@ -61,10 +61,15 @@ RESTHttpsServer::RESTHttpsServer(serverSettings_t settings) :
});
*/
//TODO make more robust if certificate not found
_ctx
->
use_certificate_chain_file
(
settings
.
certificate
);
_ctx
->
use_private_key_file
(
settings
.
privateKey
,
ssl
::
context
::
pem
);
_ctx
->
use_tmp_dh_file
(
settings
.
dhFile
);
try
{
_ctx
->
use_certificate_chain_file
(
settings
.
certificate
);
_ctx
->
use_private_key_file
(
settings
.
privateKey
,
ssl
::
context
::
pem
);
_ctx
->
use_tmp_dh_file
(
settings
.
dhFile
);
}
catch
(
const
std
::
exception
&
e
)
{
ServerLOG
(
fatal
)
<<
"Could not load certificate OR private key OR DH settings file! "
"Please ensure the paths in the config file are valid!"
;
throw
;
}
// This will receive the new connection
_socket
=
std
::
unique_ptr
<
tcp
::
socket
>
(
new
tcp
::
socket
(
*
_io
));
...
...
@@ -76,7 +81,7 @@ RESTHttpsServer::RESTHttpsServer(serverSettings_t settings) :
_acceptor
=
std
::
unique_ptr
<
tcp
::
acceptor
>
(
new
tcp
::
acceptor
(
*
_io
,
{
address
,
port
}));
_acceptor
->
set_option
(
tcp
::
acceptor
::
reuse_address
(
true
));
}
catch
(
const
std
::
exception
&
e
)
{
LOG
(
fatal
)
<<
"RestAPI address invalid! Please make sure IP address and port are valid!"
;
Server
LOG
(
fatal
)
<<
"RestAPI address invalid! Please make sure IP address and port are valid!"
;
throw
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment