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
86 lines
1.1 KiB
C++
Executable File
86 lines
1.1 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_core_acceptencodingparser
|
|
#define headerfile_winix_core_acceptencodingparser
|
|
|
|
#include "acceptbaseparser.h"
|
|
#include "log.h"
|
|
|
|
|
|
class AcceptEncodingParser : public AcceptBaseParser
|
|
{
|
|
public:
|
|
|
|
bool AcceptDeflate()
|
|
{
|
|
return accept_deflate;
|
|
}
|
|
|
|
|
|
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.0 )
|
|
{
|
|
accept_deflate = true;
|
|
}
|
|
|
|
if( param=="gzip" && q!=0.0 )
|
|
{
|
|
accept_gzip = true;
|
|
}
|
|
}
|
|
|
|
bool accept_deflate;
|
|
bool accept_gzip;
|
|
};
|
|
|
|
|
|
|
|
#endif
|