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.

@@ -1,19 +1,39 @@
1
1
  class StubServer
2
2
  module Server
3
3
  def receive_data(data)
4
- send_data @response
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(response, port=8081)
14
- @sig = EventMachine::start_server("127.0.0.1", port, Server) { |s|
15
- s.response = response
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.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: 2011-08-27 00:00:00.000000000Z
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: &2152766660 !ruby/object:Gem::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.3
21
+ version: 1.0.0.beta.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152766660
24
+ version_requirements: *2156935760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: addressable
27
- requirement: &2152766160 !ruby/object:Gem::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: *2152766160
35
+ version_requirements: *2156935240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: http_parser.rb
38
- requirement: &2152765700 !ruby/object:Gem::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.2
43
+ version: 0.5.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2152765700
46
+ version_requirements: *2156934560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: em-socksify
49
- requirement: &2152765320 !ruby/object:Gem::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: *2152765320
57
+ version_requirements: *2156933980
58
58
  - !ruby/object:Gem::Dependency
59
- name: rspec
60
- requirement: &2152764860 !ruby/object:Gem::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: :development
66
+ type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2152764860
68
+ version_requirements: *2156933500
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: &2152764440 !ruby/object:Gem::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: *2152764440
79
+ version_requirements: *2156932920
80
80
  - !ruby/object:Gem::Dependency
81
- name: rack
82
- requirement: &2152764020 !ruby/object:Gem::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: *2152764020
90
+ version_requirements: *2156932360
91
91
  - !ruby/object:Gem::Dependency
92
- name: yajl-ruby
93
- requirement: &2152763600 !ruby/object:Gem::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: *2152763600
101
+ version_requirements: *2156931580
102
102
  - !ruby/object:Gem::Dependency
103
- name: cookiejar
104
- requirement: &2152763180 !ruby/object:Gem::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: *2152763180
112
+ version_requirements: *2156930800
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: mongrel
115
- requirement: &2152762680 !ruby/object:Gem::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: *2152762680
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.5
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: