tus-server 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/README.md +37 -6
- data/lib/tus/storage/s3.rb +10 -4
- data/tus-server.gemspec +2 -4
- metadata +6 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75d994c5e03d4027f723c3bb32dc17589e1fe6bc
|
4
|
+
data.tar.gz: 300bcd61d11c05963fea1d6e02f4684b35a3a8e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3e9d86ff10b063367dda70bd44bc38d8f56485fabfaa209f7f341ebd7c87b7cd3f0cf4e40855e142577c0e40cde763effe349fc54ed8bc2e7c93046eac566cb
|
7
|
+
data.tar.gz: 63e466d8dc751465871cd74d951357fc3918cb8ef0a60a35124dd88b452141be1a4c5e057c7a3944208ca4e039c76f555df86e319f63a75aeb188e6df65a5986
|
data/README.md
CHANGED
@@ -86,19 +86,50 @@ end
|
|
86
86
|
$ ruby tus.rb --stdout # enable logging
|
87
87
|
```
|
88
88
|
|
89
|
+
This will run the tus server app on the root URL; if you want to run it on some
|
90
|
+
path you can use `Rack::Builder`:
|
91
|
+
|
92
|
+
```rb
|
93
|
+
class GoliathTusServer < Goliath::RackProxy
|
94
|
+
rack_app Rack::Builder.new {
|
95
|
+
map "/files" do
|
96
|
+
run Tus::Server
|
97
|
+
end
|
98
|
+
}
|
99
|
+
rewindable_input false # set to true if you're using checksums
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
89
103
|
### Unicorn
|
90
104
|
|
91
105
|
Like Goliath, Unicorn also support streaming uploads, and tus-ruby-server knows
|
92
106
|
how to automatically recover from `Unicorn::ClientShutdown` exceptions during
|
93
107
|
upload, storing data that it has received up until that point. Just note that
|
94
108
|
in order to achieve streaming uploads, Nginx should be configured **not** to
|
95
|
-
buffer incoming requests
|
109
|
+
buffer incoming requests, and to disable worker timeout to enable long running
|
110
|
+
upload requests:
|
111
|
+
|
112
|
+
```rb
|
113
|
+
timeout 60*60*24*30 # set worker timeout to 30 days
|
114
|
+
```
|
96
115
|
|
97
116
|
But it's also fine to have Nginx buffer requests, just note that in this case
|
98
117
|
Nginx won't forward incomplete upload requests to tus-ruby-server, so in order
|
99
118
|
for resumable upload to be possible the client needs to send data in multiple
|
100
119
|
upload requests (which can then be retried individually).
|
101
120
|
|
121
|
+
Unless you're using the "checksum" tus feature, you might want to consider
|
122
|
+
disabling rewindability of request body, to prevent Unicorn from additionally
|
123
|
+
caching received data onto the disk (since that's not necessary unless request
|
124
|
+
body needs to be rewinded).
|
125
|
+
|
126
|
+
```rb
|
127
|
+
# config/unicorn.rb
|
128
|
+
# ...
|
129
|
+
|
130
|
+
rewindable_input false
|
131
|
+
```
|
132
|
+
|
102
133
|
### Other web servers
|
103
134
|
|
104
135
|
It's perfectly feasible to run tus-ruby-server on web servers other than
|
@@ -179,10 +210,10 @@ chunks, meaning the length of each partial upload needs to be a multiple of the
|
|
179
210
|
|
180
211
|
Amazon S3 is probably one of the most popular services for storing files, and
|
181
212
|
tus-ruby-server ships with `Tus::Storage::S3` which utilizes S3's multipart API
|
182
|
-
to upload files, and depends on the [aws-sdk] gem.
|
213
|
+
to upload files, and depends on the [aws-sdk-s3] gem.
|
183
214
|
|
184
215
|
```rb
|
185
|
-
gem "aws-sdk", "~> 2
|
216
|
+
gem "aws-sdk-s3", "~> 1.2"
|
186
217
|
```
|
187
218
|
|
188
219
|
```rb
|
@@ -328,9 +359,9 @@ The tus-ruby-server was inspired by [rubytus].
|
|
328
359
|
[Shrine]: https://github.com/janko-m/shrine
|
329
360
|
[trailing headers]: https://tools.ietf.org/html/rfc7230#section-4.1.2
|
330
361
|
[rubytus]: https://github.com/picocandy/rubytus
|
331
|
-
[aws-sdk]: https://github.com/aws/aws-sdk-ruby
|
332
|
-
[`Aws::S3::Client#initialize`]: http://docs.aws.amazon.com/
|
333
|
-
[`Aws::S3::Client#create_multipart_upload`]: http://docs.aws.amazon.com/
|
362
|
+
[aws-sdk-s3]: https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-s3
|
363
|
+
[`Aws::S3::Client#initialize`]: http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Client.html#initialize-instance_method
|
364
|
+
[`Aws::S3::Client#create_multipart_upload`]: http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Client.html#create_multipart_upload-instance_method
|
334
365
|
[Range requests]: https://tools.ietf.org/html/rfc7233
|
335
366
|
[Goliath]: https://github.com/postrank-labs/goliath
|
336
367
|
[EventMachine]: https://github.com/eventmachine/eventmachine
|
data/lib/tus/storage/s3.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
|
-
|
2
|
+
begin
|
3
|
+
require "aws-sdk-s3"
|
4
|
+
if Gem::Version.new(Aws::S3::GEM_VERSION) < Gem::Version.new("1.2.0")
|
5
|
+
raise "Tus::Storage::S3 requires aws-sdk-s3 version 1.2.0 or above"
|
6
|
+
end
|
7
|
+
rescue LoadError
|
8
|
+
require "aws-sdk"
|
9
|
+
Aws.eager_autoload!(services: ["S3"])
|
10
|
+
end
|
3
11
|
|
4
12
|
require "tus/info"
|
5
13
|
require "tus/errors"
|
@@ -9,8 +17,6 @@ require "cgi"
|
|
9
17
|
require "fiber"
|
10
18
|
require "stringio"
|
11
19
|
|
12
|
-
Aws.eager_autoload!(services: ["S3"])
|
13
|
-
|
14
20
|
module Tus
|
15
21
|
module Storage
|
16
22
|
class S3
|
@@ -35,7 +41,7 @@ module Tus
|
|
35
41
|
options[:content_type] = tus_info.metadata["content_type"]
|
36
42
|
|
37
43
|
if filename = tus_info.metadata["filename"]
|
38
|
-
# Aws-sdk doesn't sign non-ASCII characters correctly, and browsers
|
44
|
+
# Aws-sdk-s3 doesn't sign non-ASCII characters correctly, and browsers
|
39
45
|
# will automatically URI-decode filenames.
|
40
46
|
filename = CGI.escape(filename).gsub("+", " ")
|
41
47
|
|
data/tus-server.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "tus-server"
|
3
|
-
gem.version = "1.1.
|
3
|
+
gem.version = "1.1.2"
|
4
4
|
|
5
5
|
gem.required_ruby_version = ">= 2.1"
|
6
6
|
|
@@ -22,7 +22,5 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_development_dependency "cucumber"
|
23
23
|
gem.add_development_dependency "unicorn"
|
24
24
|
gem.add_development_dependency "mongo"
|
25
|
-
gem.add_development_dependency "aws-sdk", "~> 2
|
26
|
-
gem.add_development_dependency "goliath"
|
27
|
-
gem.add_development_dependency "async-rack", ">= 0.5.1"
|
25
|
+
gem.add_development_dependency "aws-sdk-s3", "~> 1.2"
|
28
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tus-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roda
|
@@ -109,47 +109,19 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: aws-sdk
|
112
|
+
name: aws-sdk-s3
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '2
|
117
|
+
version: '1.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '2
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: goliath
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: async-rack
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.5.1
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 0.5.1
|
124
|
+
version: '1.2'
|
153
125
|
description:
|
154
126
|
email:
|
155
127
|
- janko.marohnic@gmail.com
|
@@ -190,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
162
|
version: '0'
|
191
163
|
requirements: []
|
192
164
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.6.11
|
194
166
|
signing_key:
|
195
167
|
specification_version: 4
|
196
168
|
summary: Ruby server implementation of tus.io, the open protocol for resumable file
|