Branch Coverage

lib/Plack/Handler/Gazelle.xs
Criterion Covered Total %
branch 217 342 63.4


line true false branch
143 0 0 if (100 <= code && code <= 199) {
146 0 0 else if (200 <= code && code <= 299) {
149 0 0 else if (300 <= code && code <= 399) {
152 0 0 else if (400 <= code && code <= 499) {
165 797 148 for (i = 0; i != len; ++i, ++s)
488 127 for (i = 0; i != len; ++i, ++s)
166 795 2 if (*s == ch)
465 23 if (*s == ch)
176 86 309 if (header->name_len != len)
11 372 if (header->name_len != len)
178 218 12 for (x = header->name, y = name; len != 0; --len, ++x, ++y)
154 11 for (x = header->name, y = name; len != 0; --len, ++x, ++y)
179 108 110 if (TOU(*x) != *y)
144 74 if (TOU(*x) != *y)
121 33 if (TOU(*x) != *y)
154 0 if (TOU(*x) != *y)
194 150 0 (void)SvUPGRADE(dst, SVt_PV);
195 150 0 d = SvGROW(dst, src_len * 3 + 1);
150 0 d = SvGROW(dst, src_len * 3 + 1);
197 429 148 for (i = 0; i < src_len; i++ ) {
198 18 411 if ( src[i] == '%' ) {
199 18 0 if ( !isxdigit(src[i+1]) || !isxdigit(src[i+2]) ) {
16 2 if ( !isxdigit(src[i+1]) || !isxdigit(src[i+2]) ) {
204 2 14 s2 -= s2 <= '9' ? '0'
0 2 s2 -= s2 <= '9' ? '0'
207 2 14 s3 -= s3 <= '9' ? '0'
2 0 s3 -= s3 <= '9' ? '0'
248 150 1 if (ret < 0)
250 150 0 if (minor_version > 1 || minor_version < 0 ) {
265 2 148 if ( store_path_info(aTHX_ env, path, question_at) < 0 ) {
270 23 125 if (question_at != path_len) ++question_at;
274 397 147 for (i = 0; i < num_headers; ++i) {
275 395 2 if (headers[i].name != NULL) {
279 383 12 if (header_is(headers + i, "CONTENT-TYPE", sizeof("CONTENT-TYPE") - 1)) {
282 372 11 } else if (header_is(headers + i, "CONTENT-LENGTH", sizeof("CONTENT-LENGTH") - 1)) {
289 1 371 if (sizeof(tmp) - 5 < headers[i].name_len) {
295 3962 371 for (s = headers[i].name, n = headers[i].name_len, d = tmp + 5;
298 3672 290 *d = *s == '-' ? '_' : TOU(*s);
3012 660 *d = *s == '-' ? '_' : TOU(*s);
304 0 394 if ( !slot ) croak("ERROR: failed to create hash entry");
305 390 4 if (SvOK(*slot)) {
390 0 if (SvOK(*slot)) {
0 390 if (SvOK(*slot)) {
326 498 0 if (SvGAMAGIC(sv))
0 498 if (SvGAMAGIC(sv))
0 0 if (SvGAMAGIC(sv))
0 0 if (SvGAMAGIC(sv))
328 429 69 return SvPV(sv, *lp);
341 168 451 if (fd < 0) {
358 157 0 if ( do_select == 1) goto WAIT_WRITE;
361 157 0 if ( rv >= 0 ) {
364 0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
372 0 0 if ( nfound == 1 ) {
375 0 0 if ( nfound == 0 && errno != EINTR ) {
0 0 if ( nfound == 0 && errno != EINTR ) {
392 200 6 if ( rv >= 0 ) {
395 6 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
6 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 6 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
401 6 0 if ( nfound == 1 ) {
404 0 0 if ( nfound == 0 && errno != EINTR ) {
0 0 if ( nfound == 0 && errno != EINTR ) {
419 21 0 if ( rv >= 0 ) {
422 0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
0 0 if ( rv < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK ) {
430 0 0 if ( nfound == 1 ) {
433 0 0 if ( nfound == 0 && errno != EINTR ) {
0 0 if ( nfound == 0 && errno != EINTR ) {
445 364 146 for ( i=0; i
8 1 for ( i=0; i
435 145 for ( i=0; i
435 145 for ( i=0; i
460 292 146 } while( dlen >= *dst_len );
2 1 } while( dlen >= *dst_len );
145 145 } while( dlen >= *dst_len );
435 145 } while( dlen >= *dst_len );
145 145 } while( dlen >= *dst_len );
145 145 } while( dlen >= *dst_len );
145 145 } while( dlen >= *dst_len );
505 117 96 while ( l > 0 ) {
513 117 96 while ( len > 0 ) {
606 168 451 if (fd < 0) {
612 17 151 if ( rv <= 0 ) {
619 151 0 if ( tcp == 1 ) {
622 0 151 (void)hv_stores(env,"REMOTE_PORT",newSViv(ntohs(cliaddr.sin_port)));
634 4 147 if ( reqlen >= 0 ) {
637 4 0 else if ( reqlen == -1 ) {
642 0 0 if ( MAX_HEADER_SIZE - buf_len == 0 ) {
652 0 0 if ( rv <= 0 ) {
661 0 147 if (expect_val != NULL) {
662 0 0 if ( strncmp(SvPV_nolen(*expect_val), "100-continue", SvCUR(*expect_val)) == 0 ) {
0 0 if ( strncmp(SvPV_nolen(*expect_val), "100-continue", SvCUR(*expect_val)) == 0 ) {
0 0 if ( strncmp(SvPV_nolen(*expect_val), "100-continue", SvCUR(*expect_val)) == 0 ) {
0 0 if ( strncmp(SvPV_nolen(*expect_val), "100-continue", SvCUR(*expect_val)) == 0 ) {
0 0 if ( strncmp(SvPV_nolen(*expect_val), "100-continue", SvCUR(*expect_val)) == 0 ) {
664 0 0 if ( rv <= 0 ) {
699 0 32 if (!SvROK(rbuf)) croak("ERROR: buf must be RV");
701 0 32 if (!SvOK(buf)) {
0 0 if (!SvOK(buf)) {
0 0 if (!SvOK(buf)) {
704 0 32 SvUPGRADE(buf, SVt_PV);
705 0 32 SvPV_nolen(buf);
707 23 9 if ( len > READ_BUFSZ ) {
710 25 7 d = SvGROW(buf, buf_len + len + 1);
1 24 d = SvGROW(buf, buf_len + len + 1);
712 32 0 SvCUR_set(buf, (rv > 0) ? rv + buf_len : buf_len);
715 0 32 if (rv < 0) XSRETURN_UNDEF;
731 0 0 SvUPGRADE(buf, SVt_PV);
732 0 0 d = SvPV_nolen(buf);
734 0 0 if (rv < 0) XSRETURN_UNDEF;
756 1 11 if ( !SvOK(buf) ) {
1 0 if ( !SvOK(buf) ) {
0 1 if ( !SvOK(buf) ) {
760 1 10 SvUPGRADE(buf, SVt_PV);
761 10 1 d = SvPV_nolen(buf);
763 10 1 if ( buf_len == 0 ){
780 10 10 while ( remain > 0 ) {
783 0 10 if ( rv <= 0 ) {
789 30 10 while ( rv > 0 ) {
790 30 0 if ( (unsigned int)rv >= v[vec_offset].iov_len ) {
804 0 10 if (rv < 0) XSRETURN_UNDEF;
821 1 22 if ( !SvOK(buf) ) {
1 0 if ( !SvOK(buf) ) {
0 1 if ( !SvOK(buf) ) {
825 1 21 SvUPGRADE(buf, SVt_PV);
826 21 1 d = SvPV_nolen(buf);
828 21 1 if ( buf_len == 0 ) {
833 21 21 while ( buf_len > written ) {
835 21 0 if ( rv <= 0 ) {
840 0 21 if (rv < 0) XSRETURN_UNDEF;
873 0 1 if( (av_len(headers)+1) % 2 == 1 ) croak("ERROR: Odd number of element in header");
900 2 1 while (i < av_len(headers) + 1 ) {
927 1 1 while ( remain > 0 ) {
930 0 1 if ( rv <= 0 ) {
936 10 1 while ( rv > 0 ) {
937 10 0 if ( (unsigned int)rv >= iv[vec_offset].iov_len ) {
951 0 1 if (rv < 0) XSRETURN_UNDEF;
992 0 146 if( (av_len(headers)+1) % 2 == 1 ) croak("ERROR: Odd number of element in header");
993 146 0 use_chunked = SvIV(use_chunkedv);
997 146 0 if ( status_code < 200 || status_code == 204 || status_code == 304 ) {
2 144 if ( status_code < 200 || status_code == 204 || status_code == 304 ) {
1001 93 53 if ( use_chunked > 0 ) {
1039 179 146 while ( i < av_len(headers) + 1 ) {
1043 0 179 if ( strncasecmp(key,"Connection",key_len) == 0 ) {
1051 1 178 if ( strncasecmp(key,"Date",key_len) == 0 ) {
1053 4 1 for ( s=val, n = val_len, d=date_line+sizeof("Date: ")-1; n !=0; s++, --n, d++) {
1062 1 177 } else if ( strncasecmp(key,"Server",key_len) == 0 ) {
1064 5 1 for ( s=val, n = val_len, d=server_line+sizeof("Server: ")-1; n !=0; s++, --n, d++) {
1072 169 8 } else if ( strncasecmp(key,"Content-Length",key_len) == 0 || strncasecmp(key,"Transfer-Encoding",key_len) == 0) {
0 169 } else if ( strncasecmp(key,"Content-Length",key_len) == 0 || strncasecmp(key,"Transfer-Encoding",key_len) == 0) {
1091 145 1 if ( date_pushed == 0 ) {
1096 89 57 if ( use_chunked > 0 ) {
1107 140 146 for (i=0; i < av_len(body) + 1; i++ ) {
1109 4 136 if (!SvOK(*b)) {
4 0 if (!SvOK(*b)) {
4 0 if (!SvOK(*b)) {
1113 4 132 if ( val_len < 1 ) {
1116 86 46 if ( use_chunked ) {
1125 86 46 if ( use_chunked ) {
1132 84 62 if ( use_chunked && ix == 0 ) {
1141 146 146 while ( remain > 0 ) {
1144 0 146 if ( rv <= 0 ) {
1150 1769 146 while ( rv > 0 ) {
1151 1769 0 if ( (unsigned int)rv >= v[vec_offset].iov_len ) {
1166 0 146 if (rv < 0) XSRETURN_UNDEF;