summaryrefslogtreecommitdiff
path: root/src/modules/urlfilter/host/HostURLFilter.cpp
blob: 1aa60783d9038720dfcadcf2980f0e827f3dafac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "HostURLFilter.hpp"
#include "Logger.hpp"

HostURLFilter::HostURLFilter( const std::set<std::string> hosts )
	: m_hosts( hosts )
{
}
		
bool HostURLFilter::filter( const URL url )
{
	string host = url.host( );
	bool res = ( m_hosts.find( host ) != m_hosts.end( ) );
	
	LOG( logDEBUG )	<< ( res ? "Including " : "Excluding " )
			<< "'" << url << "' "
			<< "for host '" << host << "'";
	
	return res;
}

REGISTER_MODULE_1( "host_urlfilter", 0, 0, URLFilter, HostURLFilter, const std::set<std::string> )