em-http-request 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of em-http-request might be problematic. Click here for more details.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/em-http-request.gemspec +1 -1
- data/lib/em-http/client.rb +1 -1
- data/spec/request_spec.rb +13 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -108,7 +108,7 @@ Full transparent proxy support with support for SSL tunneling.
|
|
108
108
|
Specify the max depth of redirects to follow, default is 0.
|
109
109
|
|
110
110
|
EventMachine.run {
|
111
|
-
http = EventMachine::HttpRequest.new('http://www.google.com/').get :
|
111
|
+
http = EventMachine::HttpRequest.new('http://www.google.com/').get :redirects => 1
|
112
112
|
http.callback { p http.last_effective_url }
|
113
113
|
}
|
114
114
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
data/em-http-request.gemspec
CHANGED
data/lib/em-http/client.rb
CHANGED
@@ -375,7 +375,7 @@ module EventMachine
|
|
375
375
|
end
|
376
376
|
|
377
377
|
def unbind
|
378
|
-
if @last_effective_url != @uri
|
378
|
+
if (@state == :finished) && (@last_effective_url != @uri) && (@redirects < @options[:redirects])
|
379
379
|
# update uri to redirect location if we're allowed to traverse deeper
|
380
380
|
@uri = @last_effective_url
|
381
381
|
|
data/spec/request_spec.rb
CHANGED
@@ -361,6 +361,17 @@ describe EventMachine::HttpRequest do
|
|
361
361
|
}
|
362
362
|
end
|
363
363
|
|
364
|
+
it "should not invoke redirect logic on failed connections" do
|
365
|
+
EventMachine.run {
|
366
|
+
http = EventMachine::HttpRequest.new('http://127.0.0.1:8081/').get :timeout => 0.1, :redirects => 5
|
367
|
+
http.callback { failed }
|
368
|
+
http.errback {
|
369
|
+
http.redirects.should == 0
|
370
|
+
EM.stop
|
371
|
+
}
|
372
|
+
}
|
373
|
+
end
|
374
|
+
|
364
375
|
it "should optionally pass the response body progressively" do
|
365
376
|
EventMachine.run {
|
366
377
|
body = ''
|
@@ -510,7 +521,7 @@ describe EventMachine::HttpRequest do
|
|
510
521
|
it "should not override content-type when passing in ruby hash/array for body" do
|
511
522
|
EventMachine.run {
|
512
523
|
http = EventMachine::HttpRequest.new('http://127.0.0.1:8080/echo_content_type').post({
|
513
|
-
|
524
|
+
:body => {:a => :b}, :head => {'content-type' => 'text'}})
|
514
525
|
|
515
526
|
http.errback { failed }
|
516
527
|
http.callback {
|
@@ -602,7 +613,7 @@ describe EventMachine::HttpRequest do
|
|
602
613
|
EventMachine.run {
|
603
614
|
|
604
615
|
http = EventMachine::HttpRequest.new('http://127.0.0.1:8080/').post({
|
605
|
-
|
616
|
+
:body => "data", :proxy => {:host => '127.0.0.1', :port => 8082}})
|
606
617
|
|
607
618
|
http.errback { failed }
|
608
619
|
http.callback {
|