From 0c8a8e98e02fbd9e9a2779f52534fa5ecae438b7 Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Fri, 28 Mar 2014 11:47:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=94=B9=E4=B8=BA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8Auth.calculate=5Fdeadline()=E6=96=B9=E6=B3=95=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=8E=88=E6=9D=83=E6=9C=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/qiniu/auth.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/qiniu/auth.rb b/lib/qiniu/auth.rb index 758838a..3990b31 100755 --- a/lib/qiniu/auth.rb +++ b/lib/qiniu/auth.rb @@ -142,16 +142,7 @@ module Qiniu secret_key = Config.settings[:secret_key] ### 授权期计算 - if args[:expires].is_a?(Integer) && args[:expires] > 0 then - # 指定相对时间,单位:秒 - e = Time.now.to_i + args[:expires] - elsif args[:deadline].is_a?(Integer) then - # 指定绝对时间,常用于调试和单元测试 - e = args[:deadline] - else - # 默认授权期1小时 - e = Time.now.to_i + 3600 - end + e = Auth.calculate_deadline(args[:expires_in], args[:deadline]) ### URL变换:追加授权期参数 if url.index('?').is_a?(Fixnum) then