added support for gzip compression
new config option: compression_encoding (integer) 1 - use deflate if available (or raw deflate for Internet Explorer) or don't compress 2 - use gzip if available or don't compress 10 - prefer deflate -- use deflate (or raw deflate for IE) if both deflate and gzip are available 20 - prefer gzip -- use gzip if both deflate and gzip are available default: 20 git-svn-id: svn://ttmath.org/publicrep/winix/trunk@727 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -23,18 +23,35 @@ public:
|
||||
Compress();
|
||||
~Compress();
|
||||
|
||||
int Init(int compress_level = 6);
|
||||
int CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int level = 6);
|
||||
int Init(int compress_level_ = 6);
|
||||
|
||||
/*
|
||||
encoding:
|
||||
0 - raw deflate data with no zlib header or trailer, and will not compute an adler32 check value
|
||||
(for Internet Explorer)
|
||||
1 - deflate
|
||||
2 - gzip
|
||||
*/
|
||||
int CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding = 2);
|
||||
size_t last_out_size;
|
||||
|
||||
private:
|
||||
|
||||
bool AllocateMemory();
|
||||
int MakeCompress(const char * source, size_t source_len, FCGX_Stream * out_stream);
|
||||
bool InitRawDeflate();
|
||||
bool InitDeflate();
|
||||
bool InitGzip();
|
||||
|
||||
int MakeCompress(z_stream & strm, const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding);
|
||||
z_stream * SelectStream(int encoding);
|
||||
void ResetStream(z_stream * pstrm, int encoding);
|
||||
void PutLog(size_t source_len, int encoding);
|
||||
|
||||
int compress_level;
|
||||
size_t buffer_max_len;
|
||||
char * buffer;
|
||||
z_stream strm;
|
||||
z_stream strm_raw_deflate, strm_deflate, strm_gzip;
|
||||
bool raw_deflate_inited, deflate_inited, gzip_inited;
|
||||
bool ready_for_compress;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user