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

Method connect_server

lib_acl_cpp/samples/ssl/https_proxy/https_client.cpp:19–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19bool https_client::connect_server(const acl::string& server_addr,
20 acl::http_client& client)
21{
22 // �Ȳ鱾��ӳ�������û��ӳ����
23 master_service& ms = acl::singleton2<master_service>::get_instance();
24 const char* addr = ms.get_addr(server_addr.c_str());
25 if (addr == NULL) {
26 addr = server_addr.c_str();
27 }
28
29 if (!client.open(addr, 60, 60, true)) {
30 out_.format("connect server %s error", addr);
31 return false;
32 } else {
33 logger_debug(DEBUG, 1, "connect server ok");
34 }
35
36 if (ssl_conf_) {
37 logger_debug(DEBUG, 1, "begin open ssl");
38
39 acl::sslbase_io* ssl = ssl_conf_->create(false);
40 if (client.get_stream().setup_hook(ssl) == ssl) {
41 out_.puts("open ssl client error");
42 ssl->destroy();
43 return false;
44 } else {
45 logger_debug(DEBUG, 1, "open ssl ok");
46 }
47 }
48
49 return true;
50}
51
52bool https_client::http_request(acl::HttpServletRequest& req,
53 acl::HttpServletResponse& res)

Callers

nothing calls this directly

Calls 9

putsMethod · 0.80
get_addrMethod · 0.45
c_strMethod · 0.45
openMethod · 0.45
formatMethod · 0.45
createMethod · 0.45
setup_hookMethod · 0.45
get_streamMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected