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

ProtocolURLFilter::ProtocolURLFilter( const std::set<std::string> protocols )
	: m_protocols( protocols )
{
}
		
bool ProtocolURLFilter::filter( const URL url )
{
	string protocol = url.protocol( );
	bool res = ( m_protocols.find( protocol ) != m_protocols.end( ) );
	
	LOG( logDEBUG )	<< ( res ? "Including " : "Excluding " )
			<< "'" << url << "' "
			<< "for protocol '" << protocol << "'";

	return res;
}

REGISTER_MODULE_1( "protocol_urlfilter", URLFilter, ProtocolURLFilter, const std::set<std::string> )