hatetepe 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hatetepe/builder.rb +3 -5
- data/lib/hatetepe/parser.rb +1 -5
- data/lib/hatetepe/version.rb +1 -1
- metadata +5 -5
data/lib/hatetepe/builder.rb
CHANGED
@@ -16,7 +16,7 @@ module Hatetepe
|
|
16
16
|
return message.empty? ? nil : message
|
17
17
|
end
|
18
18
|
|
19
|
-
attr_reader :state
|
19
|
+
attr_reader :state
|
20
20
|
|
21
21
|
def initialize(&block)
|
22
22
|
reset
|
@@ -30,7 +30,6 @@ module Hatetepe
|
|
30
30
|
def reset
|
31
31
|
@state = :ready
|
32
32
|
@chunked = true
|
33
|
-
@bytes_written = 0
|
34
33
|
end
|
35
34
|
|
36
35
|
[:write, :complete, :error].each do |hook|
|
@@ -129,17 +128,16 @@ module Hatetepe
|
|
129
128
|
return if ready?
|
130
129
|
|
131
130
|
if writing_body? && chunked?
|
132
|
-
write "0\r\n
|
131
|
+
write "0\r\n"
|
133
132
|
elsif writing_headers? || writing_trailing_headers?
|
134
133
|
write "\r\n"
|
135
134
|
end
|
136
135
|
|
137
|
-
on_complete.each {|blk| blk.call
|
136
|
+
on_complete.each {|blk| blk.call }
|
138
137
|
reset
|
139
138
|
end
|
140
139
|
|
141
140
|
def write(chunk)
|
142
|
-
@bytes_written += chunk.length
|
143
141
|
on_write.each {|blk| blk.call(chunk) }
|
144
142
|
end
|
145
143
|
|
data/lib/hatetepe/parser.rb
CHANGED
@@ -32,8 +32,6 @@ module Hatetepe
|
|
32
32
|
message
|
33
33
|
end
|
34
34
|
|
35
|
-
attr_reader :bytes_read
|
36
|
-
|
37
35
|
def initialize(&block)
|
38
36
|
@on_request, @on_response = [], []
|
39
37
|
@on_header, @on_headers_complete = [], []
|
@@ -63,7 +61,7 @@ module Hatetepe
|
|
63
61
|
end
|
64
62
|
|
65
63
|
@parser.on_message_complete = proc do
|
66
|
-
on_complete.each {|f| f.call
|
64
|
+
on_complete.each {|f| f.call }
|
67
65
|
end
|
68
66
|
|
69
67
|
reset
|
@@ -75,7 +73,6 @@ module Hatetepe
|
|
75
73
|
|
76
74
|
def reset
|
77
75
|
@parser.reset!
|
78
|
-
@bytes_read = 0
|
79
76
|
end
|
80
77
|
|
81
78
|
[:request, :response, :header, :headers_complete,
|
@@ -88,7 +85,6 @@ module Hatetepe
|
|
88
85
|
end
|
89
86
|
|
90
87
|
def <<(data)
|
91
|
-
@bytes_read += data.length
|
92
88
|
@parser << data
|
93
89
|
rescue HTTP::Parser::Error => original_error
|
94
90
|
error = ParserError.new(original_error.message)
|
data/lib/hatetepe/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: hatetepe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Lars Gierth
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-24 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http_parser.rb
|
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
74
|
+
hash: -831692159
|
75
75
|
segments:
|
76
76
|
- 0
|
77
77
|
version: "0"
|
@@ -80,14 +80,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
hash:
|
83
|
+
hash: -831692159
|
84
84
|
segments:
|
85
85
|
- 0
|
86
86
|
version: "0"
|
87
87
|
requirements: []
|
88
88
|
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.8.
|
90
|
+
rubygems_version: 1.8.5
|
91
91
|
signing_key:
|
92
92
|
specification_version: 3
|
93
93
|
summary: Builds and parses HTTP messages
|