| line |
true |
false |
branch |
|
7
|
0 |
178 |
if (elt == NULL) return NULL; |
|
9
|
4 |
174 |
if (unlikely(SvMAGICAL(sv))) sv = sv_2mortal(newSVsv(sv)); |
|
10
|
3 |
175 |
if (unlikely(!SvOK(sv))) return NULL; |
|
12
|
6 |
169 |
if (unlikely(SvROK(sv))) sv = SvRV(sv); |
|
23
|
723 |
240 |
if (!c->wbuf_rinq) { |
|
32
|
0 |
240 |
if (m->count >= FEERSUM_IOMATRIX_SIZE) { |
|
37
|
723 |
240 |
if (add_iomatrix) { |
|
39
|
638 |
85 |
IOMATRIX_ALLOC(m); |
|
56
|
1 |
309 |
if (unlikely(SvMAGICAL(sv))) { |
|
59
|
0 |
309 |
else if (unlikely(SvPADTMP(sv))) { |
|
64
|
0 |
0 |
if (SvFLAGS(sv) == (SVs_PADTMP|SVf_POK|SVp_POK)) { |
|
74
|
0 |
0 |
(void)SvOK_off(sv); |
|
131
|
18 |
40 |
if (!c->use_chunked) return; // nothing required unless chunked encoding |
|
151
|
0 |
59 |
if (unlikely(len == 0)) return; /* skip: "0\r\n\r\n" is the terminal chunk */ |
|
227
|
0 |
0 |
if (100 <= code && code <= 199) { |
|
|
0 |
0 |
if (100 <= code && code <= 199) { |
|
230
|
0 |
0 |
else if (200 <= code && code <= 299) { |
|
|
0 |
0 |
else if (200 <= code && code <= 299) { |
|
233
|
0 |
0 |
else if (300 <= code && code <= 399) { |
|
|
0 |
0 |
else if (300 <= code && code <= 399) { |
|
236
|
0 |
0 |
else if (400 <= code && code <= 499) { |
|
|
0 |
0 |
else if (400 <= code && code <= 499) { |
|
259
|
599 |
0 |
if (likely(is_tcp)) { |
|
260
|
0 |
599 |
if (unlikely(setsockopt(fd, SOL_TCP, TCP_NODELAY, &flags, sizeof(int)))) |
|
278
|
6 |
0 |
if (likely(c->cached_is_tcp)) { |
|
294
|
0 |
6 |
PUSHMARK(SP); |
|
299
|
6 |
0 |
if (SvTRUE(ERRSV)) |
|
|
1 |
5 |
if (SvTRUE(ERRSV)) |
|
300
|
1 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
302
|
0 |
6 |
FREETMPS; |
|
309
|
551 |
599 |
if (unlikely(c->fd < 0)) |
|
321
|
0 |
599 |
CLOSE_SENDFILE_FD(c); |
|
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
325
|
59 |
540 |
if (c->tls && c->tls_handshake_done) { |
|
|
42 |
17 |
if (c->tls && c->tls_handshake_done) { |
|
329
|
42 |
0 |
if (closebuf.off > 0) { |
|
341
|
0 |
599 |
if (unlikely(close(c->fd) < 0)) |
|
352
|
599 |
0 |
SvUPGRADE(self, SVt_PVMG); // ensures sv_bless doesn't reallocate |
|
353
|
599 |
0 |
SvGROW(self, sizeof(struct feer_conn)); |
|
|
599 |
0 |
SvGROW(self, sizeof(struct feer_conn)); |
|
380
|
154 |
445 |
c->receiving = srvr->use_proxy_protocol ? RECEIVE_PROXY_HEADER : RECEIVE_HEADERS; |
|
384
|
59 |
540 |
if (lsnr->tls_ctx_ref) { |
|
435
|
0 |
1396 |
if (unlikely(!sv_isa(rv,"Feersum::Connection"))) |
|
451
|
0 |
630 |
if (unlikely(!SvROK(rv))) croak("Expected a reference"); |
|
454
|
630 |
0 |
if (likely( |
|
|
390 |
240 |
if (likely( |
|
|
390 |
0 |
if (likely( |
|
|
630 |
0 |
if (likely( |
|
460
|
85 |
545 |
if (uv == 0) { |
|
461
|
15 |
70 |
if (can_croak) croak("Operation not allowed: Handle is closed."); |
|
467
|
0 |
0 |
if (can_croak) |
|
478
|
77 |
280 |
sv_bless(sv, is_writer ? feer_conn_writer_stash : feer_conn_reader_stash); |
|
496
|
2976 |
186 |
for (i = 0; i < FEER_MAX_LISTENERS; i++) { |
|
509
|
186 |
0 |
SvUPGRADE(self, SVt_PVMG); |
|
510
|
186 |
0 |
SvGROW(self, sizeof(struct feer_server)); |
|
|
186 |
0 |
SvGROW(self, sizeof(struct feer_server)); |
|
531
|
27232 |
33 |
if (sv_isa(rv, "Feersum")) { |
|
535
|
33 |
0 |
if (SvPOK(rv) && strEQ(SvPV_nolen(rv), "Feersum")) { |
|
|
33 |
0 |
if (SvPOK(rv) && strEQ(SvPV_nolen(rv), "Feersum")) { |
|
536
|
0 |
33 |
if (unlikely(!default_server)) |
|
554
|
12 |
122 |
if (unlikely(ev_is_active(&c->read_ev_io))) |
|
563
|
805 |
113 |
if (unlikely(!ev_is_active(&c->read_ev_io))) |
|
572
|
103 |
21 |
if (likely(!ev_is_active(&c->read_ev_timer))) { |
|
582
|
822 |
99 |
if (unlikely(!ev_is_active(&c->read_ev_timer))) |
|
592
|
120 |
477 |
if (unlikely(ev_is_active(&c->write_ev_io))) |
|
601
|
270 |
477 |
if (unlikely(!ev_is_active(&c->write_ev_io))) |
|
610
|
719 |
1 |
if (c->cached_write_timeout <= 0.0) return; |
|
611
|
1 |
0 |
if (likely(!ev_is_active(&c->write_ev_timer))) { |
|
621
|
761 |
1 |
if (unlikely(!ev_is_active(&c->write_ev_timer))) |
|
630
|
886 |
714 |
if (unlikely(!ev_is_active(&c->header_ev_timer))) |
|
640
|
0 |
133 |
if (timeout <= 0.0) return; |
|
659
|
27 |
1573 |
if (c->idle_rinq_node) { |
|
668
|
0 |
29 |
if (c->idle_rinq_node) return; // already idle |
|
671
|
29 |
0 |
RINQ_NEW(node, c); |
|
|
0 |
0 |
RINQ_NEW(node, c); |
|
674
|
24 |
5 |
if (*head == NULL) { |
|
688
|
7 |
2 |
if (!srvr->idle_keepalive_rinq) return 0; |
|
691
|
0 |
2 |
if (unlikely(!c)) return 0; |
|
715
|
493 |
334 |
while (server->request_ready_rinq) { |
|
718
|
0 |
493 |
if (unlikely(!c)) break; |
|
722
|
471 |
22 |
if (likely(c->wbuf_rinq)) { |
|
750
|
0 |
140 |
if (unlikely(revents & EV_ERROR)) { |
|
756
|
140 |
0 |
if (!srvr->shutting_down) { |
|
757
|
221 |
140 |
for (i = 0; i < srvr->n_listeners; i++) { |
|
759
|
148 |
73 |
if (!ev_is_active(&lsnr->accept_w) && !lsnr->paused) { |
|
|
148 |
0 |
if (!ev_is_active(&lsnr->accept_w) && !lsnr->paused) { |
|
772
|
0 |
4567 |
if (unlikely(revents & EV_ERROR)) { |
|
779
|
334 |
4233 |
if (server->request_ready_rinq) |
|
789
|
0 |
331 |
if (unlikely(revents & EV_ERROR)) { |
|
795
|
0 |
331 |
if (server->request_ready_rinq) |
|
813
|
132 |
531 |
if (c->is_keepalive && c->expected_cl > 0 && c->rbuf) { |
|
|
12 |
120 |
if (c->is_keepalive && c->expected_cl > 0 && c->rbuf) { |
|
|
9 |
3 |
if (c->is_keepalive && c->expected_cl > 0 && c->rbuf) { |
|
815
|
2 |
7 |
if (consumed < c->expected_cl) { |
|
822
|
130 |
533 |
if (c->is_keepalive) { |
|
826
|
127 |
3 |
if (c->rbuf) { pipelined = SvCUR(c->rbuf); } |
|
827
|
130 |
0 |
if (likely(c->req)) { |
|
828
|
29 |
101 |
if (likely(pipelined == 0) && c->req->buf && c->rbuf) { |
|
|
29 |
0 |
if (likely(pipelined == 0) && c->req->buf && c->rbuf) { |
|
|
26 |
3 |
if (likely(pipelined == 0) && c->req->buf && c->rbuf) { |
|
834
|
104 |
0 |
} else if (c->req->buf) { |
|
840
|
101 |
29 |
if (unlikely(pipelined > 0 && c->is_http11)) { |
|
|
101 |
0 |
if (unlikely(pipelined > 0 && c->is_http11)) { |
|
842
|
101 |
0 |
if (c->pipeline_depth <= MAX_PIPELINE_DEPTH) { |
|
862
|
0 |
533 |
if (c->responding != RESPOND_SHUTDOWN) |
|
879
|
0 |
666 |
if (unlikely(revents & EV_ERROR && !(revents & EV_WRITE))) { |
|
|
0 |
0 |
if (unlikely(revents & EV_ERROR && !(revents & EV_WRITE))) { |
|
885
|
23 |
643 |
if (unlikely(!c->wbuf_rinq)) { |
|
886
|
3 |
20 |
if (unlikely(c->responding >= RESPOND_SHUTDOWN)) |
|
891
|
0 |
20 |
if (c->sendfile_fd >= 0) |
|
895
|
0 |
20 |
if (!c->poll_write_cb) { |
|
897
|
0 |
0 |
if (c->responding == RESPOND_STREAMING) |
|
905
|
11 |
9 |
if (c->poll_write_cb_is_io_handle) |
|
911
|
0 |
20 |
if (unlikely(!c->wbuf_rinq)) goto try_write_again; |
|
914
|
642 |
1 |
else if (c->cached_wbuf_low_water > 0 |
|
915
|
0 |
1 |
&& c->wbuf_len <= c->cached_wbuf_low_water |
|
916
|
0 |
1 |
&& c->responding == RESPOND_STREAMING && c->poll_write_cb) { |
|
|
0 |
1 |
&& c->responding == RESPOND_STREAMING && c->poll_write_cb) { |
|
917
|
0 |
1 |
if (c->poll_write_cb_is_io_handle) |
|
926
|
3 |
660 |
if (c->sendfile_fd >= 0) |
|
942
|
587 |
76 |
if (iov_count == 1) { |
|
950
|
0 |
663 |
if (unlikely(wrote <= 0)) { |
|
951
|
0 |
0 |
if (likely(errno == EAGAIN || errno == EINTR)) |
|
|
0 |
0 |
if (likely(errno == EAGAIN || errno == EINTR)) |
|
954
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
965
|
901 |
663 |
for (i = m->offset; i < m->count && consume; i++) { |
|
|
901 |
0 |
for (i = m->offset; i < m->count && consume; i++) { |
|
967
|
0 |
901 |
if (unlikely(v->iov_len > wrote)) { |
|
980
|
799 |
102 |
if (m->sv[i]) { |
|
987
|
663 |
0 |
if (likely(m->offset >= m->count)) { |
|
990
|
663 |
0 |
IOMATRIX_FREE(m); |
|
991
|
663 |
0 |
if (!c->wbuf_rinq) { |
|
994
|
3 |
660 |
if (c->sendfile_fd >= 0) |
|
1000
|
0 |
0 |
if (c->cached_wbuf_low_water > 0 |
|
1001
|
0 |
0 |
&& c->wbuf_len <= c->cached_wbuf_low_water |
|
1002
|
0 |
0 |
&& c->responding == RESPOND_STREAMING && c->poll_write_cb) { |
|
|
0 |
0 |
&& c->responding == RESPOND_STREAMING && c->poll_write_cb) { |
|
1019
|
3 |
0 |
if (sent > 0) { |
|
1022
|
3 |
0 |
if (c->sendfile_remain == 0) { |
|
1023
|
3 |
0 |
CLOSE_SENDFILE_FD(c); |
|
|
0 |
3 |
CLOSE_SENDFILE_FD(c); |
|
1031
|
0 |
0 |
else if (sent == 0) { |
|
1033
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
1035
|
0 |
0 |
if (c->responding == RESPOND_STREAMING) { |
|
1042
|
0 |
0 |
if (errno == EAGAIN || errno == EINTR) { |
|
|
0 |
0 |
if (errno == EAGAIN || errno == EINTR) { |
|
1048
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
|
0 |
0 |
CLOSE_SENDFILE_FD(c); |
|
1072
|
14 |
36 |
if (c->poll_write_cb) goto try_write_again; |
|
1104
|
21 |
130 |
if (len < 8) |
|
1108
|
0 |
130 |
if (memcmp(buf, PROXY_V1_PREFIX, PROXY_V1_PREFIX_LEN) != 0) |
|
1115
|
2846 |
103 |
for (i = PROXY_V1_PREFIX_LEN; i < search_len - 1; i++) { |
|
1116
|
27 |
2819 |
if (buf[i] == '\r' && buf[i+1] == '\n') { |
|
|
27 |
0 |
if (buf[i] == '\r' && buf[i+1] == '\n') { |
|
1122
|
103 |
27 |
if (!crlf) { |
|
1123
|
1 |
102 |
if (len >= PROXY_V1_MAX_LINE) |
|
1137
|
1 |
26 |
if (strncmp(p, "UNKNOWN", 7) == 0 && (p[7] == '\0' || p[7] == ' ')) { |
|
|
0 |
1 |
if (strncmp(p, "UNKNOWN", 7) == 0 && (p[7] == '\0' || p[7] == ' ')) { |
|
|
0 |
0 |
if (strncmp(p, "UNKNOWN", 7) == 0 && (p[7] == '\0' || p[7] == ' ')) { |
|
1146
|
23 |
3 |
if (strncmp(p, "TCP4 ", 5) == 0) { |
|
1148
|
2 |
1 |
} else if (strncmp(p, "TCP6 ", 5) == 0) { |
|
1161
|
0 |
25 |
if (sscanf(p, "%45s %45s %d %d", src_addr, dst_addr, &src_port, &dst_port) != 4) { |
|
1167
|
25 |
0 |
if (src_port < 0 || src_port > 65535 || dst_port < 0 || dst_port > 65535) { |
|
|
24 |
1 |
if (src_port < 0 || src_port > 65535 || dst_port < 0 || dst_port > 65535) { |
|
|
24 |
0 |
if (src_port < 0 || src_port > 65535 || dst_port < 0 || dst_port > 65535) { |
|
|
0 |
24 |
if (src_port < 0 || src_port > 65535 || dst_port < 0 || dst_port > 65535) { |
|
1175
|
2 |
22 |
if (is_ipv6) { |
|
1178
|
0 |
2 |
if (inet_pton(AF_INET6, src_addr, &sa6->sin6_addr) != 1) { |
|
1185
|
1 |
21 |
if (inet_pton(AF_INET, src_addr, &sa4->sin_addr) != 1) { |
|
1206
|
3 |
102 |
if (len < PROXY_V2_HDR_MIN) |
|
1210
|
21 |
81 |
if (memcmp(buf, PROXY_V2_SIG, PROXY_V2_SIG_LEN) != 0) |
|
1218
|
39 |
42 |
if (version != PROXY_V2_VERSION) |
|
1227
|
2 |
40 |
if (unlikely(addr_len > 4096)) { /* spec allows 65535, cap for sanity */ |
|
1234
|
5 |
35 |
if (len < total_len) |
|
1238
|
1 |
34 |
if (command == PROXY_V2_CMD_LOCAL) { |
|
1245
|
0 |
34 |
if (command != PROXY_V2_CMD_PROXY) { |
|
1252
|
32 |
2 |
if (family == PROXY_V2_FAM_INET) { |
|
1254
|
0 |
32 |
if (addr_len < PROXY_V2_ADDR_V4_LEN) |
|
1270
|
1 |
1 |
} else if (family == PROXY_V2_FAM_INET6) { |
|
1272
|
0 |
1 |
if (addr_len < PROXY_V2_ADDR_V6_LEN) |
|
1286
|
0 |
1 |
} else if (family == PROXY_V2_FAM_UNSPEC) { |
|
1295
|
32 |
2 |
if (family == PROXY_V2_FAM_INET) addr_size = PROXY_V2_ADDR_V4_LEN; |
|
1296
|
1 |
1 |
else if (family == PROXY_V2_FAM_INET6) addr_size = PROXY_V2_ADDR_V6_LEN; |
|
1298
|
14 |
20 |
if (addr_len > addr_size) { |
|
1307
|
15 |
3 |
while (tlv_remaining >= 3) { // minimum TLV: 1 type + 2 length |
|
1311
|
11 |
4 |
if (tlv_remaining < 3 + (size_t)tlv_len) { |
|
1321
|
2 |
2 |
if (tlv_type == PP2_TYPE_SSL && tlv_len >= 5) { |
|
|
2 |
0 |
if (tlv_type == PP2_TYPE_SSL && tlv_len >= 5) { |
|
1327
|
4 |
0 |
if (tlv_type != PP2_TYPE_NOOP) { |
|
1340
|
0 |
3 |
if (HvKEYS(tlv_hv) > 0) { |
|
|
3 |
0 |
if (HvKEYS(tlv_hv) > 0) { |
|
1356
|
0 |
283 |
if (SvCUR(c->rbuf) == 0) |
|
1361
|
151 |
132 |
if (first == 'P') { |
|
1363
|
105 |
27 |
} else if (first == 0x0D) { |