em-http-request 0.2.9 → 0.2.10

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.

@@ -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 :redirect => 1
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.9
1
+ 0.2.10
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{em-http-request}
8
- s.version = "0.2.9"
8
+ s.version = "0.2.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ilya Grigorik"]
@@ -375,7 +375,7 @@ module EventMachine
375
375
  end
376
376
 
377
377
  def unbind
378
- if @last_effective_url != @uri and @redirects < @options[:redirects]
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
 
@@ -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
- :body => {:a => :b}, :head => {'content-type' => 'text'}})
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
- :body => "data", :proxy => {:host => '127.0.0.1', :port => 8082}})
616
+ :body => "data", :proxy => {:host => '127.0.0.1', :port => 8082}})
606
617
 
607
618
  http.errback { failed }
608
619
  http.callback {
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 9
9
- version: 0.2.9
8
+ - 10
9
+ version: 0.2.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ilya Grigorik