MCPcopy Create free account
hub / github.com/acl-dev/acl / proc_on_init

Method proc_on_init

lib_acl_cpp/samples/ssl/https_proxy/master_service.cpp:191–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void master_service::proc_on_init()
192{
193 create_addrs_map();
194
195 if (var_cfg_log_file != NULL && *var_cfg_log_file != 0) {
196 if (!out_.open_write(var_cfg_log_file)) {
197 logger_error("open %s error %s", var_cfg_log_file,
198 acl::last_serror());
199 } else {
200 logger("open %s ok", var_cfg_log_file);
201 }
202 } else {
203 logger("no log file open");
204 }
205
206 bool use_mbedtls = false, use_polarssl = false;
207
208 if (!var_cfg_client_ssl) {
209 /* do nothing */
210 } else if (strstr(var_cfg_ssl_path, "mbedtls") != NULL) {
211 acl::string buf(var_cfg_ssl_path);
212 const std::vector<acl::string>& libs = buf.split2("; \r\r\n");
213 if (libs.size() != 3) {
214 logger_error("invalid ssl_path=%s", var_cfg_ssl_path);
215 } else {
216 acl::mbedtls_conf::set_libpath(libs[0], libs[1], libs[2]);
217 if (acl::mbedtls_conf::load()) {
218 client_ssl_conf_ = new acl::mbedtls_conf(false);
219 use_mbedtls = true;
220 } else {
221 logger_error("load %s error", var_cfg_ssl_path);
222 }
223 }
224 } else if (strstr(var_cfg_ssl_path, "polarssl") != NULL) {
225 acl::polarssl_conf::set_libpath(var_cfg_ssl_path);
226 if (acl::polarssl_conf::load()) {
227 client_ssl_conf_ = new acl::polarssl_conf;
228 use_polarssl = true;
229 } else {
230 var_cfg_client_ssl = 0;
231 logger_error("load %s error", var_cfg_ssl_path);
232 }
233 }
234
235 if (var_cfg_crt_file == NULL || *var_cfg_crt_file == 0
236 || var_cfg_key_file == NULL || *var_cfg_key_file == 0) {
237 return;
238 }
239
240 // ���ط���� SSL ֤��
241
242 if (use_mbedtls) {
243 server_ssl_conf_ = new acl::mbedtls_conf(true);
244 } else if (use_polarssl) {
245 server_ssl_conf_ = new acl::polarssl_conf();
246 } else {
247 return;
248 }

Callers

nothing calls this directly

Calls 6

last_serrorFunction · 0.50
open_writeMethod · 0.45
sizeMethod · 0.45
enable_cacheMethod · 0.45
add_certMethod · 0.45
set_keyMethod · 0.45

Tested by

no test coverage detected