You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/06/06 14:51:08 UTC

svn commit: r1132619 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb

Author: mfojtik
Date: Mon Jun  6 12:51:08 2011
New Revision: 1132619

URL: http://svn.apache.org/viewvc?rev=1132619&view=rev
Log:
Fix long username for RHEVM driver

This patch is to fix a problem with Base64.b64encode for credentials in RHEVM driver, due to a wrong way in pack to add \n every 60 chars i had to use this hack.
The issue is not present in Ruby 1.9.x in fact they use a method called strict_encode64() that is the same as my hack.

Signed-off-by: Francesco Vollero <fv...@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb?rev=1132619&r1=1132618&r2=1132619&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb Mon Jun  6 12:51:08 2011
@@ -150,7 +150,9 @@ module RHEVM
     end
 
     def auth_header
-      { :authorization => "Basic " + Base64.encode64("#{@credentials[:username]}:#{@credentials[:password]}"), }
+      # As RDOC says this is the function for strict_encode64:
+      encoded_credentials = ["#{@credentials[:username]}:#{@credentials[:password]}"].pack("m0").gsub(/\n/,'')
+      { :authorization => "Basic " + encoded_credentials }
     end
 
     def base_url