em-http-request 0.2.7 → 0.2.9
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/README.rdoc +29 -11
- data/Rakefile +5 -4
- data/VERSION +1 -1
- data/em-http-request.gemspec +97 -0
- data/examples/fetch.rb +1 -1
- data/examples/websocket-handler.rb +28 -0
- data/examples/websocket-server.rb +8 -0
- data/ext/buffer/em_buffer.c +74 -65
- data/lib/em-http-request.rb +1 -0
- data/lib/em-http.rb +6 -3
- data/lib/em-http/client.rb +114 -90
- data/lib/em-http/core_ext/bytesize.rb +6 -0
- data/lib/em-http/http_options.rb +32 -0
- data/lib/em-http/mock.rb +38 -15
- data/lib/em-http/request.rb +78 -102
- data/spec/mock_spec.rb +49 -4
- data/spec/multi_spec.rb +2 -2
- data/spec/request_spec.rb +67 -10
- data/spec/stallion.rb +10 -6
- metadata +39 -14
data/spec/stallion.rb
CHANGED
@@ -85,13 +85,13 @@ Stallion.saddle :spec do |stable|
|
|
85
85
|
|
86
86
|
elsif stable.request.head?
|
87
87
|
stable.response.status = 200
|
88
|
-
|
88
|
+
|
89
89
|
elsif stable.request.delete?
|
90
90
|
stable.response.status = 200
|
91
|
-
|
91
|
+
|
92
92
|
elsif stable.request.put?
|
93
93
|
stable.response.write stable.request.body.read
|
94
|
-
|
94
|
+
|
95
95
|
elsif stable.request.post?
|
96
96
|
if stable.request.path_info == '/echo_content_type'
|
97
97
|
stable.response.write stable.request.env["CONTENT_TYPE"]
|
@@ -110,6 +110,10 @@ Stallion.saddle :spec do |stable|
|
|
110
110
|
sleep(10)
|
111
111
|
stable.response.write 'timeout'
|
112
112
|
|
113
|
+
elsif stable.request.path_info == '/redirect'
|
114
|
+
stable.response.status = 301
|
115
|
+
stable.response["Location"] = "/gzip"
|
116
|
+
|
113
117
|
elsif stable.request.path_info == '/gzip'
|
114
118
|
io = StringIO.new
|
115
119
|
gzip = Zlib::GzipWriter.new(io)
|
@@ -129,7 +133,7 @@ Stallion.saddle :spec do |stable|
|
|
129
133
|
elsif stable.request.env["HTTP_AUTHORIZATION"]
|
130
134
|
if stable.request.path_info == '/oauth_auth'
|
131
135
|
stable.response.status = 200
|
132
|
-
stable.response.write stable.request.env["HTTP_AUTHORIZATION"]
|
136
|
+
stable.response.write stable.request.env["HTTP_AUTHORIZATION"]
|
133
137
|
else
|
134
138
|
auth = "Basic %s" % Base64.encode64(['user', 'pass'].join(':')).chomp
|
135
139
|
|
@@ -153,7 +157,7 @@ end
|
|
153
157
|
|
154
158
|
Thread.new do
|
155
159
|
begin
|
156
|
-
Stallion.run :Host => '127.0.0.1', :Port => 8080
|
160
|
+
Stallion.run :Host => '127.0.0.1', :Port => 8080
|
157
161
|
rescue Exception => e
|
158
162
|
print e
|
159
163
|
end
|
@@ -205,7 +209,7 @@ Thread.new do
|
|
205
209
|
break
|
206
210
|
end
|
207
211
|
end
|
208
|
-
|
212
|
+
|
209
213
|
while data = client.gets
|
210
214
|
session.write data
|
211
215
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-http-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 9
|
9
|
+
version: 0.2.9
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Ilya Grigorik
|
@@ -9,29 +14,37 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-07-07 00:00:00 -04:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: eventmachine
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 12
|
30
|
+
- 9
|
23
31
|
version: 0.12.9
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: addressable
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 0
|
44
|
+
- 0
|
33
45
|
version: 2.0.0
|
34
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
35
48
|
description: EventMachine based, async HTTP Request interface
|
36
49
|
email: ilya@igvita.com
|
37
50
|
executables: []
|
@@ -48,9 +61,12 @@ files:
|
|
48
61
|
- README.rdoc
|
49
62
|
- Rakefile
|
50
63
|
- VERSION
|
64
|
+
- em-http-request.gemspec
|
51
65
|
- examples/fetch.rb
|
52
66
|
- examples/fibered-http.rb
|
53
67
|
- examples/oauth-tweet.rb
|
68
|
+
- examples/websocket-handler.rb
|
69
|
+
- examples/websocket-server.rb
|
54
70
|
- ext/buffer/em_buffer.c
|
55
71
|
- ext/buffer/extconf.rb
|
56
72
|
- ext/http11_client/ext_help.h
|
@@ -59,10 +75,13 @@ files:
|
|
59
75
|
- ext/http11_client/http11_parser.c
|
60
76
|
- ext/http11_client/http11_parser.h
|
61
77
|
- ext/http11_client/http11_parser.rl
|
78
|
+
- lib/em-http-request.rb
|
62
79
|
- lib/em-http.rb
|
63
80
|
- lib/em-http/client.rb
|
81
|
+
- lib/em-http/core_ext/bytesize.rb
|
64
82
|
- lib/em-http/core_ext/hash.rb
|
65
83
|
- lib/em-http/decoders.rb
|
84
|
+
- lib/em-http/http_options.rb
|
66
85
|
- lib/em-http/mock.rb
|
67
86
|
- lib/em-http/multi.rb
|
68
87
|
- lib/em-http/request.rb
|
@@ -87,18 +106,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
106
|
requirements:
|
88
107
|
- - ">="
|
89
108
|
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
|
109
|
+
segments:
|
110
|
+
- 1
|
111
|
+
- 8
|
112
|
+
- 6
|
113
|
+
version: 1.8.6
|
92
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
115
|
requirements:
|
94
116
|
- - ">="
|
95
117
|
- !ruby/object:Gem::Version
|
118
|
+
segments:
|
119
|
+
- 0
|
96
120
|
version: "0"
|
97
|
-
version:
|
98
121
|
requirements: []
|
99
122
|
|
100
123
|
rubyforge_project: em-http-request
|
101
|
-
rubygems_version: 1.3.
|
124
|
+
rubygems_version: 1.3.6
|
102
125
|
signing_key:
|
103
126
|
specification_version: 3
|
104
127
|
summary: EventMachine based, async HTTP Request interface
|
@@ -113,3 +136,5 @@ test_files:
|
|
113
136
|
- examples/fetch.rb
|
114
137
|
- examples/fibered-http.rb
|
115
138
|
- examples/oauth-tweet.rb
|
139
|
+
- examples/websocket-handler.rb
|
140
|
+
- examples/websocket-server.rb
|