2009-10-08 19:59:10 +02:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2009-10-08 19:59:10 +02:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2011-04-02 02:10:16 +02:00
|
|
|
* Copyright (c) 2008-2011, Tomasz Sowa
|
2009-10-08 19:59:10 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_core_acceptencodingparser
|
|
|
|
#define headerfile_winix_core_acceptencodingparser
|
2009-10-08 19:59:10 +02:00
|
|
|
|
|
|
|
#include "acceptbaseparser.h"
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
|
|
|
|
class AcceptEncodingParser : public AcceptBaseParser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
bool AcceptDeflate()
|
|
|
|
{
|
|
|
|
return accept_deflate;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-02 02:10:16 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-08 19:59:10 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
accept_deflate = false;
|
2011-04-02 02:10:16 +02:00
|
|
|
accept_gzip = false;
|
2009-10-08 19:59:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Param(const std::string & param, double q)
|
|
|
|
{
|
2011-04-02 02:10:16 +02:00
|
|
|
if( param=="deflate" && q!=0.0 )
|
2009-10-08 19:59:10 +02:00
|
|
|
{
|
|
|
|
accept_deflate = true;
|
2011-04-02 02:10:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if( param=="gzip" && q!=0.0 )
|
|
|
|
{
|
|
|
|
accept_gzip = true;
|
2009-10-08 19:59:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool accept_deflate;
|
2011-04-02 02:10:16 +02:00
|
|
|
bool accept_gzip;
|
2009-10-08 19:59:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|