verement / cellminer

Bitcoin miner for the Cell Broadband Engine Architecture
GNU General Public License v2.0
79 stars 18 forks source link

[PATCH] Specifying just --username results in undefined method `gsub' for nil:NilClass (NoMethodError) #9

Open devurandom opened 11 years ago

devurandom commented 11 years ago
 # ./cellminer --username USER POOL_URI
/usr/lib64/ruby/1.9.1/uri/common.rb:304:in `escape': undefined method `gsub' for nil:NilClass (NoMethodError)
        from /usr/lib64/ruby/1.9.1/uri/common.rb:623:in `escape'
        from /root/cellminer/bitcoin.rb:48:in `rpc_proxy'
        from /root/cellminer/cellminer.rb:120:in `initialize'
        from ./cellminer:24:in `new'
        from ./cellminer:24:in `<main>'
devurandom commented 11 years ago

PATCH:

diff --git a/bitcoin.rb b/bitcoin.rb
index 81d7b9f..119d1c6 100644
--- a/bitcoin.rb
+++ b/bitcoin.rb
@@ -45,6 +45,9 @@ module Bitcoin
     # This is a workaround; URI needs escaped username and password
     if username
       uri.user     = URI.escape username, /[^#{URI::PATTERN::UNRESERVED}]/
+      uri.password = ''
+    end
+    if password
       uri.password = URI.escape password, /[^#{URI::PATTERN::UNRESERVED}]/
     end