Branch Coverage

feersum_conn.xs
Criterion Covered Total %
branch 199 320 62.1


line true false branch
8 0 0 RETVAL = c->fd;
21 279 70 if (hdl == NULL) {
29 14 265 if (ix == 2)
47 2 90 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 92 if (unlikely(c->receiving <= RECEIVE_HEADERS))
58 9 83 if (!SvPOK(buf)) {
61 9 0 SvGROW(buf, len+1);
5 4 SvGROW(buf, len+1);
64 0 92 if (unlikely(SvREADONLY(buf)))
67 0 92 if (unlikely(len == 0))
71 89 3 if (likely(c->rbuf))
74 1 91 if (unlikely(offset < 0))
75 1 0 offset = (-offset >= c->received_cl) ? 0 : c->received_cl + offset;
78 0 92 if (unlikely(offset > (ssize_t)src_len))
81 9 83 if (unlikely(len + offset > src_len))
85 92 0 if (c->expected_cl > 0) {
88 3 89 if (remaining_body <= 0)
90 1 88 if ((ssize_t)len > remaining_body)
97 89 0 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
0 89 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
89 0 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
0 89 if (unlikely(!c->rbuf || src_len == 0 || offset >= c->received_cl)) {
99 0 0 if (c->receiving == RECEIVE_SHUTDOWN) {
108 76 13 if (likely(len == src_len && offset == 0)) {
76 0 if (likely(len == src_len && offset == 0)) {
111 74 2 if (likely(buf_len == 0)) {
123 9 4 SvGROW(buf, SvCUR(buf) + len);
1 8 SvGROW(buf, SvCUR(buf) + len);
125 11 2 if (likely(items == 3)) {
128 11 0 if (unlikely(SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf))) {
0 11 if (unlikely(SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf))) {
135 0 11 if (unlikely(len > cur_len)) len = cur_len;
148 0 74 if (unlikely(c->responding != RESPOND_STREAMING))
151 74 0 SV *body = (items == 2) ? ST(1) : &PL_sv_undef;
152 74 0 if (unlikely(!body || !SvOK(body)))
0 74 if (unlikely(!body || !SvOK(body)))
156 1 73 if (SvROK(body)) {
158 0 1 if (SvOK(refd) && SvPOK(refd)) {
0 0 if (SvOK(refd) && SvPOK(refd)) {
167 73 0 if (!h2_try_write_chunk(aTHX_ c, body)) {
168 45 28 if (c->use_chunked)
184 0 2 if (unlikely(c->responding != RESPOND_STREAMING))
192 0 2 if (h2_is_stream(c)) {
194 0 0 for (i=0; i<=amax; i++) {
196 0 0 if (likely(sv)) h2_try_write_chunk(aTHX_ c, sv);
201 2 0 if (c->use_chunked) {
202 10 2 for (i=0; i<=amax; i++) {
204 8 2 if (likely(sv)) add_chunk_sv_to_wbuf(c, sv);
208 0 0 for (i=0; i<=amax; i++) {
210 0 0 if (likely(sv)) add_sv_to_wbuf(c, sv);
223 0 11 if (h2_is_stream(c))
225 0 11 if (unlikely(c->responding != RESPOND_STREAMING))
233 0 11 if (SvIOK(fh)) {
237 11 0 else if (SvROK(fh) && SvTYPE(SvRV(fh)) == SVt_PVGV) {
11 0 else if (SvROK(fh) && SvTYPE(SvRV(fh)) == SVt_PVGV) {
240 11 0 if (io && IoIFP(io)) {
10 1 if (io && IoIFP(io)) {
244 0 0 else if (SvTYPE(fh) == SVt_PVGV) {
247 0 0 if (io && IoIFP(io)) {
0 0 if (io && IoIFP(io)) {
252 1 10 if (file_fd < 0)
257 0 10 if (fstat(file_fd, &st) < 0)
260 1 9 if (!S_ISREG(st.st_mode))
264 7 2 if (items >= 3 && SvOK(ST(2))) {
7 0 if (items >= 3 && SvOK(ST(2))) {
266 1 6 if (offset_iv < 0)
271 1 7 if (st.st_size == 0) {
274 1 6 if (offset >= st.st_size)
277 2 4 if (items >= 4 && SvOK(ST(3))) {
2 0 if (items >= 4 && SvOK(ST(3))) {
282 0 2 if (length_uv > (UV)((~(size_t)0) >> 1))
286 2 0 if (length > (size_t)(st.st_size - offset))
293 0 4 if (length == 0) {
302 0 4 CLOSE_SENDFILE_FD(c);
0 0 CLOSE_SENDFILE_FD(c);
305 0 4 if (c->sendfile_fd < 0)
325 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)))
330 0 7 if (unlikely(!c->rbuf)) {
334 1 6 else if (offset == 0) {
337 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)) {
340 0 2 if (offset > len)
344 2 0 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
0 2 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
353 4 0 else if (offset < 0 && whence == SEEK_END) {
2 2 else if (offset < 0 && whence == SEEK_END) {
357 0 2 if (offset == 0) {
360 1 1 else if (offset > 0) {
362 1 0 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
0 1 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
394 1 43 SvUVX(hdl_sv) = 0;
407 23 0 if (unlikely(ix < 1 || ix > 2))
0 23 if (unlikely(ix < 1 || ix > 2))
411 4 19 SV **cb_slot = is_read ? &c->poll_read_cb : &c->poll_write_cb;
413 11 12 if (*cb_slot != NULL) {
418 11 12 if (!SvOK(cb)) {
420 2 9 if (is_read) {
422 2 0 if (c->receiving == RECEIVE_STREAMING) {
428 12 0 else if (unlikely(!IsCodeRef(cb)))
0 12 else if (unlikely(!IsCodeRef(cb)))
433 2 10 if (is_read) {
437 2 0 if (c->receiving == RECEIVE_BODY || c->receiving == RECEIVE_SHUTDOWN) {
2 0 if (c->receiving == RECEIVE_BODY || c->receiving == RECEIVE_SHUTDOWN) {
441 2 0 if (c->rbuf && SvCUR(c->rbuf) > 0) {
2 0 if (c->rbuf && SvCUR(c->rbuf) > 0) {
457 2 1 RETVAL = feersum_conn_guard(aTHX_ c, (items==2) ? ST(1) : NULL);
467 0 1 mXPUSHi(cnt);
486 0 6 RETVAL = c->is_http11;
494 0 354 if (unlikely(!SvOK(body)))
509 7 0 if (IsArrayRef(psgi_response)) {
7 0 if (IsArrayRef(psgi_response)) {
514 3 4 if (len == 3) {
519 4 0 else if (len == 2) {
522 4 0 if (unlikely(!IsArrayRef(headers)))
0 4 if (unlikely(!IsArrayRef(headers)))
555 0 26 if (unlikely(!r))
570 0 2 if (unlikely(!r))
581 0 2 if (unlikely(!r))
592 0 25 if (unlikely(!r))
603 0 14 if (unlikely(!r))
631 1 2 RETVAL = c->proxy_tlvs ? SvREFCNT_inc(c->proxy_tlvs) : &PL_sv_undef;
639 0 0 RETVAL = c->trailers ? newRV_inc((SV*)c->trailers) : &PL_sv_undef;
649 5 3 if (c->cached_use_reverse_proxy && c->req)
5 0 if (c->cached_use_reverse_proxy && c->req)
651 5 3 RETVAL = fwd ? fwd : SvREFCNT_inc_simple_NN(feersum_env_addr(aTHX_ c));
662 6 5 if (!RETVAL) RETVAL = newSVpvs("http");
679 11 0 if (likely(c->expected_cl > 0)) {
692 0 6 if (unlikely(!r))
703 0 5 if (unlikely(!r))
712 6 4 RETVAL = c->fd;
729 0 2 mXPUSHi(cnt);
735 2 2 RETVAL = c->is_keepalive;
743 2 1 RETVAL = feersum_conn_guard(aTHX_ c, (items == 2) ? ST(1) : NULL);
763 9 580 if (unlikely(PL_phase == PERL_PHASE_DESTRUCT)) {
770 0 580 if (ev_is_active(&c->read_ev_io)) {
773 0 580 if (ev_is_active(&c->write_ev_io)) {
776 0 580 if (ev_is_active(&c->read_ev_timer)) {
779 0 580 if (ev_is_active(&c->header_ev_timer)) {
782 0 580 if (ev_is_active(&c->write_ev_timer)) {
786 498 82 if (likely(c->rbuf)) SvREFCNT_dec(c->rbuf);
787 0 580 if (c->trailers) SvREFCNT_dec((SV*)c->trailers);
788 3 577 if (c->proxy_tlvs) SvREFCNT_dec(c->proxy_tlvs);
790 0 580 if (c->wbuf_rinq) {
792 0 0 while ((m = (struct iomatrix *)rinq_shift(&c->wbuf_rinq)) != NULL) {
793 0 0 for (i=0; i < m->count; i++) {
794 0 0 if (m->sv[i]) SvREFCNT_dec(m->sv[i]);
796 0 0 IOMATRIX_FREE(m);
811 244 336 if (c->remote_addr) SvREFCNT_dec(c->remote_addr);
812 244 336 if (c->remote_port) SvREFCNT_dec(c->remote_port);
816 0 580 if (c->poll_write_cb) SvREFCNT_dec(c->poll_write_cb);
817 0 580 if (c->poll_read_cb) SvREFCNT_dec(c->poll_read_cb);
819 2 578 if (c->ext_guard) SvREFCNT_dec(c->ext_guard);
826 3 577 if (unlikely(server->shutting_down && server->active_conns <= 0)) {
1 2 if (unlikely(server->shutting_down && server->active_conns <= 0)) {
832 1 0 if (server->shutdown_cb_cv)