cool.io-http 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +5 -0
- data/README.md +11 -8
- data/cool.io-http.gemspec +1 -1
- data/lib/cool.io-http/version.rb +1 -1
- data/lib/cool.io/http.rb +5 -1
- data/lib/cool.io/http/ssl.rb +2 -0
- data/test/test_http.rb +4 -3
- metadata +5 -5
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## cool.io-http 0.3.0 -- 2012-01-09
|
4
|
+
|
5
|
+
* Introduced `Coolio::Http::Response`. So now instead of passing
|
6
|
+
response and headers to the callback, we pass `Coolio::Http::Response`.
|
7
|
+
|
3
8
|
## cool.io-http 0.2.1 -- 2012-01-09
|
4
9
|
|
5
10
|
* Added SSL (HTTPS) supports
|
data/README.md
CHANGED
@@ -16,8 +16,9 @@ Simpler HTTP for [cool.io][]
|
|
16
16
|
|
17
17
|
## REQUIREMENTS:
|
18
18
|
|
19
|
-
* cool.io
|
20
|
-
* mime-types
|
19
|
+
* gem cool.io
|
20
|
+
* gem mime-types
|
21
|
+
* openssl
|
21
22
|
|
22
23
|
## INSTALLATION:
|
23
24
|
|
@@ -29,10 +30,11 @@ Asynchrony client:
|
|
29
30
|
|
30
31
|
require 'cool.io/http'
|
31
32
|
|
32
|
-
Coolio::Http.request(:url => 'https://google.com'){ |response
|
33
|
-
puts "Response: #{response}"
|
33
|
+
Coolio::Http.request(:url => 'https://google.com'){ |response|
|
34
|
+
puts "Response: #{response.body}"
|
34
35
|
puts
|
35
|
-
puts " Headers: #{headers}"
|
36
|
+
puts " Headers: #{response.headers}"
|
37
|
+
puts " Status: #{response.status}"
|
36
38
|
}
|
37
39
|
|
38
40
|
Coolio::Loop.default.run
|
@@ -42,10 +44,11 @@ Fiber-aware synchrony client:
|
|
42
44
|
require 'cool.io/http'
|
43
45
|
|
44
46
|
Fiber.new{
|
45
|
-
Coolio::HttpFiber.request(:url => 'https://google.com'){ |
|
46
|
-
puts "Response: #{
|
47
|
+
Coolio::HttpFiber.request(:url => 'https://google.com'){ |response|
|
48
|
+
puts "Response: #{response.body}"
|
47
49
|
puts
|
48
|
-
puts " Headers: #{
|
50
|
+
puts " Headers: #{response.headers}"
|
51
|
+
puts " Status: #{response.status}"
|
49
52
|
}
|
50
53
|
puts "DONE"
|
51
54
|
}.resume
|
data/cool.io-http.gemspec
CHANGED
data/lib/cool.io-http/version.rb
CHANGED
data/lib/cool.io/http.rb
CHANGED
@@ -10,6 +10,8 @@ module Coolio
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class Coolio::Http < Coolio::HttpClient
|
13
|
+
Response = Struct.new(:body, :headers, :status)
|
14
|
+
|
13
15
|
def self.request opts={}, &block
|
14
16
|
method = opts[:method] || opts['method'] || :get
|
15
17
|
url = opts[:url] || opts['url']
|
@@ -62,7 +64,9 @@ class Coolio::Http < Coolio::HttpClient
|
|
62
64
|
|
63
65
|
def on_request_complete
|
64
66
|
super
|
65
|
-
@http_callback.call(@http_data.join,
|
67
|
+
@http_callback.call(Response.new(@http_data.join,
|
68
|
+
@http_response_header,
|
69
|
+
@http_response_header.http_status))
|
66
70
|
end
|
67
71
|
|
68
72
|
def on_connect
|
data/lib/cool.io/http/ssl.rb
CHANGED
data/test/test_http.rb
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
require 'cool.io/http'
|
3
3
|
|
4
4
|
def request klass, url
|
5
|
-
klass.request(:url => url){ |response
|
6
|
-
puts "Response: #{response}"
|
5
|
+
klass.request(:url => url){ |response|
|
6
|
+
puts "Response: #{response.body}"
|
7
7
|
puts
|
8
|
-
puts " Headers: #{headers}"
|
8
|
+
puts " Headers: #{response.headers}"
|
9
|
+
puts " Status: #{response.status}"
|
9
10
|
}
|
10
11
|
end
|
11
12
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cool.io-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cool.io
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152924280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152924280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mime-types
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152939800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152939800
|
36
36
|
description: ! 'Simpler HTTP for [cool.io][]
|
37
37
|
|
38
38
|
|