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

Function test0

lib_acl_cpp/samples/ssl/ssl_client/ssl_client.cpp:18–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16static acl::polarssl_conf* __ssl_conf;
17
18static void test0(int i)
19{
20 acl::socket_stream client;
21 acl::string addr("127.0.0.1:441");
22 if (!client.open(addr.c_str(), 60, 60)) {
23 std::cout << "connect " << addr.c_str()
24 << " error!" << std::endl;
25 return;
26 }
27
28 acl::polarssl_io* ssl = new acl::polarssl_io(*__ssl_conf, false);
29 if (client.setup_hook(ssl) == ssl) {
30 std::cout << "open ssl " << addr.c_str()
31 << " error!" << std::endl;
32 ssl->destroy();
33 return;
34 }
35
36 char line[1024];
37 memset(line, 'x', sizeof(line));
38 line[1023] = 0;
39 line[1022] = '\n';
40 if (client.write(line, strlen(line)) == -1) {
41 std::cout << "write to " << addr.c_str()
42 << " error!" << std::endl;
43 return;
44 }
45
46 size_t n = sizeof(line);
47 if (!client.gets(line, &n)) {
48 std::cout << "gets from " << addr.c_str()
49 << " error!" << std::endl;
50 return;
51 }
52 if (i < 10) {
53 std::cout << ">>gets: " << line << std::endl;
54 }
55}
56
57static void test1(const char* domain, int port, bool use_gzip, bool use_ssl)
58{

Callers 1

mainFunction · 0.85

Calls 6

getsMethod · 0.80
openMethod · 0.45
c_strMethod · 0.45
setup_hookMethod · 0.45
destroyMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…