remcached 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 4
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 0
@@ -80,7 +80,11 @@ module Memcached
80
80
  #
81
81
  # return:: [String] remaining bytes
82
82
  def parse_body(buf)
83
- buf, rest = buf[0..(self[:total_body_length] - 1)], buf[self[:total_body_length]..-1]
83
+ if self[:total_body_length] < 1
84
+ buf, rest = "", buf
85
+ else
86
+ buf, rest = buf[0..(self[:total_body_length] - 1)], buf[self[:total_body_length]..-1]
87
+ end
84
88
 
85
89
  if self[:extras_length] > 0
86
90
  self[:extras] = parse_extras(buf[0..(self[:extras_length]-1)])
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{remcached}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Stephan Maka"]
12
- s.date = %q{2009-10-14}
12
+ s.date = %q{2009-11-03}
13
13
  s.description = %q{Ruby EventMachine memcached client}
14
14
  s.email = %q{astro@spaceboyz.net}
15
15
  s.extra_rdoc_files = [
@@ -121,5 +121,23 @@ describe Memcached::Packet do
121
121
  @pkt[:value].should == "World"
122
122
  end
123
123
  end
124
+
125
+ describe :parse_body do
126
+ it "should return succeeding bytes" do
127
+ s = "\x81\x01\x00\x00" +
128
+ "\x00\x00\x00\x00" +
129
+ "\x00\x00\x00\x00" +
130
+ "\x00\x00\x00\x00" +
131
+ "\x00\x00\x00\x00" +
132
+ "\x00\x00\x00\x01" +
133
+ "chunky bacon"
134
+ @pkt = Memcached::Response.parse_header(s[0..23])
135
+ s = @pkt.parse_body(s[24..-1])
136
+ @pkt[:status].should == 0
137
+ @pkt[:total_body_length].should == 0
138
+ @pkt[:value].should == ""
139
+ s.should == "chunky bacon"
140
+ end
141
+ end
124
142
  end
125
143
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remcached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Maka
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-14 00:00:00 +02:00
12
+ date: 2009-11-03 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15