astro-em-http-request 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/em-http/client.rb +6 -11
- data/lib/em-http/request.rb +2 -2
- data/test/test_request.rb +1 -0
- metadata +3 -3
data/lib/em-http/client.rb
CHANGED
@@ -38,7 +38,8 @@ module EventMachine
|
|
38
38
|
|
39
39
|
# Length of content as an integer, or nil if chunked/unspecified
|
40
40
|
def content_length
|
41
|
-
|
41
|
+
@content_length ||= ((s = self[HttpClient::CONTENT_LENGTH]) &&
|
42
|
+
(s =~ /^(\d+)$/)) ? $1.to_i : nil
|
42
43
|
end
|
43
44
|
|
44
45
|
# Cookie header from the server
|
@@ -380,17 +381,11 @@ module EventMachine
|
|
380
381
|
if @response_header.chunked_encoding?
|
381
382
|
@state = :chunk_header
|
382
383
|
elsif @response_header.content_length
|
383
|
-
|
384
|
-
|
385
|
-
@bytes_remaining = @response_header.content_length
|
386
|
-
else
|
387
|
-
@state = :body
|
388
|
-
@bytes_remaining = nil
|
389
|
-
end
|
384
|
+
@state = :body
|
385
|
+
@bytes_remaining = @response_header.content_length
|
390
386
|
else
|
391
|
-
@state = :
|
392
|
-
|
393
|
-
return false
|
387
|
+
@state = :body
|
388
|
+
@bytes_remaining = nil
|
394
389
|
end
|
395
390
|
|
396
391
|
if decoder_class = HttpDecoders.decoder_for_encoding(response_header[CONTENT_ENCODING])
|
data/lib/em-http/request.rb
CHANGED
@@ -72,10 +72,10 @@ module EventMachine
|
|
72
72
|
c.options = options
|
73
73
|
if options.has_key?(:timeout) && options[:timeout]
|
74
74
|
c.comm_inactivity_timeout = options[:timeout]
|
75
|
-
c.pending_connect_timeout = options[:timeout]
|
75
|
+
c.pending_connect_timeout = options[:timeout] if c.respond_to?(:pending_connect_timeout)
|
76
76
|
elsif options.has_key?(:timeout)
|
77
77
|
c.comm_inactivity_timeout = 5
|
78
|
-
c.pending_connect_timeout = 5
|
78
|
+
c.pending_connect_timeout = 5 if c.respond_to?(:pending_connect_timeout)
|
79
79
|
end
|
80
80
|
}
|
81
81
|
rescue RuntimeError => e
|
data/test/test_request.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: astro-em-http-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Grigorik
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-21 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.12.
|
24
|
+
version: 0.12.2
|
25
25
|
version:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: addressable
|