blobsterix 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d6c5d8753eb7b819ab4fb8f8eda41051891141c
4
- data.tar.gz: fafd4b138061ae869bc6c7f6fafd7efaf86a27f4
3
+ metadata.gz: deb829b40753a003b15e442d2616a0b049ef3f0b
4
+ data.tar.gz: 6eb09a7c8506cd34215589210161378719f4bf67
5
5
  SHA512:
6
- metadata.gz: bd9a45bf0dfbca62e2deccd780c5e24b919f46d4939669b2f0e5e9ac9ca7115d258a2934834cea4a608c356dea1156cf97792fc519f62a55c6657b31553cd870
7
- data.tar.gz: c87a7318aef732db856b14381c95becae98181f217ddce68c1980abbfbf78f1a3f414996367eb7b46610bdcda3d5989c2d5674f8ca0e191d6b4b0e7bd3d3eb29
6
+ metadata.gz: 058c5d531944081803992583ff92ba56d55a6cd1b9dc88d70efe618325c49b73d49451ba3bc619d3c401c2b5a8c78e7409a72e6f42cf064b1e2498325ca263a6
7
+ data.tar.gz: 66aec0dbeb53da84c935cb93aa9f43a2c4dd785961c5c62e3c0a6cf5ac0b343a65139a8e3c8d81bb273ef446eb2dd366b8539e292a62c4a061506785791ff16c
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.0.12
2
+ * added global config option to activate X-Sendfile via config. Now it can not be activated anymore by a reverse proxy
3
+ * added global config option to activate or deactivate chunked streaming of files
1
4
  = 0.0.11
2
5
  * changed naming schemas of cached files and tmp files
3
6
  * fixing x-send file
@@ -40,7 +40,7 @@ module Blobsterix
40
40
 
41
41
  begin
42
42
  data = transformation.run(blob_access)
43
- send_with_data ? data.response(true, env["HTTP_IF_NONE_MATCH"], env, env["HTTP_X_FILE"] === "yes") : data.response(false)
43
+ send_with_data ? data.response(true, env["HTTP_IF_NONE_MATCH"], env) : data.response(false)
44
44
  rescue Errno::ENOENT => e
45
45
  logger.error "Cache deleted: #{blob_access}"
46
46
  Blobsterix.cache_fatal_error(blob_access)
@@ -10,13 +10,13 @@ module Blobsterix
10
10
  @env = _env
11
11
  end
12
12
 
13
- def call(xfile=false, allow_chunks=true)
13
+ def call()
14
14
  if not meta.valid
15
15
  Http.NotFound()
16
- elsif xfile and etag != meta.etag
16
+ elsif Blobsterix.use_x_send_file and etag != meta.etag
17
17
  [200, meta.header.merge({"X-Sendfile" => meta.path.to_s}), ""]
18
18
  elsif etag != meta.etag
19
- if env != nil && meta.size > 30000 && allow_chunks
19
+ if env != nil && meta.size > 30000 && Blobsterix.allow_chunked_stream
20
20
  chunkresponse
21
21
  else
22
22
  [200, meta.header, (with_data ? meta.data : "")]
@@ -36,7 +36,7 @@ module Blobsterix
36
36
 
37
37
  if bucket?
38
38
  if meta = storage.get(bucket, file)
39
- send_with_data ? meta.response(true, env["HTTP_IF_NONE_MATCH"], env, env["HTTP_X_FILE"] === "yes", false) : meta.response(false)
39
+ send_with_data ? meta.response(true, env["HTTP_IF_NONE_MATCH"], env) : meta.response(false)
40
40
  else
41
41
  Http.NotFound
42
42
  end
@@ -52,8 +52,8 @@ module Blobsterix
52
52
  end
53
53
  def delete
54
54
  end
55
- def response(with_data=true, _etag=nil, env = nil, xfile = false, allow_chunks=true)
56
- Blobsterix::Http::DataResponse.new(self, with_data, _etag, env).call(xfile, allow_chunks)
55
+ def response(with_data=true, _etag=nil, env = nil)
56
+ Blobsterix::Http::DataResponse.new(self, with_data, _etag, env).call()
57
57
  end
58
58
  end
59
59
  end
@@ -1,3 +1,3 @@
1
1
  module Blobsterix
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
data/lib/blobsterix.rb CHANGED
@@ -129,6 +129,22 @@ module Blobsterix
129
129
  @cache = obj
130
130
  end
131
131
 
132
+ def self.use_x_send_file
133
+ @use_x_send_file||=false
134
+ end
135
+
136
+ def self.use_x_send_file=(obj)
137
+ @use_x_send_file=obj
138
+ end
139
+
140
+ def self.allow_chunked_stream
141
+ @allow_chunked_stream||=true
142
+ end
143
+
144
+ def self.allow_chunked_stream=(obj)
145
+ @allow_chunked_stream=obj
146
+ end
147
+
132
148
  def self.decrypt_trafo=(obj)
133
149
  @decrypt_trafo=obj
134
150
  end
@@ -5,6 +5,12 @@
5
5
  # Blobsterix.storage_dir=Blobsterix.root.join("contents")
6
6
  # Blobsterix.cache_dir=Blobsterix.root.join("cache")
7
7
 
8
+ # # Use X-Sendfile(standard: false)
9
+ # Blobsterix.use_x_send_file=true
10
+
11
+ # # Allow chunked streaming(standard: true)
12
+ # Blobsterix.allow_chunked_stream=true
13
+
8
14
  # # Set different cache or storage handler
9
15
  # Blobsterix.storage=Blobsterix::Storage::FileSystem.new(Blobsterix.storage_dir)
10
16
  # Blobsterix.cache=Blobsterix::Storage::Cache.new(cache_dir)
@@ -5,6 +5,12 @@
5
5
  # Blobsterix.storage_dir=Blobsterix.root.join("contents")
6
6
  # Blobsterix.cache_dir=Blobsterix.root.join("cache")
7
7
 
8
+ # # Use X-Sendfile(standard: false)
9
+ # Blobsterix.use_x_send_file=true
10
+
11
+ # # Allow chunked streaming(standard: true)
12
+ # Blobsterix.allow_chunked_stream=true
13
+
8
14
  # # Set different cache or storage handler
9
15
  # Blobsterix.storage=Blobsterix::Storage::FileSystem.new(Blobsterix.storage_dir)
10
16
  # Blobsterix.cache=Blobsterix::Storage::Cache.new(cache_dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json