em-http-request 1.0.0.beta.1 → 1.0.0.beta.2
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/examples/socks5.rb +2 -5
- data/lib/em-http/client.rb +0 -1
- data/lib/em-http/http_connection.rb +6 -1
- data/lib/em-http/http_encoding.rb +1 -1
- data/lib/em-http/version.rb +1 -1
- data/spec/client_spec.rb +13 -0
- metadata +4 -41
data/examples/socks5.rb
CHANGED
@@ -6,11 +6,8 @@ EM.run do
|
|
6
6
|
# Establish a SOCKS5 tunnel via SSH
|
7
7
|
# ssh -D 8000 some_remote_machine
|
8
8
|
|
9
|
-
|
10
|
-
http = EM::HttpRequest.new('http://igvita.com/').get
|
11
|
-
:proxy => {:host => '127.0.0.1', :port => 8000, :type => :socks},
|
12
|
-
:redirects => 2
|
13
|
-
})
|
9
|
+
connection_options = {:proxy => {:host => '127.0.0.1', :port => 8000, :type => :socks5}}
|
10
|
+
http = EM::HttpRequest.new('http://igvita.com/', connection_options).get :redirects => 2
|
14
11
|
|
15
12
|
http.callback {
|
16
13
|
puts "#{http.response_header.status} - #{http.response.length} bytes\n"
|
data/lib/em-http/client.rb
CHANGED
@@ -103,7 +103,6 @@ module EventMachine
|
|
103
103
|
|
104
104
|
def proxy?; !@options[:proxy].nil?; end
|
105
105
|
def http_proxy?; proxy? && [nil, :http].include?(@options[:proxy][:type]); end
|
106
|
-
def socks_proxy?; proxy? && (@options[:proxy][:type] == :socks); end
|
107
106
|
|
108
107
|
def continue?
|
109
108
|
@response_header.status == 100 && (@method == 'POST' || @method == 'PUT')
|
@@ -51,7 +51,7 @@ module EventMachine
|
|
51
51
|
|
52
52
|
# Non CONNECT proxies require that you provide the full request
|
53
53
|
# uri in request header, as opposed to a relative path.
|
54
|
-
query = uri.join(query) if proxy
|
54
|
+
query = uri.join(query) if proxy
|
55
55
|
|
56
56
|
HTTP_REQUEST_HEADER % [method.to_s.upcase, query]
|
57
57
|
end
|
data/lib/em-http/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -558,6 +558,19 @@ describe EventMachine::HttpRequest do
|
|
558
558
|
}
|
559
559
|
}
|
560
560
|
end
|
561
|
+
|
562
|
+
it "should handle invalid HTTP response" do
|
563
|
+
EventMachine.run {
|
564
|
+
@s = StubServer.new("<html></html>")
|
565
|
+
|
566
|
+
http = EventMachine::HttpRequest.new('http://127.0.0.1:8081/').get
|
567
|
+
http.callback { failed(http) }
|
568
|
+
http.errback {
|
569
|
+
http.error.should_not be_nil
|
570
|
+
EM.stop
|
571
|
+
}
|
572
|
+
}
|
573
|
+
end
|
561
574
|
end
|
562
575
|
|
563
576
|
it "should stream a file off disk" do
|
metadata
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-http-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- beta
|
10
|
-
- 1
|
11
|
-
version: 1.0.0.beta.1
|
4
|
+
prerelease: 6
|
5
|
+
version: 1.0.0.beta.2
|
12
6
|
platform: ruby
|
13
7
|
authors:
|
14
8
|
- Ilya Grigorik
|
@@ -16,7 +10,7 @@ autorequire:
|
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
12
|
|
19
|
-
date: 2011-
|
13
|
+
date: 2011-03-10 00:00:00 -05:00
|
20
14
|
default_executable:
|
21
15
|
dependencies:
|
22
16
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +21,6 @@ dependencies:
|
|
27
21
|
requirements:
|
28
22
|
- - ">="
|
29
23
|
- !ruby/object:Gem::Version
|
30
|
-
segments:
|
31
|
-
- 0
|
32
24
|
version: "0"
|
33
25
|
type: :runtime
|
34
26
|
version_requirements: *id001
|
@@ -40,10 +32,6 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 2
|
45
|
-
- 2
|
46
|
-
- 3
|
47
35
|
version: 2.2.3
|
48
36
|
type: :runtime
|
49
37
|
version_requirements: *id002
|
@@ -55,10 +43,6 @@ dependencies:
|
|
55
43
|
requirements:
|
56
44
|
- - ">="
|
57
45
|
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
- 5
|
61
|
-
- 1
|
62
46
|
version: 0.5.1
|
63
47
|
type: :runtime
|
64
48
|
version_requirements: *id003
|
@@ -70,8 +54,6 @@ dependencies:
|
|
70
54
|
requirements:
|
71
55
|
- - ">="
|
72
56
|
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 0
|
75
57
|
version: "0"
|
76
58
|
type: :runtime
|
77
59
|
version_requirements: *id004
|
@@ -83,8 +65,6 @@ dependencies:
|
|
83
65
|
requirements:
|
84
66
|
- - ">="
|
85
67
|
- !ruby/object:Gem::Version
|
86
|
-
segments:
|
87
|
-
- 0
|
88
68
|
version: "0"
|
89
69
|
type: :development
|
90
70
|
version_requirements: *id005
|
@@ -96,8 +76,6 @@ dependencies:
|
|
96
76
|
requirements:
|
97
77
|
- - ">="
|
98
78
|
- !ruby/object:Gem::Version
|
99
|
-
segments:
|
100
|
-
- 0
|
101
79
|
version: "0"
|
102
80
|
type: :development
|
103
81
|
version_requirements: *id006
|
@@ -109,8 +87,6 @@ dependencies:
|
|
109
87
|
requirements:
|
110
88
|
- - ">="
|
111
89
|
- !ruby/object:Gem::Version
|
112
|
-
segments:
|
113
|
-
- 0
|
114
90
|
version: "0"
|
115
91
|
type: :development
|
116
92
|
version_requirements: *id007
|
@@ -122,8 +98,6 @@ dependencies:
|
|
122
98
|
requirements:
|
123
99
|
- - ">="
|
124
100
|
- !ruby/object:Gem::Version
|
125
|
-
segments:
|
126
|
-
- 0
|
127
101
|
version: "0"
|
128
102
|
type: :development
|
129
103
|
version_requirements: *id008
|
@@ -135,11 +109,6 @@ dependencies:
|
|
135
109
|
requirements:
|
136
110
|
- - ~>
|
137
111
|
- !ruby/object:Gem::Version
|
138
|
-
segments:
|
139
|
-
- 1
|
140
|
-
- 2
|
141
|
-
- 0
|
142
|
-
- pre2
|
143
112
|
version: 1.2.0.pre2
|
144
113
|
type: :development
|
145
114
|
version_requirements: *id009
|
@@ -205,23 +174,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
174
|
requirements:
|
206
175
|
- - ">="
|
207
176
|
- !ruby/object:Gem::Version
|
208
|
-
segments:
|
209
|
-
- 0
|
210
177
|
version: "0"
|
211
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
179
|
none: false
|
213
180
|
requirements:
|
214
181
|
- - ">"
|
215
182
|
- !ruby/object:Gem::Version
|
216
|
-
segments:
|
217
|
-
- 1
|
218
|
-
- 3
|
219
|
-
- 1
|
220
183
|
version: 1.3.1
|
221
184
|
requirements: []
|
222
185
|
|
223
186
|
rubyforge_project: em-http-request
|
224
|
-
rubygems_version: 1.
|
187
|
+
rubygems_version: 1.6.2
|
225
188
|
signing_key:
|
226
189
|
specification_version: 3
|
227
190
|
summary: EventMachine based, async HTTP Request client
|