dav4rack 0.1.5 → 0.1.6

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/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .*
1
2
  *~
2
3
  doc/*
3
4
  pkg/*
data/dav4rack.gemspec CHANGED
@@ -28,6 +28,7 @@ lib/dav4rack/resource.rb
28
28
  lib/dav4rack/interceptor.rb
29
29
  lib/dav4rack/interceptor_resource.rb
30
30
  lib/dav4rack/remote_file.rb
31
+ lib/dav4rack/file.rb
31
32
  lib/dav4rack/lock.rb
32
33
  lib/dav4rack/lock_store.rb
33
34
  lib/dav4rack/logger.rb
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DAV4Rack
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
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: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
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-04 00:00:00 -07:00
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