You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/06/26 04:14:43 UTC
svn commit: r1139685 - in /trafficserver/plugins/geoip_acl: Makefile acl.cc
acl.h
Author: zwoop
Date: Sun Jun 26 02:14:43 2011
New Revision: 1139685
URL: http://svn.apache.org/viewvc?rev=1139685&view=rev
Log:
Fixed makefile, and added some logic around dealing with no ISO defaults
Modified:
trafficserver/plugins/geoip_acl/Makefile
trafficserver/plugins/geoip_acl/acl.cc
trafficserver/plugins/geoip_acl/acl.h
Modified: trafficserver/plugins/geoip_acl/Makefile
URL: http://svn.apache.org/viewvc/trafficserver/plugins/geoip_acl/Makefile?rev=1139685&r1=1139684&r2=1139685&view=diff
==============================================================================
--- trafficserver/plugins/geoip_acl/Makefile (original)
+++ trafficserver/plugins/geoip_acl/Makefile Sun Jun 26 02:14:43 2011
@@ -18,7 +18,7 @@ TSXS=tsxs
GEO_LIB=GeoIP # Also check lulu.h for defines ...
all: geoip_acl.cc acl.cc
- $(TSXS) -v -C $? -l $(GEO_LIB) -lpcre -o geoip_acl.so
+ $(TSXS) -v -C $? -l $(GEO_LIB) -l pcre -o geoip_acl.so
install:
tsxs -i -o geoip_acl.so
Modified: trafficserver/plugins/geoip_acl/acl.cc
URL: http://svn.apache.org/viewvc/trafficserver/plugins/geoip_acl/acl.cc?rev=1139685&r1=1139684&r2=1139685&view=diff
==============================================================================
--- trafficserver/plugins/geoip_acl/acl.cc (original)
+++ trafficserver/plugins/geoip_acl/acl.cc Sun Jun 26 02:14:43 2011
@@ -139,6 +139,7 @@ CountryAcl::add_token(const std::string&
{
int iso = -1;
+ Acl::add_token(str);
#if MAXMIND_GEOIP
iso = GeoIP_id_by_code(str.c_str());
#endif
@@ -201,7 +202,11 @@ CountryAcl::eval(TSRemapRequestInfo *rri
} while ((acl = acl->next()));
}
- // None of the regexes (if any) matched, so fallback to the remap defaults.
+ // This is a special case for when there are no ISO codes. It got kinda wonky without it.
+ if (0 == _added_tokens)
+ return _allow;
+
+ // None of the regexes (if any) matched, so fallback to the remap defaults if there are any.
int iso = -1;
const sockaddr* addr = TSHttpTxnClientAddrGet(txnp);
Modified: trafficserver/plugins/geoip_acl/acl.h
URL: http://svn.apache.org/viewvc/trafficserver/plugins/geoip_acl/acl.h?rev=1139685&r1=1139684&r2=1139685&view=diff
==============================================================================
--- trafficserver/plugins/geoip_acl/acl.h (original)
+++ trafficserver/plugins/geoip_acl/acl.h Sun Jun 26 02:14:43 2011
@@ -43,7 +43,7 @@ class Acl
{
public:
Acl()
- : _html(""), _allow(true)
+ : _html(""), _allow(true), _added_tokens(0)
{ }
virtual ~Acl()
@@ -53,7 +53,7 @@ public:
virtual void read_regex(const char* fn) = 0;
virtual void process_args(int argc, char* argv[]) = 0;
virtual bool eval(TSRemapRequestInfo *rri, TSHttpTxn txnp) const = 0;
- virtual void add_token(const std::string& str) = 0;
+ virtual void add_token(const std::string& str) { ++_added_tokens; printf("HERE\n"); }
void set_allow(bool allow) { _allow = allow; }
const char* get_html() const { return _html.c_str(); }
@@ -69,6 +69,7 @@ public:
protected:
std::string _html;
bool _allow;
+ int _added_tokens;
};