统一改为使用Auth.calculate_deadline()方法计算授权期。

This commit is contained in:
Liang Tao
2014-03-28 11:47:18 +08:00
parent e2b3162f1f
commit 0c8a8e98e0
+1 -10
View File
@@ -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