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.
|
||||
*
|
||||
*/
|
||||
@@ -24,24 +24,60 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool AcceptGzip()
|
||||
{
|
||||
return accept_gzip;
|
||||
}
|
||||
|
||||
|
||||
void ParseAndLog(const char * str)
|
||||
{
|
||||
Parse(str);
|
||||
|
||||
if( accept_deflate || accept_gzip )
|
||||
{
|
||||
log << log3 << "AEP: ";
|
||||
|
||||
if( accept_deflate )
|
||||
{
|
||||
log << "accept deflate";
|
||||
|
||||
if( accept_gzip )
|
||||
log << ", ";
|
||||
}
|
||||
|
||||
if( accept_gzip )
|
||||
log << "accept gzip";
|
||||
|
||||
log << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void Init()
|
||||
{
|
||||
accept_deflate = false;
|
||||
accept_gzip = false;
|
||||
}
|
||||
|
||||
|
||||
void Param(const std::string & param, double q)
|
||||
{
|
||||
if( param=="deflate" && q!=0 )
|
||||
if( param=="deflate" && q!=0.0 )
|
||||
{
|
||||
accept_deflate = true;
|
||||
log << log3 << "AEP: accept deflate" << logend;
|
||||
}
|
||||
|
||||
if( param=="gzip" && q!=0.0 )
|
||||
{
|
||||
accept_gzip = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool accept_deflate;
|
||||
bool accept_gzip;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user