mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
7614d64725
commit
93ed2c7b1e
4 changed files with 9 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sat Dec 18 15:09:02 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Fri Dec 17 16:44:26 2004 Tanaka Akira <akr@m17n.org>
|
Fri Dec 17 16:44:26 2004 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* configure.in (ac_cv_sizeof_rlim_t): set 8 for BSD/OS.
|
* configure.in (ac_cv_sizeof_rlim_t): set 8 for BSD/OS.
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#
|
#
|
||||||
# $IPR: httpauth.rb,v 1.14 2003/07/22 19:20:42 gotoyuzo Exp $
|
# $IPR: httpauth.rb,v 1.14 2003/07/22 19:20:42 gotoyuzo Exp $
|
||||||
|
|
||||||
require 'base64'
|
|
||||||
require 'webrick/httpauth/basicauth'
|
require 'webrick/httpauth/basicauth'
|
||||||
require 'webrick/httpauth/digestauth'
|
require 'webrick/httpauth/digestauth'
|
||||||
require 'webrick/httpauth/htpasswd'
|
require 'webrick/httpauth/htpasswd'
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
require 'webrick/config'
|
require 'webrick/config'
|
||||||
require 'webrick/httpstatus'
|
require 'webrick/httpstatus'
|
||||||
require 'webrick/httpauth/authenticator'
|
require 'webrick/httpauth/authenticator'
|
||||||
require 'base64'
|
|
||||||
|
|
||||||
module WEBrick
|
module WEBrick
|
||||||
module HTTPAuth
|
module HTTPAuth
|
||||||
|
|
|
@ -16,7 +16,6 @@ require 'webrick/httpstatus'
|
||||||
require 'webrick/httpauth/authenticator'
|
require 'webrick/httpauth/authenticator'
|
||||||
require 'digest/md5'
|
require 'digest/md5'
|
||||||
require 'digest/sha1'
|
require 'digest/sha1'
|
||||||
require 'base64'
|
|
||||||
|
|
||||||
module WEBrick
|
module WEBrick
|
||||||
module HTTPAuth
|
module HTTPAuth
|
||||||
|
@ -254,7 +253,7 @@ module WEBrick
|
||||||
def generate_next_nonce(req)
|
def generate_next_nonce(req)
|
||||||
now = "%012d" % req.request_time.to_i
|
now = "%012d" % req.request_time.to_i
|
||||||
pk = hexdigest(now, @instance_key)[0,32]
|
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
|
nonce
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -262,7 +261,7 @@ module WEBrick
|
||||||
username = auth_req['username']
|
username = auth_req['username']
|
||||||
nonce = auth_req['nonce']
|
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)
|
if (!pub_time || !pk)
|
||||||
error("%s: empty nonce is given", username)
|
error("%s: empty nonce is given", username)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue