sprockets 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/sprockets/server.rb +18 -18
- data/lib/sprockets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5f1a2b7d847a15dff3669ec28a2248484ee0831c88017fc67fee6afe7b6a6f1
|
4
|
+
data.tar.gz: 2714999cde7d9f9340d0d7f2a98f3e48c9b46d099e36069dd380a12f6c270c54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db948451245c6a7e6cf20876368d040e6de9b3f178ab5fa0010070b9e834cd08036d449e35f3857a8443ac26fc5318ac20ab5cc16d91a4b65d8fc0f07a796939
|
7
|
+
data.tar.gz: 2a6e4b9dbb1f2effa1ef15a4f861c7b5cadb6384713bf3452749f8f0be1405ab319d85b23272b1dbc3bdeda7837d0ce55f0caf62273e197eb6190511f0789097
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md
|
4
4
|
|
5
|
+
- Fix `Sprockets::Server` to return response headers to compatible with with Rack::Lint 2.0.
|
6
|
+
|
5
7
|
## 4.1.0
|
6
8
|
|
7
9
|
- Allow age to be altered in asset:clean rake task.
|
data/lib/sprockets/server.rb
CHANGED
@@ -148,39 +148,39 @@ module Sprockets
|
|
148
148
|
# Returns a 400 Forbidden response tuple
|
149
149
|
def bad_request_response(env)
|
150
150
|
if head_request?(env)
|
151
|
-
[ 400, { "
|
151
|
+
[ 400, { "Content-Type" => "text/plain", "Content-Length" => "0" }, [] ]
|
152
152
|
else
|
153
|
-
[ 400, { "
|
153
|
+
[ 400, { "Content-Type" => "text/plain", "Content-Length" => "11" }, [ "Bad Request" ] ]
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
157
|
# Returns a 403 Forbidden response tuple
|
158
158
|
def forbidden_response(env)
|
159
159
|
if head_request?(env)
|
160
|
-
[ 403, { "
|
160
|
+
[ 403, { "Content-Type" => "text/plain", "Content-Length" => "0" }, [] ]
|
161
161
|
else
|
162
|
-
[ 403, { "
|
162
|
+
[ 403, { "Content-Type" => "text/plain", "Content-Length" => "9" }, [ "Forbidden" ] ]
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
166
|
# Returns a 404 Not Found response tuple
|
167
167
|
def not_found_response(env)
|
168
168
|
if head_request?(env)
|
169
|
-
[ 404, { "
|
169
|
+
[ 404, { "Content-Type" => "text/plain", "Content-Length" => "0", "X-Cascade" => "pass" }, [] ]
|
170
170
|
else
|
171
|
-
[ 404, { "
|
171
|
+
[ 404, { "Content-Type" => "text/plain", "Content-Length" => "9", "X-Cascade" => "pass" }, [ "Not found" ] ]
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
175
|
def method_not_allowed_response
|
176
|
-
[ 405, { "
|
176
|
+
[ 405, { "Content-Type" => "text/plain", "Content-Length" => "18" }, [ "Method Not Allowed" ] ]
|
177
177
|
end
|
178
178
|
|
179
179
|
def precondition_failed_response(env)
|
180
180
|
if head_request?(env)
|
181
|
-
[ 412, { "
|
181
|
+
[ 412, { "Content-Type" => "text/plain", "Content-Length" => "0", "X-Cascade" => "pass" }, [] ]
|
182
182
|
else
|
183
|
-
[ 412, { "
|
183
|
+
[ 412, { "Content-Type" => "text/plain", "Content-Length" => "19", "X-Cascade" => "pass" }, [ "Precondition Failed" ] ]
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
@@ -189,7 +189,7 @@ module Sprockets
|
|
189
189
|
def javascript_exception_response(exception)
|
190
190
|
err = "#{exception.class.name}: #{exception.message}\n (in #{exception.backtrace[0]})"
|
191
191
|
body = "throw Error(#{err.inspect})"
|
192
|
-
[ 200, { "
|
192
|
+
[ 200, { "Content-Type" => "application/javascript", "Content-Length" => body.bytesize.to_s }, [ body ] ]
|
193
193
|
end
|
194
194
|
|
195
195
|
# Returns a CSS response that hides all elements on the page and
|
@@ -242,7 +242,7 @@ module Sprockets
|
|
242
242
|
}
|
243
243
|
CSS
|
244
244
|
|
245
|
-
[ 200, { "
|
245
|
+
[ 200, { "Content-Type" => "text/css; charset=utf-8", "Content-Length" => body.bytesize.to_s }, [ body ] ]
|
246
246
|
end
|
247
247
|
|
248
248
|
# Escape special characters for use inside a CSS content("...") string
|
@@ -258,18 +258,18 @@ module Sprockets
|
|
258
258
|
headers = {}
|
259
259
|
|
260
260
|
# Set caching headers
|
261
|
-
headers["
|
262
|
-
headers["
|
261
|
+
headers["Cache-Control"] = +"public"
|
262
|
+
headers["ETag"] = %("#{etag}")
|
263
263
|
|
264
264
|
# If the request url contains a fingerprint, set a long
|
265
265
|
# expires on the response
|
266
266
|
if path_fingerprint(env["PATH_INFO"])
|
267
|
-
headers["
|
267
|
+
headers["Cache-Control"] << ", max-age=31536000, immutable"
|
268
268
|
|
269
269
|
# Otherwise set `must-revalidate` since the asset could be modified.
|
270
270
|
else
|
271
|
-
headers["
|
272
|
-
headers["
|
271
|
+
headers["Cache-Control"] << ", must-revalidate"
|
272
|
+
headers["Vary"] = "Accept-Encoding"
|
273
273
|
end
|
274
274
|
|
275
275
|
headers
|
@@ -279,7 +279,7 @@ module Sprockets
|
|
279
279
|
headers = {}
|
280
280
|
|
281
281
|
# Set content length header
|
282
|
-
headers["
|
282
|
+
headers["Content-Length"] = length.to_s
|
283
283
|
|
284
284
|
# Set content type header
|
285
285
|
if type = asset.content_type
|
@@ -287,7 +287,7 @@ module Sprockets
|
|
287
287
|
if type.start_with?("text/") && asset.charset
|
288
288
|
type += "; charset=#{asset.charset}"
|
289
289
|
end
|
290
|
-
headers["
|
290
|
+
headers["Content-Type"] = type
|
291
291
|
end
|
292
292
|
|
293
293
|
headers.merge(cache_headers(env, asset.etag))
|
data/lib/sprockets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-06-
|
12
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|