dav4rack 0.1.8 → 0.2.0

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.
@@ -180,16 +180,13 @@ and as such should be applicable to other servers. First, a simplified NGINX ser
180
180
  proxy_pass http://my_app_server;
181
181
  }
182
182
 
183
- location ~* /webdav_redirect/(.*?)/(.*) {
183
+ location ~* /webdav_redirect {
184
184
  internal;
185
185
  resolver 127.0.0.1;
186
- set $re_host $1;
187
- set $re_path $2;
188
- set $re_url http://$re_host/$re_path?$args;
189
186
  proxy_set_header Authorization '';
190
- proxy_set_header Host $re_host;
187
+ proxy_set_header Host $upstream_http_redirect_host;
191
188
  proxy_max_temp_file_size 0;
192
- proxy_pass $re_url;
189
+ proxy_pass $upstream_http_redirect_url;
193
190
  }
194
191
  }
195
192
 
@@ -308,4 +305,4 @@ A big thanks to everyone contributing to help make this project better.
308
305
 
309
306
  == License
310
307
 
311
- Just like RackDAV before it, this software is distributed under the MIT license.
308
+ Just like RackDAV before it, this software is distributed under the MIT license.
@@ -61,7 +61,9 @@ module DAV4Rack
61
61
  "Last-Modified" => last_modified,
62
62
  "Content-Type" => content_type,
63
63
  "Content-Length" => size,
64
- header => "/#{prefix}/#{URI.decode(@path.sub('http://', ''))}"
64
+ "Redirect-URL" => @path,
65
+ "Redirect-Host" => @path.scan(%r{^https?://([^/\?]+)}).first.first,
66
+ header => "/#{prefix}"
65
67
  },
66
68
  ['']]
67
69
  end
@@ -394,9 +394,16 @@ module DAV4Rack
394
394
  end
395
395
 
396
396
  # Does client allow GET redirection
397
- # TODO: Get a comprehensive list in here. Especially now that trasmit added support
397
+ # TODO: Get a comprehensive list in here.
398
+ # TODO: Allow this to be dynamic so users can add regexes to match if they know of a client
399
+ # that can be supported that is not listed.
398
400
  def allows_redirect?
399
- %w(cyberduck konqueror).any?{|x| (request.respond_to?(:user_agent) ? request.user_agent.to_s.downcase : request.env['HTTP_USER_AGENT'].to_s.downcase) =~ /#{Regexp.escape(x)}/}
401
+ [
402
+ %r{cyberduck}i,
403
+ %r{konqueror}i
404
+ ].any? do |regexp|
405
+ (request.respond_to?(:user_agent) ? request.user_agent : request.env['HTTP_USER_AGENT']) =~ regexp
406
+ end
400
407
  end
401
408
 
402
409
  # Returns authentication credentials if available in form of [username,password]
@@ -1,3 +1,3 @@
1
1
  module DAV4Rack
2
- VERSION = '0.1.8'
2
+ VERSION = '0.2.0'
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: 11
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
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-12-17 00:00:00 -08:00
18
+ date: 2011-01-07 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency