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 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
- raise SPF::JunkInRecordError.new("Junk encountered in record '#{@text}'", @text, @parse_text)
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
@@ -1,5 +1,5 @@
1
1
  module SPF
2
- VERSION = '0.0.29'
2
+ VERSION = '0.0.30'
3
3
  end
4
4
 
5
5
  # vim:sw=2 sts=2
data/spf.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "spf"
8
- s.version = "0.0.29"
8
+ s.version = "0.0.30"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Flury", "Julian Mehnle"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.30
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: