redns 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/lib/redns/buffer.rb CHANGED
@@ -136,6 +136,6 @@ class ReDNS::Buffer < String
136
136
  end
137
137
 
138
138
  def inspect
139
- "\#<#{self.class} #{to_s.inspect}>"
139
+ "\#<#{self.class} [#{to_s.bytes.collect { |c| '%02x' % c }.join(' ')}]>"
140
140
  end
141
141
  end
data/lib/redns/name.rb CHANGED
@@ -61,7 +61,7 @@ class ReDNS::Name < ReDNS::Fragment
61
61
 
62
62
  pointer = (c & 0x3F << 8) | buffer.unpack('C')[0]
63
63
 
64
- return_to_offset = buffer.offset
64
+ return_to_offset ||= buffer.offset
65
65
  buffer.rewind
66
66
  buffer.advance(pointer)
67
67
  elsif (c == 0)
@@ -1,8 +1,6 @@
1
1
  class ReDNS::Question < ReDNS::Fragment
2
2
  # == Constants ============================================================
3
3
 
4
- SECTIONS = [ :questions, :answers, :nameservers, :additional_records ]
5
-
6
4
  # == Attributes ===========================================================
7
5
 
8
6
  attribute :name, :class => ReDNS::Name, :default => lambda { ReDNS::Name.new }
data/redns.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{redns}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tadman"]
@@ -81,4 +81,28 @@ class TestReDNSName < Test::Unit::TestCase
81
81
 
82
82
  assert_equal 0, example_buffer.length
83
83
  end
84
+
85
+ def test_double_pointer
86
+ example_buffer = ReDNS::Buffer.new(
87
+ [
88
+ 3, ?c, ?o, ?m,
89
+ 192, 6,
90
+ 3, ?n, ?e, ?t,
91
+ 0,
92
+ 7, ?e, ?x, ?a, ?m, ?p, ?l, ?e,
93
+ 192, 0
94
+ ].collect(&:chr).join
95
+ )
96
+
97
+ # Skip past the first "net." / "com." part
98
+ example_buffer.advance(11)
99
+
100
+ name = ReDNS::Name.new(example_buffer)
101
+
102
+ assert_equal 'example.com.net.', name.to_s
103
+
104
+ assert !name.empty?
105
+
106
+ assert_equal 0, example_buffer.length
107
+ end
84
108
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - tadman