summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-18 06:17:33 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-18 06:17:33 +0000
commit93ed2c7b1e0370287228c967c9973c9f2344fc54 (patch)
tree92bc8343b2a958852b8e42e5a83bf58dc0ff8998 /lib
parent7614d647251da818f5f8d851528de52c6c601611 (diff)
* lib/webrick/httpauth.rb,
lib/webrick/httpauth/{basicauth.rb,digestauth.rb}: use pack/unpack-template char "m" instead of lib/base64.rb to do base64 encoding/decoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/webrick/httpauth.rb1
-rw-r--r--lib/webrick/httpauth/basicauth.rb1
-rw-r--r--lib/webrick/httpauth/digestauth.rb5
3 files changed, 2 insertions, 5 deletions
diff --git a/lib/webrick/httpauth.rb b/lib/webrick/httpauth.rb
index 3f0b83339d..b78c40fd04 100644
--- a/lib/webrick/httpauth.rb
+++ b/lib/webrick/httpauth.rb
@@ -8,7 +8,6 @@
#
# $IPR: httpauth.rb,v 1.14 2003/07/22 19:20:42 gotoyuzo Exp $
-require 'base64'
require 'webrick/httpauth/basicauth'
require 'webrick/httpauth/digestauth'
require 'webrick/httpauth/htpasswd'
diff --git a/lib/webrick/httpauth/basicauth.rb b/lib/webrick/httpauth/basicauth.rb
index 926a6b8289..ca5b0e9da3 100644
--- a/lib/webrick/httpauth/basicauth.rb
+++ b/lib/webrick/httpauth/basicauth.rb
@@ -10,7 +10,6 @@
require 'webrick/config'
require 'webrick/httpstatus'
require 'webrick/httpauth/authenticator'
-require 'base64'
module WEBrick
module HTTPAuth
diff --git a/lib/webrick/httpauth/digestauth.rb b/lib/webrick/httpauth/digestauth.rb
index 05a6f192c3..a5177459b7 100644
--- a/lib/webrick/httpauth/digestauth.rb
+++ b/lib/webrick/httpauth/digestauth.rb
@@ -16,7 +16,6 @@ require 'webrick/httpstatus'
require 'webrick/httpauth/authenticator'
require 'digest/md5'
require 'digest/sha1'
-require 'base64'
module WEBrick
module HTTPAuth
@@ -254,7 +253,7 @@ module WEBrick
def generate_next_nonce(req)
now = "%012d" % req.request_time.to_i
pk = hexdigest(now, @instance_key)[0,32]
- nonce = Base64.encode64(now + ":" + pk).chop # it has 60 length of chars.
+ nonce = [now + ":" + pk].pack("m*").chop # it has 60 length of chars.
nonce
end
@@ -262,7 +261,7 @@ module WEBrick
username = auth_req['username']
nonce = auth_req['nonce']
- pub_time, pk = Base64.decode64(nonce).split(":", 2)
+ pub_time, pk = nonce.unpack("m*")[0].split(":", 2)
if (!pub_time || !pk)
error("%s: empty nonce is given", username)
return false