spf 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spf/error.rb +3 -2
- data/lib/spf/model.rb +8 -1
- data/lib/spf/version.rb +1 -1
- data/spf.gemspec +1 -1
- metadata +1 -1
data/lib/spf/error.rb
CHANGED
@@ -33,10 +33,11 @@ module SPF
|
|
33
33
|
|
34
34
|
class NothingToParseError < Error; end # Nothing to parse
|
35
35
|
class SyntaxError < Error # Generic syntax error
|
36
|
-
attr_accessor :text, :parse_text, :domain
|
37
|
-
def initialize(message, text=nil, parse_text=nil)
|
36
|
+
attr_accessor :text, :parse_text, :domain, :hint
|
37
|
+
def initialize(message, text=nil, parse_text=nil, hint=nil)
|
38
38
|
@text = text
|
39
39
|
@parse_text = parse_text
|
40
|
+
@hint = hint
|
40
41
|
super(message)
|
41
42
|
end
|
42
43
|
end
|
data/lib/spf/model.rb
CHANGED
@@ -929,7 +929,14 @@ class SPF::Record
|
|
929
929
|
end
|
930
930
|
|
931
931
|
else
|
932
|
-
|
932
|
+
token_text = @parse_text.sub(/\s.*/, '')
|
933
|
+
hint = nil
|
934
|
+
if token_text =~ /#{SPF::Term::IPV4_ADDRESS_PATTERN}/x
|
935
|
+
hint = 'missing ip4: before IPv4 address?'
|
936
|
+
elsif token_text =~ /#{SPF::Term::IPV6_ADDRESS_PATTERN}/x
|
937
|
+
hint = 'missing ip6: before IPv6 address?'
|
938
|
+
end
|
939
|
+
raise SPF::JunkInRecordError.new("Junk encountered in record '#{@text}'", @text, @parse_text, hint)
|
933
940
|
end
|
934
941
|
@errors.concat(term.errors)
|
935
942
|
return term
|
data/lib/spf/version.rb
CHANGED
data/spf.gemspec
CHANGED