Branch Coverage

src/xs/protocol/websocket.cc
Criterion Covered Total %
branch 178 366 48.6


line true false branch
6 0 7 if (!av.size()) return;
8 7 0 for (const auto& sv : av) {
7 0 for (const auto& sv : av) {
9 7 for (const auto& sv : av) {
9 9 0 const Array subav(sv);
10 0 9 if (!subav) continue;
11 9 0 auto namesv = subav.fetch(0);
9 0 auto namesv = subav.fetch(0);
12 0 9 if (!namesv) continue;
13 9 0 HeaderValue elem;
14 9 0 elem.name = xs::in(namesv);
9 0 elem.name = xs::in(namesv);
15 9 0 Hash args = subav.fetch(1);
9 0 Hash args = subav.fetch(1);
16 7 2 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
7 0 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
7 7 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
7 0 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
7 0 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
7 0 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
7 0 if (args) for (const auto& row : args) elem.params.emplace(string(row.key()), xs::in(row.value()));
17 9 0 vals->push_back(std::move(elem));
22 0 2 if (!vals.size()) return Array();
23 2 0 auto ret = Array::create(vals.size());
24 2 2 for (const auto& elem : vals) {
25 2 0 auto elemav = Array::create(2);
26 2 0 elemav.push(xs::out(elem.name));
2 0 elemav.push(xs::out(elem.name));
27 2 0 if (elem.params.size()) {
28 2 0 auto args = Hash::create(elem.params.size());
29 2 2 for (const auto& param : elem.params) {
30 2 0 args.store(param.first, xs::out(param.second));
2 0 args.store(param.first, xs::out(param.second));
32 2 0 elemav.push(Ref::create(args));
2 0 elemav.push(Ref::create(args));
34 2 0 ret.push(Ref::create(elemav));
2 0 ret.push(Ref::create(elemav));
40 23 0 for (const auto& elem : av) {
23 0 for (const auto& elem : av) {
1197472 23 for (const auto& elem : av) {
41 0 1197472 if (!elem.defined()) continue;
42 1197472 0 v.push_back(xs::in(elem));
1197472 0 v.push_back(xs::in(elem));
47 83 0 auto ret = dest ? dest : ConnectRequestSP(new ConnectRequest());
0 0 auto ret = dest ? dest : ConnectRequestSP(new ConnectRequest());
0 0 auto ret = dest ? dest : ConnectRequestSP(new ConnectRequest());
48 83 0 http::fill(ret, params);
52 83 0 if ((val = params.fetch("ws_key"))) ret->ws_key = xs::in(val);
56 27 if ((val = params.fetch("ws_key"))) ret->ws_key = xs::in(val);
56 0 if ((val = params.fetch("ws_key"))) ret->ws_key = xs::in(val);
56 0 if ((val = params.fetch("ws_key"))) ret->ws_key = xs::in(val);
53 83 0 if ((val = params.fetch("ws_version"))) ret->ws_version = SvIV(val);
4 79 if ((val = params.fetch("ws_version"))) ret->ws_version = SvIV(val);
4 0 if ((val = params.fetch("ws_version"))) ret->ws_version = SvIV(val);
0 0 if ((val = params.fetch("ws_version"))) ret->ws_version = SvIV(val);
54 83 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
4 79 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
4 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
4 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
56 83 0 if ((val = params.fetch("ws_extensions"))) {
6 77 if ((val = params.fetch("ws_extensions"))) {
57 6 0 auto exts_av = xs::in(val);
59 6 0 if (exts_av) av_to_header_values(exts_av, &exts);
6 0 if (exts_av) av_to_header_values(exts_av, &exts);
60 6 0 ret->ws_extensions(exts);
66 1 0 auto ret = dest ? dest : ConnectResponseSP(new ConnectResponse());
0 0 auto ret = dest ? dest : ConnectResponseSP(new ConnectResponse());
0 0 auto ret = dest ? dest : ConnectResponseSP(new ConnectResponse());
67 1 0 http::fill(ret, params);
71 1 0 if ((val = params.fetch("ws_extensions"))) {
1 0 if ((val = params.fetch("ws_extensions"))) {
73 1 0 av_to_header_values(xs::in(val), &exts);
1 0 av_to_header_values(xs::in(val), &exts);
74 1 0 ret->ws_extensions(exts);
77 1 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
1 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
1 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
1 0 if ((val = params.fetch("ws_protocol"))) ret->ws_protocol = xs::in(val);
84 51 0 if ((val = h.fetch("max_frame_size"))) cfg.max_frame_size = Simple(val);
5 46 if ((val = h.fetch("max_frame_size"))) cfg.max_frame_size = Simple(val);
5 0 if ((val = h.fetch("max_frame_size"))) cfg.max_frame_size = Simple(val);
5 0 if ((val = h.fetch("max_frame_size"))) cfg.max_frame_size = Simple(val);
85 51 0 if ((val = h.fetch("max_message_size"))) cfg.max_message_size = Simple(val);
9 42 if ((val = h.fetch("max_message_size"))) cfg.max_message_size = Simple(val);
9 0 if ((val = h.fetch("max_message_size"))) cfg.max_message_size = Simple(val);
9 0 if ((val = h.fetch("max_message_size"))) cfg.max_message_size = Simple(val);
86 51 0 if ((val = h.fetch("max_handshake_size"))) cfg.max_handshake_size = Simple(val);
2 49 if ((val = h.fetch("max_handshake_size"))) cfg.max_handshake_size = Simple(val);
2 0 if ((val = h.fetch("max_handshake_size"))) cfg.max_handshake_size = Simple(val);
2 0 if ((val = h.fetch("max_handshake_size"))) cfg.max_handshake_size = Simple(val);
87 51 0 if ((val = h.fetch("check_utf8"))) cfg.check_utf8 = val.is_true();
7 44 if ((val = h.fetch("check_utf8"))) cfg.check_utf8 = val.is_true();
7 0 if ((val = h.fetch("check_utf8"))) cfg.check_utf8 = val.is_true();
89 51 0 if(h.exists("deflate")) cfg.deflate.reset();
24 27 if(h.exists("deflate")) cfg.deflate.reset();
90 51 0 Hash deflate_settings = h.fetch("deflate");
51 0 Hash deflate_settings = h.fetch("deflate");
91 23 28 if (deflate_settings) {
92 23 0 auto dcfg = xs::in(deflate_settings);
99 23 0 if ((val = h.fetch("server_max_window_bits"))) cfg.server_max_window_bits = static_cast(Simple(val));
7 16 if ((val = h.fetch("server_max_window_bits"))) cfg.server_max_window_bits = static_cast(Simple(val));
7 0 if ((val = h.fetch("server_max_window_bits"))) cfg.server_max_window_bits = static_cast(Simple(val));
7 0 if ((val = h.fetch("server_max_window_bits"))) cfg.server_max_window_bits = static_cast(Simple(val));
100 23 0 if ((val = h.fetch("client_max_window_bits"))) cfg.client_max_window_bits = static_cast(Simple(val));
13 10 if ((val = h.fetch("client_max_window_bits"))) cfg.client_max_window_bits = static_cast(Simple(val));
13 0 if ((val = h.fetch("client_max_window_bits"))) cfg.client_max_window_bits = static_cast(Simple(val));
13 0 if ((val = h.fetch("client_max_window_bits"))) cfg.client_max_window_bits = static_cast(Simple(val));
101 23 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
5 18 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
5 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 5 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 5 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 5 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
5 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
5 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 5 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("client_no_context_takeover"))) cfg.client_no_context_takeover = SvTRUE(val);
102 23 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
4 19 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
4 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 4 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 4 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 4 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
4 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
4 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 4 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
0 0 if ((val = h.fetch("server_no_context_takeover"))) cfg.server_no_context_takeover = SvTRUE(val);
103 23 0 if ((val = h.fetch("mem_level"))) cfg.mem_level = Simple(val);
2 21 if ((val = h.fetch("mem_level"))) cfg.mem_level = Simple(val);
2 0 if ((val = h.fetch("mem_level"))) cfg.mem_level = Simple(val);
2 0 if ((val = h.fetch("mem_level"))) cfg.mem_level = Simple(val);
104 23 0 if ((val = h.fetch("compression_level"))) cfg.compression_level = Simple(val);
2 21 if ((val = h.fetch("compression_level"))) cfg.compression_level = Simple(val);
2 0 if ((val = h.fetch("compression_level"))) cfg.compression_level = Simple(val);
2 0 if ((val = h.fetch("compression_level"))) cfg.compression_level = Simple(val);
105 23 0 if ((val = h.fetch("strategy"))) cfg.strategy = Simple(val);
1 22 if ((val = h.fetch("strategy"))) cfg.strategy = Simple(val);
1 0 if ((val = h.fetch("strategy"))) cfg.strategy = Simple(val);
1 0 if ((val = h.fetch("strategy"))) cfg.strategy = Simple(val);
106 23 0 if ((val = h.fetch("compression_threshold"))) cfg.compression_threshold = Simple(val);
12 11 if ((val = h.fetch("compression_threshold"))) cfg.compression_threshold = Simple(val);
12 0 if ((val = h.fetch("compression_threshold"))) cfg.compression_threshold = Simple(val);
12 0 if ((val = h.fetch("compression_threshold"))) cfg.compression_threshold = Simple(val);
110 102 0 Hash settings = Hash::create();
111 102 0 settings.store("server_max_window_bits", Simple(cfg.server_max_window_bits));
102 0 settings.store("server_max_window_bits", Simple(cfg.server_max_window_bits));
112 102 0 settings.store("client_max_window_bits", Simple(cfg.client_max_window_bits));
102 0 settings.store("client_max_window_bits", Simple(cfg.client_max_window_bits));
113 102 0 settings.store("client_no_context_takeover", Simple(cfg.client_no_context_takeover));
102 0 settings.store("client_no_context_takeover", Simple(cfg.client_no_context_takeover));
114 102 0 settings.store("server_no_context_takeover", Simple(cfg.server_no_context_takeover));
102 0 settings.store("server_no_context_takeover", Simple(cfg.server_no_context_takeover));
115 102 0 settings.store("mem_level", Simple(cfg.mem_level));
102 0 settings.store("mem_level", Simple(cfg.mem_level));
116 102 0 settings.store("compression_level", Simple(cfg.compression_level));
102 0 settings.store("compression_level", Simple(cfg.compression_level));
117 102 0 settings.store("strategy", Simple(cfg.strategy));
102 0 settings.store("strategy", Simple(cfg.strategy));
118 102 0 settings.store("compression_threshold", Simple(cfg.compression_threshold));
102 0 settings.store("compression_threshold", Simple(cfg.compression_threshold));
119 102 0 return Ref::create(settings);