uv-rays 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uv-rays/http/request.rb +2 -1
- data/lib/uv-rays/http/response.rb +16 -0
- data/lib/uv-rays/http_endpoint.rb +5 -4
- data/lib/uv-rays/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2657776098e13718ff15b3287beff32c21e9d2ca
|
4
|
+
data.tar.gz: ba3c9990093f70c4071d1f042a224e1ef62fdaf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf924b2e2ab747a0b6baaa25834f77979a4972e47804c62a5a34a6b87bd9af41bacb2dbb36c699e19bb3dd28cdf46a67d138caf566a746bdba03fc116a416397
|
7
|
+
data.tar.gz: 69cdaae133b6e57ccd090fb2b97df68e43738ebe8e9f29891ec1f0eafda88f4ae4ec31bd13f361e91cba005150381f8c87834361b3bd81c79872f09b3bde9794
|
data/lib/uv-rays/http/request.rb
CHANGED
@@ -11,6 +11,7 @@ module UV
|
|
11
11
|
|
12
12
|
attr_reader :path
|
13
13
|
attr_reader :method
|
14
|
+
attr_reader :headers
|
14
15
|
|
15
16
|
|
16
17
|
def cookies_hash
|
@@ -97,7 +98,7 @@ module UV
|
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
100
|
-
def
|
101
|
+
def on_headers(callback, &blk)
|
101
102
|
callback ||= blk
|
102
103
|
if @headers.nil?
|
103
104
|
@headers_callback = callback
|
@@ -22,6 +22,10 @@ module UV
|
|
22
22
|
@state.type = :response
|
23
23
|
end
|
24
24
|
|
25
|
+
|
26
|
+
attr_reader :request
|
27
|
+
|
28
|
+
|
25
29
|
# Called on connection disconnect
|
26
30
|
def reset!
|
27
31
|
@state.reset!
|
@@ -33,6 +37,7 @@ module UV
|
|
33
37
|
if @parser.parse(@state, data)
|
34
38
|
if @request
|
35
39
|
@request.reject(@state.error)
|
40
|
+
@request = nil
|
36
41
|
return true
|
37
42
|
#else # silently fail here
|
38
43
|
# p 'parse error and no request..'
|
@@ -114,6 +119,17 @@ module UV
|
|
114
119
|
@request = nil
|
115
120
|
@body = nil
|
116
121
|
end
|
122
|
+
|
123
|
+
# We need to flush the response on disconnect if content-length is undefined
|
124
|
+
# As per the HTTP spec
|
125
|
+
def eof
|
126
|
+
if @headers.nil? && @request.headers[:'Content-Length'].nil?
|
127
|
+
on_message_complete(nil)
|
128
|
+
else
|
129
|
+
# Reject if this is a partial response
|
130
|
+
@request.reject(:partial_response)
|
131
|
+
end
|
132
|
+
end
|
117
133
|
end
|
118
134
|
end
|
119
135
|
end
|
@@ -55,7 +55,7 @@ module UV
|
|
55
55
|
|
56
56
|
|
57
57
|
uri = uri.kind_of?(Addressable::URI) ? uri : Addressable::URI::parse(uri.to_s)
|
58
|
-
@https = uri.scheme == "https"
|
58
|
+
@https = uri.scheme == "https"
|
59
59
|
uri.port ||= (@https ? 443 : 80)
|
60
60
|
@scheme = @https ? HTTPS : HTTP
|
61
61
|
|
@@ -152,6 +152,9 @@ module UV
|
|
152
152
|
@connecting = false
|
153
153
|
stop_timer
|
154
154
|
|
155
|
+
# Flush any processing request
|
156
|
+
@response.eof if @response.request
|
157
|
+
|
155
158
|
# Reject any requests waiting on a response
|
156
159
|
@pending_responses.each do |request|
|
157
160
|
request.reject(:disconnected)
|
@@ -220,9 +223,7 @@ module UV
|
|
220
223
|
def connect_timeout
|
221
224
|
@timer.stop
|
222
225
|
@transport.close
|
223
|
-
@connection_pending.
|
224
|
-
request.reject(:connection_timeout)
|
225
|
-
end
|
226
|
+
@connection_pending.clear
|
226
227
|
end
|
227
228
|
|
228
229
|
def idle_timeout
|
data/lib/uv-rays/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uv-rays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libuv
|