em-http-request 1.0.0.beta.2 → 1.0.0.beta.3
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/lib/em-http/client.rb +2 -0
- data/lib/em-http/http_connection.rb +9 -3
- data/lib/em-http/version.rb +1 -1
- data/spec/external_spec.rb +12 -0
- data/spec/helper.rb +1 -1
- metadata +2 -2
data/lib/em-http/client.rb
CHANGED
@@ -104,6 +104,8 @@ module EventMachine
|
|
104
104
|
def proxy?; !@options[:proxy].nil?; end
|
105
105
|
def http_proxy?; proxy? && [nil, :http].include?(@options[:proxy][:type]); end
|
106
106
|
|
107
|
+
def ssl?; @req.uri.scheme == "https" || @req.uri.port == 443; end
|
108
|
+
|
107
109
|
def continue?
|
108
110
|
@response_header.status == 100 && (@method == 'POST' || @method == 'PUT')
|
109
111
|
end
|
@@ -87,7 +87,8 @@ module EventMachine
|
|
87
87
|
|
88
88
|
def connection_completed
|
89
89
|
if @opts.proxy && @opts.proxy[:type] == :socks5
|
90
|
-
socksify(
|
90
|
+
socksify(client.req.uri.host, client.req.uri.port, *@opts.proxy[:authorization]) { start }
|
91
|
+
|
91
92
|
else
|
92
93
|
start
|
93
94
|
end
|
@@ -95,7 +96,7 @@ module EventMachine
|
|
95
96
|
|
96
97
|
def start
|
97
98
|
ssl = @opts.options[:tls] || @opts.options[:ssl] || {}
|
98
|
-
start_tls(ssl) if
|
99
|
+
start_tls(ssl) if client && client.ssl?
|
99
100
|
|
100
101
|
succeed
|
101
102
|
end
|
@@ -124,7 +125,12 @@ module EventMachine
|
|
124
125
|
@clients.pop.close(e.message)
|
125
126
|
end
|
126
127
|
end
|
127
|
-
|
128
128
|
end
|
129
|
+
|
130
|
+
private
|
131
|
+
|
132
|
+
def client
|
133
|
+
@clients.first
|
134
|
+
end
|
129
135
|
end
|
130
136
|
end
|
data/lib/em-http/version.rb
CHANGED
data/spec/external_spec.rb
CHANGED
@@ -15,6 +15,18 @@ requires_connection do
|
|
15
15
|
}
|
16
16
|
end
|
17
17
|
|
18
|
+
it "should follow redirect to https and initiate the handshake" do
|
19
|
+
EventMachine.run {
|
20
|
+
http = EventMachine::HttpRequest.new('http://analytics.postrank.com/').get :redirects => 5
|
21
|
+
|
22
|
+
http.errback { failed(http) }
|
23
|
+
http.callback {
|
24
|
+
http.response_header.status.should == 200
|
25
|
+
EventMachine.stop
|
26
|
+
}
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
18
30
|
it "should perform a streaming GET" do
|
19
31
|
EventMachine.run {
|
20
32
|
|
data/spec/helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: em-http-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 1.0.0.beta.
|
5
|
+
version: 1.0.0.beta.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ilya Grigorik
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-12 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|