apache_secure_download 0.0.5.228 → 0.0.6.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,5 +1,10 @@
1
1
  = Revision history for apache_secure_download
2
2
 
3
+ == 0.0.6 [2008-03-29]
4
+
5
+ * Reverted v0.0.5
6
+ * Added options to Apache::SecureDownload.new to allow or deny by regexp
7
+
3
8
  == 0.0.5 [2008-03-29]
4
9
 
5
10
  * Added AlwaysOK and AlwaysFORBIDDEN handlers
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to apache_secure_download version 0.0.5
5
+ This documentation refers to apache_secure_download version 0.0.6
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -6,7 +6,7 @@ module Apache
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 5
9
+ TINY = 6
10
10
 
11
11
  class << self
12
12
 
@@ -37,8 +37,12 @@ module Apache
37
37
  # Creates a new RubyAccessHandler instance for the Apache web server.
38
38
  # The argument +secret+ is the shared secret string that the application
39
39
  # uses to create valid URLs (tokens).
40
- def initialize(secret)
41
- raise ArgumentError, 'secret string missing' unless @secret = secret
40
+ def initialize(secret, options = {})
41
+ raise ArgumentError, 'secret string missing' unless secret.is_a?(String)
42
+
43
+ @secret = secret
44
+ @allow = options[:allow]
45
+ @deny = options[:deny]
42
46
  end
43
47
 
44
48
  # Checks whether the current +request+ satisfies the following requirements:
@@ -49,6 +53,9 @@ module Apache
49
53
  # If either condition doesn't hold true, access to the requested resource
50
54
  # is forbidden!
51
55
  def check_access(request)
56
+ return FORBIDDEN if @deny && request.uri =~ @deny
57
+ return OK if @allow && request.uri =~ @allow
58
+
52
59
  timestamp = request.param('timestamp')
53
60
 
54
61
  return FORBIDDEN if timestamp.to_i < Time.now.to_i
@@ -57,28 +64,6 @@ module Apache
57
64
  return OK
58
65
  end
59
66
 
60
- class AlwaysOK
61
-
62
- include Singleton
63
-
64
- # Simply allow all requests.
65
- def check_access(request)
66
- return OK
67
- end
68
-
69
- end
70
-
71
- class AlwaysFORBIDDEN
72
-
73
- include Singleton
74
-
75
- # Deny all requests, no matter what.
76
- def check_access(request)
77
- return FORBIDDEN
78
- end
79
-
80
- end
81
-
82
67
  end
83
68
 
84
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apache_secure_download
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.228
4
+ version: 0.0.6.229
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille