diff --git a/Rakefile b/Rakefile index b36289a3..8410c180 100644 --- a/Rakefile +++ b/Rakefile @@ -35,7 +35,7 @@ rescue LoadError puts "Hiding spec tasks because RSpec is not available" end -require 'rake/rdoctask' +require 'rdoc/task' Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" diff --git a/lib/casclient/client.rb b/lib/casclient/client.rb index c69e7065..7845d13a 100644 --- a/lib/casclient/client.rb +++ b/lib/casclient/client.rb @@ -282,9 +282,18 @@ def hash_to_query(hash) pairs = [] hash.each do |k, vals| vals = [vals] unless vals.kind_of? Array - vals.each {|v| pairs << (v.nil? ? CGI.escape(k) : "#{CGI.escape(k)}=#{CGI.escape(v)}")} + + vals.each {|v| + if v.nil? + pairs << CGI.escape(k) unless k.nil? + else + pairs << "#{CGI.escape(k)}=#{CGI.escape(v)}" + end + + pairs + } end pairs.join("&") end end -end +end \ No newline at end of file diff --git a/spec/casclient/client_spec.rb b/spec/casclient/client_spec.rb index 98a52ac3..414bc184 100644 --- a/spec/casclient/client_spec.rb +++ b/spec/casclient/client_spec.rb @@ -90,4 +90,12 @@ end end end + + describe 'logout_url' do + it 'should tolerate oddly formed URIs' do + destination_url = 'https://foo.com/path/to/page?&sort=date_received.DESC' + + client.logout_url(destination_url) + end + end end