Branch Coverage

lib/Plack/Handler/picohttpparser/picohttpparser.c
Criterion Covered Total %
branch 88 248 35.4


line true false branch
149 822 48 while (likely(buf_end - buf >= 8)) {
151 816 6 DOIT(); DOIT(); DOIT(); DOIT();
790 26 DOIT(); DOIT(); DOIT(); DOIT();
667 123 DOIT(); DOIT(); DOIT(); DOIT();
630 37 DOIT(); DOIT(); DOIT(); DOIT();
152 629 1 DOIT(); DOIT(); DOIT(); DOIT();
624 5 DOIT(); DOIT(); DOIT(); DOIT();
624 0 DOIT(); DOIT(); DOIT(); DOIT();
345 279 DOIT(); DOIT(); DOIT(); DOIT();
156 477 0 if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
0 477 if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
0 0 if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
163 0 128 CHECK_EOF();
164 48 80 if (unlikely(! IS_PRINTABLE_ASCII(*buf))) {
165 48 0 if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
0 48 if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
0 0 if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
171 525 0 if (likely(*buf == '\015')) {
173 0 525 EXPECT_CHAR('\012');
0 525 EXPECT_CHAR('\012');
175 0 0 } else if (*buf == '\012') {
191 0 0 buf = last_len < 3 ? buf : buf + last_len - 3;
194 0 0 CHECK_EOF();
195 0 0 if (*buf == '\015') {
197 0 0 CHECK_EOF();
198 0 0 EXPECT_CHAR('\012');
0 0 EXPECT_CHAR('\012');
200 0 0 } else if (*buf == '\012') {
207 0 0 if (ret_cnt == 2) {
221 0 0 CHECK_EOF();
0 151 CHECK_EOF();
222 0 0 if (! ('0' <= *buf && *buf <= '9')) {
151 0 if (! ('0' <= *buf && *buf <= '9')) {
228 0 0 CHECK_EOF();
0 302 CHECK_EOF();
229 0 0 if ('0' <= *buf && *buf <= '9') {
151 151 if ('0' <= *buf && *buf <= '9') {
244 0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
0 151 EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P');
245 0 151 EXPECT_CHAR('/'); EXPECT_CHAR('1'); EXPECT_CHAR('.');
0 151 EXPECT_CHAR('/'); EXPECT_CHAR('1'); EXPECT_CHAR('.');
0 151 EXPECT_CHAR('/'); EXPECT_CHAR('1'); EXPECT_CHAR('.');
0 151 EXPECT_CHAR('/'); EXPECT_CHAR('1'); EXPECT_CHAR('.');
0 151 EXPECT_CHAR('/'); EXPECT_CHAR('1'); EXPECT_CHAR('.');
0 151 EXPECT_CHAR('/'); EXPECT_CHAR('1'); EXPECT_CHAR('.');
255 0 676 CHECK_EOF();
256 150 526 if (*buf == '\015') {
258 0 150 EXPECT_CHAR('\012');
0 150 EXPECT_CHAR('\012');
260 0 526 } else if (*buf == '\012') {
264 1 525 if (*num_headers == max_headers) {
268 382 143 if (! (*num_headers != 0 && (*buf == ' ' || *buf == '\t'))) {
380 2 if (! (*num_headers != 0 && (*buf == ' ' || *buf == '\t'))) {
269 0 523 if (! token_char_map[(unsigned char)*buf]) {
280 0 523 CHECK_EOF();
283 5687 523 if (*buf == ':') {
285 0 5687 } else if (*buf < ' ') {
290 5687 0 CHECK_EOF();
295 0 1046 CHECK_EOF();
296 523 523 if (! (*buf == ' ' || *buf == '\t')) {
304 525 0 if ((buf = get_token_to_eol(buf, buf_end, &headers[*num_headers].value,
321 0 151 CHECK_EOF();
322 0 151 if (*buf == '\015') {
324 0 0 EXPECT_CHAR('\012');
0 0 EXPECT_CHAR('\012');
325 0 151 } else if (*buf == '\012') {
330 0 151 ADVANCE_TOKEN(*method, *method_len);
465 151 ADVANCE_TOKEN(*method, *method_len);
0 465 ADVANCE_TOKEN(*method, *method_len);
0 0 ADVANCE_TOKEN(*method, *method_len);
465 0 ADVANCE_TOKEN(*method, *method_len);
332 0 151 ADVANCE_TOKEN(*path, *path_len);
800 151 ADVANCE_TOKEN(*path, *path_len);
0 800 ADVANCE_TOKEN(*path, *path_len);
0 0 ADVANCE_TOKEN(*path, *path_len);
800 0 ADVANCE_TOKEN(*path, *path_len);
334 151 0 if ((buf = parse_http_version(buf, buf_end, minor_version, ret)) == NULL) {
337 151 0 if (*buf == '\015') {
339 0 151 EXPECT_CHAR('\012');
0 151 EXPECT_CHAR('\012');
340 0 0 } else if (*buf == '\012') {
368 0 151 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
0 0 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
372 1 150 if ((buf = parse_request(buf, buf_end, method, method_len, path, path_len,
390 0 0 if ((buf = parse_http_version(buf, buf_end, minor_version, ret)) == NULL) {
394 0 0 if (*buf++ != ' ') {
399 0 0 if ((buf = parse_int(buf, buf_end, status, ret)) == NULL) {
403 0 0 if (*buf++ != ' ') {
408 0 0 if ((buf = get_token_to_eol(buf, buf_end, msg, msg_len, ret)) == NULL) {
432 0 0 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
0 0 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
436 0 0 if ((buf = parse_response(buf, buf_end, minor_version, status, msg, msg_len,
457 0 0 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
0 0 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
461 0 0 if ((buf = parse_headers(buf, buf_end, headers, num_headers, max_headers, &r))
480 0 0 if ('0' <= ch && ch <= '9') {
482 0 0 } else if ('A' <= ch && ch <= 'F') {
484 0 0 } else if ('a' <= ch && ch <= 'f') {
502 0 0 if (src == bufsz)
504 0 0 if ((v = decode_hex(buf[src])) == -1) {
505 0 0 if (decoder->_hex_count == 0) {
511 0 0 if (decoder->_hex_count == sizeof(size_t) * 2) {
524 0 0 if (src == bufsz)
526 0 0 if (buf[src] == '\012')
530 0 0 if (decoder->bytes_left_in_chunk == 0) {
531 0 0 if (decoder->consume_trailer) {
543 0 0 if (avail < decoder->bytes_left_in_chunk) {
544 0 0 if (dst != src)
551 0 0 if (dst != src)
561 0 0 if (src == bufsz)
563 0 0 if (buf[src] != '\015')
566 0 0 if (buf[src] != '\012') {
575 0 0 if (src == bufsz)
577 0 0 if (buf[src] != '\015')
580 0 0 if (buf[src++] == '\012')
586 0 0 if (src == bufsz)
588 0 0 if (buf[src] == '\012')
602 0 0 if (dst != src)