zold 0.11.11 → 0.11.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/zold-nohup +2 -1
- data/lib/zold/http.rb +2 -1
- data/lib/zold/node/front.rb +2 -1
- data/lib/zold/version.rb +1 -1
- data/test/node/test_front.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90832b265cac310c342302076196ba278cb95a61
|
4
|
+
data.tar.gz: 6dfa38e0c58cf822e932e02f6069d320bb27ea3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9bad4cfcf2359824214fceb42944f835864fd6beac8603f63862d9a0311b0a9a64cc4dc016bfe96db5043416a51e29cce4d449a6090e968aa301ad80b5a4e8c
|
7
|
+
data.tar.gz: be26c9b2ff2d1afaafbfb96d3074b32fe31633d28430e9d9d62d46c8a089e6a77c0aee107bd7404b17904fa8d2d62d41cbfbf4222ff365a8c218968d3c9b03cf
|
data/bin/zold-nohup
CHANGED
@@ -29,6 +29,7 @@ require 'open3'
|
|
29
29
|
$opts = Slop.parse(ARGV, strict: false, suppress_errors: true) do |o|
|
30
30
|
o.string '--log-file', 'The file to save logs into', default: 'zold-node.log'
|
31
31
|
o.bool '--skip-install', 'Don\'t re-install Zold gem', default: false
|
32
|
+
o.bool '--sudo-install', 'Install Zold gem via sudo', default: false
|
32
33
|
end
|
33
34
|
|
34
35
|
def log(line)
|
@@ -58,7 +59,7 @@ $pid = fork do
|
|
58
59
|
end
|
59
60
|
loop do
|
60
61
|
exec("zold #{$opts.arguments.join(' ')}")
|
61
|
-
exec('gem install zold') unless $opts['skip-install']
|
62
|
+
exec(($opts['sudo-install'] ? 'sudo ' : '') + 'gem install zold') unless $opts['skip-install']
|
62
63
|
end
|
63
64
|
end
|
64
65
|
Process.detach($pid)
|
data/lib/zold/http.rb
CHANGED
@@ -98,7 +98,8 @@ module Zold
|
|
98
98
|
def headers
|
99
99
|
headers = {
|
100
100
|
'User-Agent': "Zold #{VERSION}",
|
101
|
-
'Connection': 'close'
|
101
|
+
'Connection': 'close',
|
102
|
+
'Accept-Encoding': 'gzip'
|
102
103
|
}
|
103
104
|
headers[Http::VERSION_HEADER] = VERSION
|
104
105
|
headers[Http::SCORE_HEADER] = @score.reduced(4).to_text if @score.valid? && !@score.expired? && @score.value > 3
|
data/lib/zold/node/front.rb
CHANGED
@@ -58,6 +58,7 @@ module Zold
|
|
58
58
|
set :remotes, nil? # to be injected at node.rb
|
59
59
|
set :copies, nil? # to be injected at node.rb
|
60
60
|
end
|
61
|
+
use Rack::Deflater
|
61
62
|
|
62
63
|
before do
|
63
64
|
name = "HTTP-#{Http::SCORE_HEADER}".upcase.tr('-', '_')
|
@@ -147,7 +148,7 @@ module Zold
|
|
147
148
|
id = Id.new(params[:id])
|
148
149
|
wallet = settings.wallets.find(id)
|
149
150
|
request.body.rewind
|
150
|
-
after = request.body.read
|
151
|
+
after = request.body.read.to_s
|
151
152
|
before = wallet.exists? ? AtomicFile.new(wallet.path).read : ''
|
152
153
|
if before == after
|
153
154
|
status 304
|
data/lib/zold/version.rb
CHANGED
data/test/node/test_front.rb
CHANGED
@@ -102,4 +102,18 @@ class FrontTest < Minitest::Test
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
end
|
105
|
+
|
106
|
+
def test_gzip
|
107
|
+
FakeNode.new(log: test_log).run(['--ignore-score-weakness']) do |port|
|
108
|
+
response = Zold::Http.new(URI("http://localhost:#{port}/")).get
|
109
|
+
assert_equal(
|
110
|
+
'200', response.code,
|
111
|
+
"Expected HTTP 200 OK: Found #{response.code}"
|
112
|
+
)
|
113
|
+
assert_operator(
|
114
|
+
500, :>, response['content-length'].to_i,
|
115
|
+
'Expected the content to be smaller than 500bytes for gzip'
|
116
|
+
)
|
117
|
+
end
|
118
|
+
end
|
105
119
|
end
|