lib/spf/model.rb in spf-0.0.15 vs lib/spf/model.rb in spf-0.0.16

- old
+ new

@@ -363,11 +363,11 @@ params += ':' + @domain_spec.to_s if @domain_spec end if @ipv4_prefix_length and @ipv4_prefix_length != self.default_ipv4_prefix_length params += '/' + @ipv4_prefix_length.to_s end - if @ipv6_prefix_length and @ipv6_prefix_length != DEFAULT_IPV6_PREFIX_LENGTH + if @ipv6_prefix_length and @ipv6_prefix_length != self.default_ipv6_prefix_length params += '//' + @ipv6_prefix_length.to_s end return params end @@ -456,13 +456,13 @@ self.parse_ipv6_network(required) @ip_netblocks << @ip_network end def params - params = ':' + @ip_network.short - params += '/' + @ip_network.pfxlen if - @ip_network.pfxlen != DEFAULT_IPV6_PREFIX_LENGTH + params = @ip_network.to_addr + params += '/' + @ip_network.pfxlen.to_s if + @ip_network.pfxlen != self.default_ipv6_prefix_length return params end def match(server, request, want_result = true) return @ip_network.contains?(request.ip_address_v6) @@ -541,11 +541,11 @@ params += ':' + @domain_spec end if @ipv4_prefix_length and @ipv4_prefix_length != self.default_ipv4_prefix_length params += '/' + @ipv4_prefix_length end - if @ipv6_prefix_length and @ipv6_prefix_length != DEFAULT_IPV6_PREFIX_LENGTH + if @ipv6_prefix_length and @ipv6_prefix_length != self.default_ipv6_prefix_length params += '//' + @ipv6_prefix_length end return params end @@ -665,17 +665,18 @@ class SPF::UnknownMod < SPF::Mod NAME = 'uknown' end - class SPF::Mod::Exp < SPF::Mod + class SPF::Mod::Exp < SPF::GlobalMod attr_reader :domain_spec NAME = 'exp' - PRECEDENCE = 0.2 + def precedence; 0.2; end + def parse_params(required = true) self.parse_domain_spec(required) end def params @@ -712,10 +713,11 @@ class SPF::Mod::Redirect < SPF::GlobalMod attr_reader :domain_spec NAME = 'redirect' - PRECEDENCE = 0.8 + + def precedence; 0.8; end def init(options = {}) super(options) @nested_record = nil end