em-http-request 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of em-http-request might be problematic. Click here for more details.
- data/.gitignore +2 -0
- data/README.md +4 -2
- data/em-http-request.gemspec +33 -33
- data/examples/fibered-http.rb +51 -47
- data/lib/em-http/client.rb +307 -275
- data/lib/em-http/http_client_options.rb +1 -0
- data/lib/em-http/http_connection.rb +199 -194
- data/lib/em-http/http_connection_options.rb +6 -1
- data/lib/em-http/http_encoding.rb +2 -2
- data/lib/em-http/http_header.rb +4 -0
- data/lib/em-http/http_status_codes.rb +51 -37
- data/lib/em-http/multi.rb +4 -2
- data/lib/em-http/version.rb +5 -5
- data/spec/client_fiber_spec.rb +21 -0
- data/spec/client_spec.rb +734 -669
- data/spec/encoding_spec.rb +11 -2
- data/spec/external_spec.rb +128 -127
- data/spec/helper.rb +2 -2
- data/spec/multi_spec.rb +9 -1
- data/spec/pipelining_spec.rb +66 -38
- data/spec/redirect_spec.rb +55 -3
- data/spec/socksify_proxy_spec.rb +24 -24
- data/spec/stallion.rb +273 -270
- data/spec/stub_server.rb +25 -5
- metadata +34 -31
data/spec/stub_server.rb
CHANGED
@@ -1,19 +1,39 @@
|
|
1
1
|
class StubServer
|
2
2
|
module Server
|
3
3
|
def receive_data(data)
|
4
|
-
|
4
|
+
if echo?
|
5
|
+
send_data("HTTP/1.0 200 OK\r\nContent-Length: #{data.bytesize}\r\nContent-Type: text/plain\r\n\r\n")
|
6
|
+
send_data(data)
|
7
|
+
else
|
8
|
+
send_data @response
|
9
|
+
end
|
10
|
+
|
5
11
|
close_connection_after_writing
|
6
12
|
end
|
7
13
|
|
14
|
+
def echo= flag
|
15
|
+
@echo = flag
|
16
|
+
end
|
17
|
+
|
18
|
+
def echo?
|
19
|
+
!!@echo
|
20
|
+
end
|
21
|
+
|
8
22
|
def response=(response)
|
9
23
|
@response = response
|
10
24
|
end
|
11
25
|
end
|
12
26
|
|
13
|
-
def initialize
|
14
|
-
|
15
|
-
|
16
|
-
|
27
|
+
def initialize options = {}
|
28
|
+
options = {:response => options} if options.kind_of?(String)
|
29
|
+
options = {:port => 8081, :host => '127.0.0.1'}.merge(options)
|
30
|
+
|
31
|
+
host = options[:host]
|
32
|
+
port = options[:port]
|
33
|
+
@sig = EventMachine::start_server(host, port, Server) do |server|
|
34
|
+
server.response = options[:response]
|
35
|
+
server.echo = options[:echo]
|
36
|
+
end
|
17
37
|
end
|
18
38
|
|
19
39
|
def stop
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-http-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156935760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.0.beta.
|
21
|
+
version: 1.0.0.beta.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156935760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: addressable
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156935240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,21 +32,21 @@ dependencies:
|
|
32
32
|
version: 2.2.3
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156935240
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: http_parser.rb
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156934560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.5.
|
43
|
+
version: 0.5.3
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156934560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: em-socksify
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156933980 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,21 +54,21 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156933980
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement: &
|
59
|
+
name: cookiejar
|
60
|
+
requirement: &2156933500 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
|
-
type: :
|
66
|
+
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156933500
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: &
|
70
|
+
name: rspec
|
71
|
+
requirement: &2156932920 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2156932920
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement: &
|
81
|
+
name: rake
|
82
|
+
requirement: &2156932360 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2156932360
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
|
-
name:
|
93
|
-
requirement: &
|
92
|
+
name: rack
|
93
|
+
requirement: &2156931580 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2156931580
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
104
|
-
requirement: &
|
103
|
+
name: yajl-ruby
|
104
|
+
requirement: &2156930800 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2156930800
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: mongrel
|
115
|
-
requirement: &
|
115
|
+
requirement: &2156930040 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: 1.2.0.pre2
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2156930040
|
124
124
|
description: EventMachine based, async HTTP Request client
|
125
125
|
email:
|
126
126
|
- ilya@igvita.com
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/em-http/multi.rb
|
164
164
|
- lib/em-http/request.rb
|
165
165
|
- lib/em-http/version.rb
|
166
|
+
- spec/client_fiber_spec.rb
|
166
167
|
- spec/client_spec.rb
|
167
168
|
- spec/dns_spec.rb
|
168
169
|
- spec/encoding_spec.rb
|
@@ -198,11 +199,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
199
|
version: '0'
|
199
200
|
requirements: []
|
200
201
|
rubyforge_project: em-http-request
|
201
|
-
rubygems_version: 1.8.
|
202
|
+
rubygems_version: 1.8.10
|
202
203
|
signing_key:
|
203
204
|
specification_version: 3
|
204
205
|
summary: EventMachine based, async HTTP Request client
|
205
206
|
test_files:
|
207
|
+
- spec/client_fiber_spec.rb
|
206
208
|
- spec/client_spec.rb
|
207
209
|
- spec/dns_spec.rb
|
208
210
|
- spec/encoding_spec.rb
|
@@ -218,3 +220,4 @@ test_files:
|
|
218
220
|
- spec/ssl_spec.rb
|
219
221
|
- spec/stallion.rb
|
220
222
|
- spec/stub_server.rb
|
223
|
+
has_rdoc:
|