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

- old
+ new

@@ -18,11 +18,11 @@ class SPF::Term NAME_PATTERN = '[[:alpha:]] [[:alnum:]\\-_\\.]*' - MACRO_LITERAL_PATTERN = "[!-$&-~]" + MACRO_LITERAL_PATTERN = "[!-$&-~%]" MACRO_DELIMITER = "[\\.\\-+,\\/_=]" MACRO_TRANSFORMERS_PATTERN = "\\d*r?" MACRO_EXPAND_PATTERN = " % (?: @@ -252,10 +252,12 @@ parse_name if @errors.empty? parse_params if @errors.empty? parse_end if @errors.empty? end + def params; nil; end + def parse_qualifier if @parse_text.sub!(/(#{QUALIFIER_PATTERN})?/x, '') @qualifier = $1 or DEFAULT_QUALIFIER else error(SPF::InvalidMechQualifierError.new( @@ -358,11 +360,11 @@ end def params params = '' if @domain_spec - params += ':' + @domain_spec.to_s if @domain_spec + 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 != self.default_ipv6_prefix_length @@ -401,11 +403,11 @@ # Other method of denoting "potentially ~infinite" netblocks? @ip_netblocks << nil end def params - return @domain_spec ? ':' + @domain_spec : nill + return @domain_spec ? @domain_spec : nil end def match(server, request, want_result = true) server.count_dns_interactive_term(request) @@ -482,11 +484,11 @@ def parse_params(required = true) self.parse_domain_spec(required) end def params - return @domain_spec ? ':' + @domain_spec : nil + return @domain_spec ? @domain_spec.to_s : nil end def match(server, request, want_result = true) server.count_dns_interactive_term(request) @@ -536,17 +538,17 @@ end def params params = '' if @domain_spec - params += ':' + @domain_spec + params += @domain_spec.to_s end if @ipv4_prefix_length and @ipv4_prefix_length != self.default_ipv4_prefix_length - params += '/' + @ipv4_prefix_length + params += '/' + @ipv4_prefix_length.to_s end if @ipv6_prefix_length and @ipv6_prefix_length != self.default_ipv6_prefix_length - params += '//' + @ipv6_prefix_length + params += '//' + @ipv6_prefix_length.to_s end return params end def match(server, request, want_result = true) @@ -585,10 +587,10 @@ def parse_params(required = true) self.parse_domain_spec end def params - return @domain_spec ? ':' + @domain_spec : nil + return @domain_spec ? @domain_spec : nil end def match(server, request, want_result = true) return SPF::Util.valid_domain_for_ip_address( server, request, request.ip_address, self.domain(server, request)) ?