public
Rubygem
Description: Makes http fun! Also, makes consuming restful web services dead easy.
Homepage:
Clone URL: git://github.com/jnunemaker/httparty.git
Click here to lend your support to: httparty and make a donation at www.pledgie.com !
Be a little smarter with the paths that are passed in.

This is especially important for the redirect-handling in which we
may be pointed to a whole 'nother scheme/host that does not
match our base URI.
evri (author)
Fri Sep 19 16:42:55 -0700 2008
jnunemaker (committer)
Fri Oct 24 21:34:44 -0700 2008
commit  a279df8f703f40f6717ce9aa3af46b4257d99e28
tree    5453f67b231395f5f2aadbd62dacb9b8305ac73d
parent  ae7ce3097731a034e7b9ddae2b30d3916efa3a5c
...
115
116
117
118
 
 
119
120
121
...
115
116
117
 
118
119
120
121
122
0
@@ -115,7 +115,8 @@ module HTTParty
0
         raise ArgumentError, 'only get, post, put and delete methods are supported' unless %w[get post put delete].include?(method.to_s)
0
         raise ArgumentError, ':headers must be a hash' if options[:headers] && !options[:headers].is_a?(Hash)
0
         raise ArgumentError, ':basic_auth must be a hash' if options[:basic_auth] && !options[:basic_auth].is_a?(Hash)
0
-        uri            = URI.parse("#{base_uri}#{path}")
0
+        path           = URI.parse(path)
0
+        uri            = path.relative? ? URI.parse("#{base_uri}#{path}") : path
0
         existing_query = uri.query ? "#{uri.query}&" : ''
0
         uri.query      = if options[:query].blank?
0
           existing_query + default_params.to_query

Comments