rem: DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket));
add: DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes (chunked) from socket %d\n", (unsigned int)ret, soap->socket));
context: soap_recv_raw(struct soap *soap){ register size_t ret;#ifdef WITH_ZLIB  if (soap->mode & SOAP_ENC_ZLIB)  { if (soap->d_stream.next_out == Z_NULL)      return EOF;    if (soap->d_stream.avail_in || !soap->d_stream.avail_out)    { register int r;      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflating\n"));      soap->d_stream.next_out = (Byte*)soap->buf;      soap->d_stream.avail_out = SOAP_BUFLEN;      r = inflate(&soap->d_stream, Z_NO_FLUSH);      if (r == Z_OK || r == Z_STREAM_END)      { soap->bufidx = 0;        soap->buflen = SOAP_BUFLEN - soap->d_stream.avail_out;        if (soap->zlib_in == SOAP_ZLIB_GZIP)          soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->buflen);        if (r == Z_STREAM_END)        { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));          soap->z_ratio_in = (float)soap->d_stream.total_in / (float)soap->d_stream.total_out;          soap->d_stream.next_out = Z_NULL;        }        if (soap->buflen)        { soap->count += soap->buflen;          return SOAP_OK;        }      }      else if (r != Z_BUF_ERROR)      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream.msg?soap->d_stream.msg:""));        soap->d_stream.next_out = Z_NULL;        return EOF;      }    }zlib_again:    if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK && !soap->chunksize)    { memcpy(soap->buf, soap->z_buf, SOAP_BUFLEN);      soap->buflen = soap->z_buflen;    }  }#endif#ifndef WITH_NOHTTP  if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */  { chunk_again:    if (soap->chunksize)    { soap->buflen = ret = soap->frecv(soap, soap->buf, soap->chunksize > SOAP_BUFLEN ? SOAP_BUFLEN : soap->chunksize);      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk: read %u bytes\n", (unsigned int)ret));      DBGMSG(RECV, soap->buf, ret);      soap->bufidx = 0;      soap->chunksize -= ret;    }    else    { register soap_wchar c;      char *t, tmp[8];      t = tmp;      if (!soap->chunkbuflen)      { soap->chunkbuflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN);        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket));        DBGMSG(RECV, soap->buf, ret);        soap->bufidx = 0;        if (!ret)          return EOF;      }      else        soap->bufidx = soap->buflen;      soap->buflen = soap->chunkbuflen;      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (%u %u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen));      while (!soap_isxdigit((int)(c = soap_getchunkchar(soap))))        if ((int)c == EOF)	  return EOF;      do        *t++ = (char)c;      while (soap_isxdigit((int)(c = soap_getchunkchar(soap))) && t - tmp < 7);      while ((int)c != EOF && c != '\n')        c = soap_getchunkchar(soap);      if ((int)c == EOF)        return EOF;      *t = '\0';      soap->chunksize = soap_strtoul(tmp, &t, 16);      if (!soap->chunksize)      { soap->chunkbuflen = 0;        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of chunked message\n"));	while ((int)c != EOF && c != '\n')          c = soap_getchunkchar(soap);        return EOF;      }      soap->buflen = soap->bufidx + soap->chunksize;      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to %u (%u %s)\n", (unsigned int)soap->buflen, (unsigned int)soap->bufidx, tmp));      if (soap->buflen > soap->chunkbuflen)      { soap->buflen = soap->chunkbuflen;        soap->chunksize -= soap->buflen - soap->bufidx;        soap->chunkbuflen = 0;        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Passed end of buffer for chunked HTTP (%lu bytes left)\n", (unsigned long)(soap->buflen - soap->bufidx)));      }      else if (soap->chunkbuflen)        soap->chunksize = 0;      ret = soap->buflen - soap->bufidx;      if (!ret)        goto chunk_again;    }  }  else#endif  { soap->bufidx = 0;    soap->buflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN);    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket));    DBGMSG(RECV, soap->buf, ret);  }#ifndef WITH_LEANER  if (soap->fpreparerecv && (soap->error = soap->fpreparerecv(soap, soap->buf, ret)))    return soap->error;#endif#ifdef WITH_ZLIB  if (soap->mode & SOAP_ENC_ZLIB)  { register int r;    memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN);    soap->d_stream.next_in = (Byte*)(soap->z_buf + soap->bufidx);    soap->d_stream.avail_in = (unsigned int)ret;    soap->d_stream.next_out = (Byte*)soap->buf;    soap->d_stream.avail_out = SOAP_BUFLEN;    r = inflate(&soap->d_stream, Z_NO_FLUSH);    if (r == Z_OK || r == Z_STREAM_END)    { soap->bufidx = 0;      soap->z_buflen = soap->buflen;      soap->buflen = ret = SOAP_BUFLEN - soap->d_stream.avail_out;      if (soap->zlib_in == SOAP_ZLIB_GZIP)        soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->buflen);      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %u bytes\n", (unsigned int)ret));      if (!ret)        goto zlib_again;      if (r == Z_STREAM_END)      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));        soap->z_ratio_in = (float)soap->d_stream.total_in / (float)soap->d_stream.total_out;        soap->d_stream.next_out = Z_NULL;      }    }    else    { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:""));      soap->d_stream.next_out = Z_NULL;      return EOF;    }  }#endif  soap->count += ret;  return !ret;}