You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Ben Browning <bb...@redhat.com> on 2010/08/25 21:07:30 UTC

[PATCH 1/2] Fix authorization header encoding under JRuby

---
 client/lib/deltacloud.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index f8f3cd7..71b0c97 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -387,8 +387,12 @@ module DeltaCloud
     private
 
     def default_headers
+      # The linebreaks inserted every 60 characters in the Base64
+      # encoded header cause problems under JRuby
+      auth_header = "Basic "+Base64.encode64("#{@username}:#{@password}")
+      auth_header.gsub!("\n", "")
       {
-        :authorization => "Basic "+Base64.encode64("#{@username}:#{@password}"),
+        :authorization => auth_header,
         :accept => "application/xml"
       }
     end
-- 
1.7.2.1