Branch Coverage

fcgiapp.c
Criterion Covered Total %
branch 109 408 26.7


line true false branch
82 26 0 ASSERT(size == 0 || result != NULL);
0 26 ASSERT(size == 0 || result != NULL);
110 6 0 if (stream->isClosed || ! stream->isReader)
0 6 if (stream->isClosed || ! stream->isReader)
113 2 4 if (stream->rdNext != stream->stop)
117 2 2 if (stream->isClosed)
121 2 0 if (stream->rdNext != stream->stop)
124 0 0 ASSERT(stream->isClosed); /* bug in fillBufProc if not */
147 6 0 if (stream->isClosed || ! stream->isReader || n <= 0) {
6 0 if (stream->isClosed || ! stream->isReader || n <= 0) {
0 6 if (stream->isClosed || ! stream->isReader || n <= 0) {
153 4 2 if(n <= (stream->stop - stream->rdNext)) {
164 2 2 if(stream->rdNext != stream->stop) {
169 2 0 if(bytesMoved == n)
173 2 0 if(stream->isClosed || !stream->isReader)
0 2 if(stream->isClosed || !stream->isReader)
176 0 2 if (stream->isClosed)
206 0 0 while (n > 0) {
208 0 0 if(c == EOF) {
209 0 0 if(p == str)
216 0 0 if(c == '\n')
238 0 0 if(c == EOF
239 0 0 || stream->isClosed
240 0 0 || !stream->isReader
241 0 0 || stream->rdNext == stream->stopUnget)
267 0 0 return (stream->isClosed) ? EOF : 0;
284 0 0 if(stream->wrNext != stream->stop)
286 0 0 if(stream->isClosed || stream->isReader)
0 0 if(stream->isClosed || stream->isReader)
289 0 0 if(stream->wrNext != stream->stop)
291 0 0 ASSERT(stream->isClosed); /* bug in emptyBuffProc if not */
317 8 0 if(n <= (stream->stop - stream->wrNext)) {
328 0 0 if(stream->wrNext != stream->stop) {
333 0 0 if(bytesMoved == n)
337 0 0 if(stream->isClosed || stream->isReader)
0 0 if(stream->isClosed || stream->isReader)
438 0 0 while (f != fStop) {
440 0 0 if(percentPtr == NULL) percentPtr = fStop;
441 0 0 if(percentPtr != f) {
442 0 0 if(FCGX_PutStr(f, percentPtr - f, stream) < 0)
446 0 0 if(f == fStop) break;
453 0 0 if(fastPath) {
466 0 0 switch(op) {
499 0 0 if(n > 5)
506 0 0 if(n == 0) {
507 0 0 if(*p == '*') {
508 0 0 minWidth = va_arg(arg, int);
509 0 0 if(abs(minWidth) > 999999)
522 0 0 } else if(n <= 6) {
531 0 0 if(*p == '.') {
534 0 0 if(n == 0) {
535 0 0 if(*p == '*') {
536 0 0 precision = va_arg(arg, int);
537 0 0 if(precision < 0) precision = 0;
538 0 0 if(precision > 999999)
551 0 0 } else if(n <= 6) {
563 0 0 switch(*p) {
576 0 0 ASSERT(fmtBuffPtr - fmtBuff < FMT_BUFFLEN);
595 0 0 charPtrArg = va_arg(arg, char *);
596 0 0 if (!charPtrArg) charPtrArg = "(null)";
597 0 0 if(precision == -1) {
601 0 0 buffReqd =
608 0 0 doubleArg = va_arg(arg, double);
620 0 0 if(precision == -1) precision = 6;
621 0 0 buffReqd = precision + 3 + ((exp > 0) ? exp/3 : 0);
627 0 0 if(precision == -1) precision = 6;
640 0 0 if(buffReqd <= PRINTF_BUFFLEN) {
644 0 0 if(auxBuffPtr == NULL || buffReqd > auxBuffLen) {
0 0 if(auxBuffPtr == NULL || buffReqd > auxBuffLen) {
645 0 0 if(auxBuffPtr != NULL) free(auxBuffPtr);
648 0 0 if(auxBuffPtr == NULL)
674 0 0 intArg = va_arg(arg, int);
679 0 0 longArg = va_arg(arg, long);
684 0 0 shortArg = (short) va_arg(arg, int);
698 0 0 unsignedArg = va_arg(arg, unsigned);
703 0 0 uLongArg = va_arg(arg, unsigned long);
708 0 0 uShortArg = (unsigned short) va_arg(arg, int);
719 0 0 intArg = va_arg(arg, int);
736 0 0 if(fastPath) {
737 0 0 buffPtr = va_arg(arg, char *);
757 0 0 if(sizeModifier != ' ')
759 0 0 voidPtrArg = va_arg(arg, void *);
766 0 0 intPtrArg = va_arg(arg, int *);
770 0 0 longPtrArg = va_arg(arg, long *);
774 0 0 shortPtrArg = (short *) va_arg(arg, short *);
783 0 0 if(fastPath) {
806 0 0 doubleArg = va_arg(arg, double);
820 0 0 if(sizeModifier != ' ')
831 0 0 if(performedOp) break;
832 0 0 if(!fastPath)
836 0 0 ASSERT(buffCount < buffLen);
837 0 0 if(buffCount > 0) {
838 0 0 if(FCGX_PutStr(buffPtr, buffCount, stream) < 0)
841 0 0 } else if(buffCount < 0) {
850 0 0 if(auxBuffPtr != NULL) free(auxBuffPtr);
863 0 0 for (i = 0; i < n; i++)
889 4 0 if(stream->isClosed || stream->isReader)
0 4 if(stream->isClosed || stream->isReader)
892 0 4 return (stream->isClosed) ? -1 : 0;
914 0 4 if (stream == NULL) return 0;
916 4 0 if(!stream->wasFCloseCalled) {
917 4 0 if(!stream->isReader) {
922 0 4 if(stream->isReader) {
928 4 0 return (stream->FCGI_errno == 0) ? 0 : EOF;
947 0 0 if(stream->FCGI_errno == 0) {
1050 2 2 if(paramsPtr == NULL) {
1053 4 2 for (p = paramsPtr->vec; p < paramsPtr->cur; p++) {
1082 0 4 if(size >= paramsPtr->length) {
1108 0 0 if (name == NULL || envp == NULL) return NULL;
0 0 if (name == NULL || envp == NULL) return NULL;
1112 0 0 for (p = envp; *p; ++p) {
1113 0 0 if((strncmp(name, *p, len) == 0) && ((*p)[len] == '=')) {
0 0 if((strncmp(name, *p, len) == 0) && ((*p)[len] == '=')) {
1144 2 2 while((nameLen = FCGX_GetChar(stream)) != EOF) {
1149 0 2 if((nameLen & 0x80) != 0) {
1150 0 0 if(FCGX_GetStr((char *) &lenBuff[0], 3, stream) != 3) {
1157 0 2 if((valueLen = FCGX_GetChar(stream)) == EOF) {
1161 0 2 if((valueLen & 0x80) != 0) {
1162 0 0 if(FCGX_GetStr((char *) &lenBuff[0], 3, stream) != 3) {
1174 0 2 if(FCGX_GetStr(nameValue, nameLen, stream) != nameLen) {
1180 0 2 if(FCGX_GetStr(nameValue + nameLen + 1, valueLen, stream)
1208 8 0 ASSERT(contentLength >= 0 && contentLength <= FCGI_MAX_LENGTH);
0 8 ASSERT(contentLength >= 0 && contentLength <= FCGI_MAX_LENGTH);
1209 8 0 ASSERT(paddingLength >= 0 && paddingLength <= 0xff);
0 8 ASSERT(paddingLength >= 0 && paddingLength <= 0xff);
1337 2 2 if(!(data->type == FCGI_STDERR
0 2 if(!(data->type == FCGI_STDERR
1338 2 0 && stream->wrNext == data->buff
1347 2 2 if(data->reqDataPtr->nWriters == 1) {
1366 6 6 while (len) {
1368 0 6 if (wrote < 0)
1397 8 0 if(!data->rawWrite) {
1399 4 4 if(cLen > 0) {
1413 4 4 if(doClose) {
1416 6 2 if (stream->wrNext != data->buff) {
1418 0 6 if (write_it_all(data->reqDataPtr->ipcFd, (char *)data->buff, stream->wrNext - data->buff) < 0) {
1427 4 4 if(!data->rawWrite) {
1463 0 0 if(type == FCGI_GET_VALUES) {
1466 0 0 if((FCGX_GetError(stream) != 0) || (data->contentLen != 0)) {
0 0 if((FCGX_GetError(stream) != 0) || (data->contentLen != 0)) {
1470 0 0 for (pPtr = paramsPtr->vec; pPtr < paramsPtr->cur; pPtr++) {
1473 0 0 if(strcmp(name, FCGI_MAX_CONNS) == 0) {
1475 0 0 } else if(strcmp(name, FCGI_MAX_REQS) == 0) {
1477 0 0 } else if(strcmp(name, FCGI_MPXS_CONNS) == 0) {
1482 0 0 if(name != NULL) {
1502 0 0 if (write_it_all(data->reqDataPtr->ipcFd, response, FCGI_HEADER_LEN + paddedLen) < 0) {
1532 2 0 if(requestId == 0 || data->contentLen != sizeof(body)) {
0 2 if(requestId == 0 || data->contentLen != sizeof(body)) {
1535 0 2 if(data->reqDataPtr->isBeginProcessed) {
1546 0 0 if (write_it_all(data->reqDataPtr->ipcFd, (char *)&endRequestRecord, sizeof(endRequestRecord)) < 0) {
1557 0 2 if(FCGX_GetStr((char *) &body, sizeof(body), stream)
1593 0 6 if(header.version != FCGI_VERSION_1) {
1601 2 4 if(header.type == FCGI_BEGIN_REQUEST) {
1604 0 4 if(requestId == FCGI_NULL_REQUEST_ID) {
1607 0 4 if(requestId != data->reqDataPtr->requestId) {
1610 0 4 if(header.type != data->type) {
1636 2 8 if(stream->rdNext == data->buffStop) {
1639 0 2 if(count <= 0) {
1640 0 0 SetError(stream, (count == 0 ? FCGX_PROTOCOL_ERROR : OS_Errno));
1650 4 6 if(data->contentLen > 0) {
1653 4 0 if(!data->skip) {
1658 0 0 if(data->contentLen > 0) {
1669 0 6 if(data->paddingLen > 0) {
1673 0 0 if(data->paddingLen > 0) {
1681 0 6 if(data->eorStop) {
1694 0 6 if(headerLen < sizeof(header)) {
1718 2 2 if(data->contentLen == 0) {
1737 0 0 ASSERT(status < 0);
1769 6 0 bufflen = AlignInt8(min(max(bufflen, 32), FCGI_MAX_LENGTH + 1));
1773 0 6 if(data->buff != data->mBuff) {
1776 2 4 if(isReader) {
1794 2 4 if(isReader) {
1826 6 6 if(stream == NULL) {
1849 0 4 ASSERT(stream->isReader);
1942 0 0 if (isFastCGI != -1) {
1946 0 0 if (!libInitialized) {
1948 0 0 if (rc) {
2007 0 4 if (reqDataPtr == NULL) {
2014 2 2 if (reqDataPtr->in) {
2020 0 2 if (!close && !reqDataPtr->in->isClosed && reqDataPtr->keepConnection) {
0 0 if (!close && !reqDataPtr->in->isClosed && reqDataPtr->keepConnection) {
0 0 if (!close && !reqDataPtr->in->isClosed && reqDataPtr->keepConnection) {
2026 0 0 } while (!stream->isClosed);
2037 0 4 if (request == NULL)
2045 4 0 if (close) {
2055 0 2 if (rc == FCGI_LISTENSOCK_FILENO && isFastCGI == 0) {
0 0 if (rc == FCGI_LISTENSOCK_FILENO && isFastCGI == 0) {
2094 0 3 if (libInitialized) {
2100 0 3 if (OS_LibInit(NULL) == -1) {
2101 0 0 return OS_Errno ? OS_Errno : -9997;
2105 0 3 webServerAddressList = p ? StringCopy(p) : NULL;
2147 0 0 if (! libInitialized) {
2149 0 0 if (rc) {
2193 0 2 if (!libInitialized) {
2206 2 0 if (reqDataPtr->ipcFd < 0) {
2210 0 2 if (reqDataPtr->ipcFd < 0) {
2211 0 0 return (errno > 0) ? (0 - errno) : -9999;
2222 0 2 if(!reqDataPtr->isBeginProcessed) {
2244 2 0 if(ReadParams(reqDataPtr->paramsPtr, reqDataPtr->in) >= 0) {
2292 0 0 if(data->reqDataPtr->role != FCGI_FILTER
2293 0 0 || !stream->isReader
2294 0 0 || !stream->isClosed
2295 0 0 || data->type != FCGI_STDIN) {
2335 0 0 if (r->ipcFd <= 0)