ffi-http-parser 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.md +7 -0
- data/README.md +1 -1
- data/lib/ffi/http/parser/instance.rb +9 -3
- data/lib/ffi/http/parser/version.rb +1 -3
- data/spec/instance_spec.rb +10 -10
- metadata +2 -2
data/ChangeLog.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 0.2.0 / 2012-06-25
|
2
|
+
|
3
|
+
* Default {FFI::HTTP::Parser::Instance#type} to `:both`, for compatibility
|
4
|
+
with [http-parser-lite].
|
5
|
+
* {FFI::HTTP::Parser::Instance#reset!} now accepts a new type argument,
|
6
|
+
for compatibility with [http-parser-lite].
|
7
|
+
|
1
8
|
### 0.1.0 / 2012-06-23
|
2
9
|
|
3
10
|
* Initial release:
|
data/README.md
CHANGED
@@ -43,7 +43,10 @@ module FFI
|
|
43
43
|
#
|
44
44
|
def initialize(ptr=nil)
|
45
45
|
if ptr then super(ptr)
|
46
|
-
else
|
46
|
+
else
|
47
|
+
super()
|
48
|
+
|
49
|
+
self.type = :both
|
47
50
|
end
|
48
51
|
|
49
52
|
@settings = Settings.new
|
@@ -233,8 +236,11 @@ module FFI
|
|
233
236
|
#
|
234
237
|
# Resets the parser.
|
235
238
|
#
|
236
|
-
|
237
|
-
|
239
|
+
# @param [:request, :response, :both] new_type
|
240
|
+
# The new type for the parser.
|
241
|
+
#
|
242
|
+
def reset!(new_type=self.type)
|
243
|
+
Parser.http_parser_init(self,new_type)
|
238
244
|
end
|
239
245
|
|
240
246
|
alias reset reset!
|
data/spec/instance_spec.rb
CHANGED
@@ -35,37 +35,37 @@ describe Instance do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "#type" do
|
38
|
-
it "should default to :
|
39
|
-
subject.type.should == :
|
38
|
+
it "should default to :both" do
|
39
|
+
subject.type.should == :both
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should convert the type to a Symbol" do
|
43
|
-
subject[:type_flags] = TYPES[:
|
43
|
+
subject[:type_flags] = TYPES[:request]
|
44
44
|
|
45
|
-
subject.type.should == :
|
45
|
+
subject.type.should == :request
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should extract the type from the type_flags field" do
|
49
|
-
subject[:type_flags] = ((0xff & ~0x3) | TYPES[:
|
49
|
+
subject[:type_flags] = ((0xff & ~0x3) | TYPES[:response])
|
50
50
|
|
51
|
-
subject.type.should == :
|
51
|
+
subject.type.should == :response
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "#type=" do
|
56
56
|
it "should set the type" do
|
57
|
-
subject.type = :
|
57
|
+
subject.type = :response
|
58
58
|
|
59
|
-
subject.type.should == :
|
59
|
+
subject.type.should == :response
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should not change flags" do
|
63
63
|
flags = (0xff & ~0x3)
|
64
64
|
subject[:type_flags] = flags
|
65
65
|
|
66
|
-
subject.type = :
|
66
|
+
subject.type = :request
|
67
67
|
|
68
|
-
subject[:type_flags].should == (flags | TYPES[:
|
68
|
+
subject[:type_flags].should == (flags | TYPES[:request])
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-http-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|