case eZLibEncode:
{
z_enc_stream *stream = (z_enc_stream *)vStream;
- int org_outbuf_len = stream->zstream.total_out;
+ int org_outbuf_len = stream->OutBuf.BufUsed;
int err;
unsigned int chunkavail;
err = deflate(&stream->zstream, (LastChunk) ? Z_FINISH : Z_NO_FLUSH);
stream->OutBuf.BufUsed += (chunkavail - stream->zstream.avail_out);
- /// todo + org_outbuf_len;
- if (Target) SwapBuffers(Target->Buf, &stream->OutBuf);
+ if (Target &&
+ (LastChunk ||
+ (stream->OutBuf.BufUsed != org_outbuf_len)
+ ))
+ {
+ SwapBuffers(Target->Buf, &stream->OutBuf);
+ }
if (stream->zstream.avail_in == 0)
{
}
}
return (LastChunk && (err != Z_FINISH));
-
+
}
break;
case eZLibDecode: {
int client_con_state = 0;
int chunked = 0;
int is_gzip = 0;
- int is_gzip_header = 1;
StrBuf *BufHeader = NULL;
StrBuf *Buf;
StrBuf *pBuf = NULL;
}
else
{
- is_gzip_header = 0;
pBuf = WCC->WBuf;
}
rc = StrBufStreamTranscode(eZLibEncode, &WriteBuffer, &ReadBuffer, NULL, -1, SC, done);
if (StrLength (pBuf) > 0) {
- if (!done && is_gzip_header && (StrLength(pBuf) == 10)) {
- /* we don't want to send the gzip header as single package... */
- break;
- }
- is_gzip_header = 0;
StrBufPrintf(BufHeader, "%s%x\r\n",
(first)?"":"\r\n",
StrLength (pBuf));