http-request 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -103,12 +103,20 @@ module HttpRequest
103
103
  response = Response.new(raw_response, uri)
104
104
 
105
105
  # TODO: what about redirects that go back and forth..
106
- # should we introduce a max number of auto_redirects..?
106
+ # we should introduce a max number of auto_redirects..
107
107
 
108
108
  # Handle URL Redirection
109
+ # TODO: better redirection support.. some bugs / cases here..
109
110
  if auto_redirect && raw_response.kind_of?(Net::HTTPRedirection) && !response.header['location'].nil?
110
- @uri = parse_uri(response.header['location'])
111
- close # close existing connection..
111
+ # binding.pry
112
+ new_location = response.header['location']
113
+ if new_location =~ /^http/i
114
+ close # close existing connection..
115
+ @uri = parse_uri(new_location)
116
+ else
117
+ uri.join! parse_uri(new_location.gsub('//','/')).request_uri
118
+ end
119
+
112
120
  request(verb, uri.request_uri, headers, body)
113
121
  else
114
122
  response
@@ -1,3 +1,3 @@
1
1
  module HttpRequest
2
- VERSION = '1.1.5'
2
+ VERSION = '1.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-22 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
@@ -85,6 +85,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  - - ! '>='
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
+ segments:
89
+ - 0
90
+ hash: -4505057513829640071
88
91
  required_rubygems_version: !ruby/object:Gem::Requirement
89
92
  none: false
90
93
  requirements:
@@ -93,9 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
96
  version: 1.3.6
94
97
  requirements: []
95
98
  rubyforge_project:
96
- rubygems_version: 1.8.23
99
+ rubygems_version: 1.8.24
97
100
  signing_key:
98
101
  specification_version: 3
99
102
  summary: Simple HTTP client built with Net/HTTP
100
103
  test_files: []
101
- has_rdoc: