Branch Coverage

feersum_conn.xs
Criterion Covered Total %
branch 201 328 61.2


line true false branch
8 0 0 RETVAL = c->fd;
21 311 72 if (hdl == NULL) {
29 15 296 if (ix == 2)
47 2 97 if (unlikely(items == 4) && SvOK(ST(3)) && SvIOK(ST(3)))
2 0 if (unlikely(items == 4) && SvOK(ST(3)) && SvIOK(ST(3)))
2 0 if (unlikely(items == 4) && SvOK(ST(3)) && SvIOK(ST(3)))
55 0 99 if (unlikely(c->receiving <= RECEIVE_HEADERS))
58 9 90 if (!SvPOK(buf)) {
61 9 0 SvGROW(buf, len+1);
5 4 SvGROW(buf, len+1);
64 0 99 if (unlikely(SvREADONLY(buf)))
67 0 99 if (unlikely(len == 0))
71 96 3 if (likely(c->rbuf))
74 1 98 if (unlikely(offset < 0))
75 1 0 offset = (-offset >= c->received_cl) ? 0 : c->received_cl + offset;
78 0 99 if (unlikely(offset > (ssize_t)src_len))
81 9 90 if (unlikely(len + offset > src_len))
85 99 0 if (c->expected_cl > 0) {
88 3 96 if (remaining_body <= 0)
90 1 95 if ((ssize_t)len > remaining_body)
97 96 0 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
0 96 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
96 0 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
0 96 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
99 0 0 if (c->receiving == RECEIVE_SHUTDOWN) {
108 80 16 if (likely(len == src_len && offset == 0)) {
80 0 if (likely(len == src_len && offset == 0)) {
111 78 2 if (likely(buf_len == 0)) {
123 11 5 SvGROW(buf, SvCUR(buf) + len);
1 10 SvGROW(buf, SvCUR(buf) + len);
125 14 2 if (likely(items == 3)) {
128 14 0 if (unlikely(SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf))) {
0 14 if (unlikely(SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf))) {
135 0 14 if (unlikely(len > cur_len)) len = cur_len;
148 0 74 if (unlikely(c->responding != RESPOND_STREAMING))
153 0 74 if (unlikely(!c->auto_cl && !h2_is_stream(c)))
0 0 if (unlikely(!c->auto_cl && !h2_is_stream(c)))
156 74 0 SV *body = (items == 2) ? ST(1) : &PL_sv_undef;
157 74 0 if (unlikely(!body || !SvOK(body)))
0 74 if (unlikely(!body || !SvOK(body)))
161 1 73 if (SvROK(body)) {
163 0 1 if (SvOK(refd) && SvPOK(refd)) {
0 0 if (SvOK(refd) && SvPOK(refd)) {
172 73 0 if (!h2_try_write_chunk(aTHX_ c, body)) {
173 45 28 if (c->use_chunked)
189 0 2 if (unlikely(c->responding != RESPOND_STREAMING))
192 0 2 if (unlikely(!c->auto_cl && !h2_is_stream(c)))
0 0 if (unlikely(!c->auto_cl && !h2_is_stream(c)))
200 0 2 if (h2_is_stream(c)) {
202 0 0 for (i=0; i<=amax; i++) {
204 0 0 if (likely(sv)) h2_try_write_chunk(aTHX_ c, sv);
209 2 0 if (c->use_chunked) {
210 10 2 for (i=0; i<=amax; i++) {
212 8 2 if (likely(sv)) add_chunk_sv_to_wbuf(c, sv);
216 0 0 for (i=0; i<=amax; i++) {
218 0 0 if (likely(sv)) add_sv_to_wbuf(c, sv);
231 0 12 if (h2_is_stream(c))
233 0 12 if (unlikely(c->responding != RESPOND_STREAMING))
241 0 12 if (SvIOK(fh)) {
245 12 0 else if (SvROK(fh) && SvTYPE(SvRV(fh)) == SVt_PVGV) {
12 0 else if (SvROK(fh) && SvTYPE(SvRV(fh)) == SVt_PVGV) {
248 12 0 if (io && IoIFP(io)) {
11 1 if (io && IoIFP(io)) {
252 0 0 else if (SvTYPE(fh) == SVt_PVGV) {
255 0 0 if (io && IoIFP(io)) {
0 0 if (io && IoIFP(io)) {
260 1 11 if (file_fd < 0)
265 0 11 if (fstat(file_fd, &st) < 0)
268 1 10 if (!S_ISREG(st.st_mode))
272 7 3 if (items >= 3 && SvOK(ST(2))) {
7 0 if (items >= 3 && SvOK(ST(2))) {
274 1 6 if (offset_iv < 0)
279 1 8 if (st.st_size == 0) {
282 1 7 if (offset >= st.st_size)
285 2 5 if (items >= 4 && SvOK(ST(3))) {
2 0 if (items >= 4 && SvOK(ST(3))) {
290 0 2 if (length_uv > (UV)((~(size_t)0) >> 1))
294 2 0 if (length > (size_t)(st.st_size - offset))
301 0 5 if (length == 0) {
310 0 5 CLOSE_SENDFILE_FD(c);
0 0 CLOSE_SENDFILE_FD(c);
313 0 5 if (c->sendfile_fd < 0)
333 7 0 if (items == 3 && SvOK(ST(2)) && SvIOK(ST(2)))
7 0 if (items == 3 && SvOK(ST(2)) && SvIOK(ST(2)))
7 0 if (items == 3 && SvOK(ST(2)) && SvIOK(ST(2)))
338 0 7 if (unlikely(!c->rbuf)) {
342 1 6 else if (offset == 0) {
345 2 4 else if (offset > 0 && (whence == SEEK_CUR || whence == SEEK_SET)) {
1 1 else if (offset > 0 && (whence == SEEK_CUR || whence == SEEK_SET)) {
1 0 else if (offset > 0 && (whence == SEEK_CUR || whence == SEEK_SET)) {
348 0 2 if (offset > len)
352 2 0 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
0 2 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
361 4 0 else if (offset < 0 && whence == SEEK_END) {
2 2 else if (offset < 0 && whence == SEEK_END) {
365 0 2 if (offset == 0) {
368 1 1 else if (offset > 0) {
370 1 0 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
0 1 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
402 1 45 SvUVX(hdl_sv) = 0;
415 23 0 if (unlikely(ix < 1 || ix > 2))
0 23 if (unlikely(ix < 1 || ix > 2))
419 4 19 SV **cb_slot = is_read ? &c->poll_read_cb : &c->poll_write_cb;
421 11 12 if (*cb_slot != NULL) {
426 11 12 if (!SvOK(cb)) {
428 2 9 if (is_read) {
430 2 0 if (c->receiving == RECEIVE_STREAMING) {
436 12 0 else if (unlikely(!IsCodeRef(cb)))
0 12 else if (unlikely(!IsCodeRef(cb)))
441 2 10 if (is_read) {
445 2 0 if (c->receiving == RECEIVE_BODY || c->receiving == RECEIVE_SHUTDOWN) {
2 0 if (c->receiving == RECEIVE_BODY || c->receiving == RECEIVE_SHUTDOWN) {
449 2 0 if (c->rbuf && SvCUR(c->rbuf) > 0) {
2 0 if (c->rbuf && SvCUR(c->rbuf) > 0) {
465 2 1 RETVAL = feersum_conn_guard(aTHX_ c, (items==2) ? ST(1) : NULL);
475 0 1 mXPUSHi(cnt);
494 0 6 RETVAL = c->is_http11;
502 0 383 if (unlikely(!SvOK(body)))
517 7 0 if (IsArrayRef(psgi_response)) {
7 0 if (IsArrayRef(psgi_response)) {
522 3 4 if (len == 3) {
527 4 0 else if (len == 2) {
530 4 0 if (unlikely(!IsArrayRef(headers)))
0 4 if (unlikely(!IsArrayRef(headers)))
563 0 28 if (unlikely(!r))
578 0 2 if (unlikely(!r))
589 0 2 if (unlikely(!r))
600 0 27 if (unlikely(!r))
611 0 14 if (unlikely(!r))
639 1 2 RETVAL = c->proxy_tlvs ? SvREFCNT_inc(c->proxy_tlvs) : &PL_sv_undef;
647 0 0 RETVAL = c->trailers ? newRV_inc((SV*)c->trailers) : &PL_sv_undef;
657 5 3 if (c->cached_use_reverse_proxy && c->req)
5 0 if (c->cached_use_reverse_proxy && c->req)
659 5 3 RETVAL = fwd ? fwd : SvREFCNT_inc_simple_NN(feersum_env_addr(aTHX_ c));
670 6 5 if (!RETVAL) RETVAL = newSVpvs("http");
687 11 0 if (likely(c->expected_cl > 0)) {
700 0 7 if (unlikely(!r))
711 0 10 if (unlikely(!r))
720 6 4 RETVAL = c->fd;
737 0 2 mXPUSHi(cnt);
743 2 2 RETVAL = c->is_keepalive;
751 2 1 RETVAL = feersum_conn_guard(aTHX_ c, (items == 2) ? ST(1) : NULL);
771 11 625 if (unlikely(PL_phase == PERL_PHASE_DESTRUCT)) {
778 0 625 if (ev_is_active(&c->read_ev_io)) {
781 0 625 if (ev_is_active(&c->write_ev_io)) {
784 0 625 if (ev_is_active(&c->read_ev_timer)) {
787 0 625 if (ev_is_active(&c->header_ev_timer)) {
790 0 625 if (ev_is_active(&c->write_ev_timer)) {
794 542 83 if (likely(c->rbuf)) SvREFCNT_dec(c->rbuf);
795 0 625 if (c->trailers) SvREFCNT_dec((SV*)c->trailers);
796 3 622 if (c->proxy_tlvs) SvREFCNT_dec(c->proxy_tlvs);
798 0 625 if (c->wbuf_rinq) {
800 0 0 while ((m = (struct iomatrix *)rinq_shift(&c->wbuf_rinq)) != NULL) {
801 0 0 for (i=0; i < m->count; i++) {
802 0 0 if (m->sv[i]) SvREFCNT_dec(m->sv[i]);
804 0 0 IOMATRIX_FREE(m);
819 268 357 if (c->remote_addr) SvREFCNT_dec(c->remote_addr);
820 268 357 if (c->remote_port) SvREFCNT_dec(c->remote_port);
824 0 625 if (c->poll_write_cb) SvREFCNT_dec(c->poll_write_cb);
825 0 625 if (c->poll_read_cb) SvREFCNT_dec(c->poll_read_cb);
827 2 623 if (c->ext_guard) SvREFCNT_dec(c->ext_guard);
834 3 622 if (unlikely(server->shutting_down && server->active_conns <= 0)) {
1 2 if (unlikely(server->shutting_down && server->active_conns <= 0)) {
840 1 0 if (server->shutdown_cb_cv)