dav4rack 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/dav4rack.gemspec +1 -0
- data/lib/dav4rack/file.rb +37 -0
- data/lib/dav4rack/version.rb +1 -1
- metadata +5 -4
data/.gitignore
CHANGED
data/dav4rack.gemspec
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'time'
|
2
|
+
require 'rack/utils'
|
3
|
+
require 'rack/mime'
|
4
|
+
|
5
|
+
module DAV4Rack
|
6
|
+
# DAV4Rack::File simply allows us to use Rack::File but with the
|
7
|
+
# specific location we deem appropriate
|
8
|
+
class File < Rack::File
|
9
|
+
attr_accessor :path
|
10
|
+
|
11
|
+
alias :to_path :path
|
12
|
+
|
13
|
+
def initialize(path)
|
14
|
+
@path = path
|
15
|
+
end
|
16
|
+
|
17
|
+
def _call(env)
|
18
|
+
begin
|
19
|
+
if F.file?(@path) && F.readable?(@path)
|
20
|
+
serving
|
21
|
+
else
|
22
|
+
raise Errno::EPERM
|
23
|
+
end
|
24
|
+
rescue SystemCallError
|
25
|
+
not_found
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def not_found
|
30
|
+
body = "File not found: #{Utils.unescape(env["PATH_INFO"])}\n"
|
31
|
+
[404, {"Content-Type" => "text/plain",
|
32
|
+
"Content-Length" => body.size.to_s,
|
33
|
+
"X-Cascade" => "pass"},
|
34
|
+
[body]]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/dav4rack/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dav4rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Roberts
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-11 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/dav4rack/interceptor.rb
|
88
88
|
- lib/dav4rack/interceptor_resource.rb
|
89
89
|
- lib/dav4rack/remote_file.rb
|
90
|
+
- lib/dav4rack/file.rb
|
90
91
|
- lib/dav4rack/lock.rb
|
91
92
|
- lib/dav4rack/lock_store.rb
|
92
93
|
- lib/dav4rack/logger.rb
|