Browse files

make sure urls do not have query info in them

  • Loading branch information...
1 parent f453413 commit d6c2823e761dbbb6a642e02c8e14ad2ba25064a4 @maccman committed Apr 27, 2010
Showing with 8 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +7 −3 lib/roauth.rb
View
1 .gitignore
@@ -1 +1,2 @@
pkg
+*.gem
View
10 lib/roauth.rb
@@ -68,7 +68,11 @@ def oauth_params(oauth)
}
end
- def signature(oauth, uri, params, http_method = :get)
+ def signature(oauth, uri, params, http_method = :get)
+ uri = URI.parse(uri)
+ uri.query = nil
+ uri = uri.to_s
+
sig_base = http_method.to_s.upcase + "&" + escape(uri) + "&" + normalize(params)
digest = SIGNATURE_METHODS[oauth[:signature_method]]
secret = "#{escape(oauth[:consumer_secret])}&#{escape(oauth[:token_secret])}"
@@ -78,11 +82,11 @@ def signature(oauth, uri, params, http_method = :get)
# Escape characters in a string according to the {OAuth spec}[http://oauth.net/core/1.0/]
def escape(value)
- URI::escape(value.to_s, /[^a-zA-Z0-9\-\.\_\~]/) # Unreserved characters -- must not be encoded
+ URI.escape(value.to_s, /[^a-zA-Z0-9\-\.\_\~]/) # Unreserved characters -- must not be encoded
end
def unescape(value)
- URI::unescape(value)
+ URI.unescape(value)
end
# Normalize a string of parameters based on the {OAuth spec}[http://oauth.net/core/1.0/#rfc.section.9.1.1]

0 comments on commit d6c2823

Please sign in to comment.