21 {
22 try {
23 if( options.count( "https-client-root-cert" )) {
24 const std::vector<std::string> root_pems = options["https-client-root-cert"].as<std::vector<std::string>>();
25 for( const auto& root_pem : root_pems ) {
26 std::string pem_str = root_pem;
27 if( !boost::algorithm::starts_with( pem_str, "-----BEGIN CERTIFICATE-----\n" )) {
28 try {
29 auto infile = std::ifstream( pem_str );
30 std::stringstream sstr;
31 sstr << infile.rdbuf();
32 pem_str = sstr.str();
33 SYS_ASSERT( boost::algorithm::starts_with( pem_str,
"-----BEGIN CERTIFICATE-----\n" ),
34 chain::invalid_http_client_root_cert,
35 "File does not appear to be a PEM encoded certificate" );
36 } catch ( const std::bad_alloc& ) {
37 throw;
38 } catch ( const boost::interprocess::bad_alloc& ) {
39 throw;
42 } catch ( const std::exception& e ) {
44 }
45 }
46
47 try {
48 my->add_cert( pem_str );
49 } catch ( const std::bad_alloc& ) {
50 throw;
51 } catch ( const boost::interprocess::bad_alloc& ) {
52 throw;
55 } catch ( const std::exception& e ) {
57 }
58 }
59 }
60
61 my->set_verify_peers( options.at( "https-client-validate-peers" ).as<bool>());
63}
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Used to generate a useful error report when an exception is thrown.
std::string to_detail_string(log_level ll=log_level::all) const
static std_exception_wrapper from_current_exception(const std::exception &e)
#define FC_LOG_AND_RETHROW()