Branch Coverage

feersum_conn.xs
Criterion Covered Total %
branch 203 328 61.8


line true false branch
8 0 0 RETVAL = c->fd;
21 316 72 if (hdl == NULL) {
29 15 301 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)))
199 0 2 if (h2_is_stream(c)) {
201 0 0 for (I32 i = 0; i <= amax; i++) {
203 0 0 if (likely(sv)) h2_try_write_chunk(aTHX_ c, sv);
208 2 0 if (c->use_chunked) {
209 10 2 for (I32 i = 0; i <= amax; i++) {
211 8 2 if (likely(sv)) add_chunk_sv_to_wbuf(c, sv);
215 0 0 for (I32 i = 0; i <= amax; i++) {
217 0 0 if (likely(sv)) add_sv_to_wbuf(c, sv);
230 0 12 if (h2_is_stream(c))
232 0 12 if (unlikely(c->responding != RESPOND_STREAMING))
240 0 12 if (SvIOK(fh)) {
244 12 0 else if (SvROK(fh) && SvTYPE(SvRV(fh)) == SVt_PVGV) {
12 0 else if (SvROK(fh) && SvTYPE(SvRV(fh)) == SVt_PVGV) {
247 12 0 if (io && IoIFP(io)) {
11 1 if (io && IoIFP(io)) {
251 0 0 else if (SvTYPE(fh) == SVt_PVGV) {
254 0 0 if (io && IoIFP(io)) {
0 0 if (io && IoIFP(io)) {
259 1 11 if (file_fd < 0)
264 0 11 if (fstat(file_fd, &st) < 0)
267 1 10 if (!S_ISREG(st.st_mode))
271 7 3 if (items >= 3 && SvOK(ST(2))) {
7 0 if (items >= 3 && SvOK(ST(2))) {
273 1 6 if (offset_iv < 0)
278 1 8 if (st.st_size == 0) {
281 1 7 if (offset >= st.st_size)
284 2 5 if (items >= 4 && SvOK(ST(3))) {
2 0 if (items >= 4 && SvOK(ST(3))) {
289 0 2 if (length_uv > (UV)((~(size_t)0) >> 1))
293 2 0 if (length > (size_t)(st.st_size - offset))
299 0 5 if (length == 0)
306 0 5 CLOSE_SENDFILE_FD(c);
0 0 CLOSE_SENDFILE_FD(c);
309 0 5 if (c->sendfile_fd < 0)
329 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)))
334 0 7 if (unlikely(!c->rbuf)) {
338 1 6 else if (offset == 0) {
341 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)) {
344 0 2 if (offset > len)
348 2 0 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
0 2 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
357 4 0 else if (offset < 0 && whence == SEEK_END) {
2 2 else if (offset < 0 && whence == SEEK_END) {
361 0 2 if (offset == 0) {
364 1 1 else if (offset > 0) {
366 1 0 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
0 1 if (SvREFCNT(c->rbuf) > 1 || SvREADONLY(c->rbuf)) {
398 1 45 SvUVX(hdl_sv) = 0;
411 23 0 if (unlikely(ix < 1 || ix > 2))
0 23 if (unlikely(ix < 1 || ix > 2))
415 4 19 SV **cb_slot = is_read ? &c->poll_read_cb : &c->poll_write_cb;
417 11 12 if (*cb_slot != NULL) {
422 11 12 if (!SvOK(cb)) {
424 2 9 if (is_read && c->receiving == RECEIVE_STREAMING)
2 0 if (is_read && 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 394 if (unlikely(!SvOK(body)))
509 8 0 if (IsArrayRef(psgi_response)) {
8 0 if (IsArrayRef(psgi_response)) {
514 3 5 if (len == 3) {
519 5 0 else if (len == 2) {
522 5 0 if (unlikely(!IsArrayRef(headers)))
0 5 if (unlikely(!IsArrayRef(headers)))
555 0 28 if (unlikely(!r))
570 0 2 if (unlikely(!r))
581 0 2 if (unlikely(!r))
592 0 27 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");
671 13 5 RETVAL = c->expected_cl;
679 11 0 if (likely(c->expected_cl > 0)) {
692 0 7 if (unlikely(!r))
703 0 10 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 11 645 if (unlikely(PL_phase == PERL_PHASE_DESTRUCT)) {
770 0 645 if (ev_is_active(&c->read_ev_io)) {
773 0 645 if (ev_is_active(&c->write_ev_io)) {
776 0 645 if (ev_is_active(&c->read_ev_timer)) {
779 0 645 if (ev_is_active(&c->header_ev_timer)) {
782 0 645 if (ev_is_active(&c->write_ev_timer)) {
791 0 645 if (c->wbuf_rinq) {
793 0 0 while ((m = (struct iomatrix *)rinq_shift(&c->wbuf_rinq)) != NULL) {
794 0 0 for (i=0; i < m->count; i++)
796 0 0 IOMATRIX_FREE(m);
828 644 1 if (unlikely(server->max_connections > 0
644 0 if (unlikely(server->max_connections > 0
644 1 if (unlikely(server->max_connections > 0
641 3 if (unlikely(server->max_connections > 0
832 856 641 for (i = 0; i < server->n_listeners; i++) {
834 1 855 if (lsnr->pause_flags & FEER_PAUSE_CAP) {
836 1 0 if (!lsnr->pause_flags && lsnr->fd >= 0)
1 0 if (!lsnr->pause_flags && lsnr->fd >= 0)
842 3 642 if (unlikely(server->shutting_down && server->active_conns <= 0)) {
1 2 if (unlikely(server->shutting_down && server->active_conns <= 0)) {
848 1 0 if (server->shutdown_cb_cv)