rails-profiler 0.44.15 → 0.44.16
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c0e866574bd1980a2d0110b9cad69a60a2dc65e926f454cfeb1a90a90c54c44
|
|
4
|
+
data.tar.gz: ecfa5676aa6ef157d7cbfb2fdff269ef0475bc110f9296e8fc03ff90cba32965
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4681a333608b566a216560a2c9233754991fed624bc4d23f2a6e58b3524fb0a0d38730658230b10574b46e76781c2285a7f50cceeb0df13c22488bdb9b48734
|
|
7
|
+
data.tar.gz: 0cfbb5a92dcfa966dce9fc376e42c4223bf8523a1634ee7e7b5ddd367bf7e9768f4551177cf8d8c88393f2a79eacdf048666a64cc4eb7d0bcf1c9078e14e769e
|
data/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,17 @@ every commit of every tag interval is accounted for one way or the other.
|
|
|
19
19
|
|
|
20
20
|
## [Unreleased]
|
|
21
21
|
|
|
22
|
+
## [0.44.16] - 2026-10-23
|
|
23
|
+
|
|
24
|
+
<!-- stamped -->
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **LogCollector:** Prevent `BroadcastLogger` level from forcing `DEBUG` globally across all threads during profiling.
|
|
29
|
+
- **Middleware:** Skip toolbar injection for HTML downloads (`Content-Disposition: attachment`) and compressed responses (`Content-Encoding` present) to prevent file corruption.
|
|
30
|
+
- **Middleware:** Remove `ETag` and `Last-Modified` headers when toolbar is injected to prevent stale cached responses on 304 Not Modified.
|
|
31
|
+
- **Profiler:** Catch `Exception` (not just `StandardError`) to properly handle `Interrupt`, `SignalException`, and `Sidekiq::Shutdown`, marking profiles as failed instead of completed.
|
|
32
|
+
|
|
22
33
|
## [0.44.15] - 2026-10-23
|
|
23
34
|
|
|
24
35
|
<!-- stamped -->
|
|
@@ -145,8 +145,10 @@ module Profiler
|
|
|
145
145
|
|
|
146
146
|
if defined?(Rails) && Rails.logger
|
|
147
147
|
if Rails.logger.respond_to?(:broadcast_to)
|
|
148
|
-
@capture_logger = CaptureLogger.new(@logs)
|
|
149
148
|
@broadcaster = Rails.logger
|
|
149
|
+
level = @broadcaster.level
|
|
150
|
+
@capture_logger = CaptureLogger.new(@logs)
|
|
151
|
+
@capture_logger.level = level
|
|
150
152
|
@broadcaster.broadcast_to(@capture_logger)
|
|
151
153
|
elsif defined?(ActiveSupport::Logger) && ActiveSupport::Logger.respond_to?(:broadcast)
|
|
152
154
|
self.class.attach_legacy_broadcast(Rails.logger)
|
|
@@ -136,11 +136,15 @@ module Profiler
|
|
|
136
136
|
|
|
137
137
|
set_header(headers, TOKEN_HEADER, profile.token)
|
|
138
138
|
|
|
139
|
-
if html_response?(headers)
|
|
139
|
+
if html_response?(headers) && !attachment_response?(headers) && !encoded_response?(headers)
|
|
140
140
|
nonce = env['action_dispatch.content_security_policy_nonce']
|
|
141
141
|
injected = ToolbarInjector.new(body, profile.token, nonce).inject
|
|
142
142
|
# A HEAD answer, or a page without </body>, keeps the length it announced.
|
|
143
|
-
|
|
143
|
+
unless injected.equal?(body)
|
|
144
|
+
update_content_length(headers, injected)
|
|
145
|
+
delete_header(headers, "ETag")
|
|
146
|
+
delete_header(headers, "Last-Modified")
|
|
147
|
+
end
|
|
144
148
|
body = injected
|
|
145
149
|
end
|
|
146
150
|
|
|
@@ -346,6 +350,15 @@ module Profiler
|
|
|
346
350
|
content_type(headers).include?("text/html")
|
|
347
351
|
end
|
|
348
352
|
|
|
353
|
+
def attachment_response?(headers)
|
|
354
|
+
disposition = header(headers, "content-disposition")
|
|
355
|
+
disposition&.split(";", 2)&.first&.strip&.casecmp?("attachment")
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def encoded_response?(headers)
|
|
359
|
+
header(headers, "content-encoding").present?
|
|
360
|
+
end
|
|
361
|
+
|
|
349
362
|
def content_type(headers)
|
|
350
363
|
header(headers, "content-type").to_s
|
|
351
364
|
end
|
|
@@ -368,6 +381,11 @@ module Profiler
|
|
|
368
381
|
headers[existing.first || name] = value
|
|
369
382
|
end
|
|
370
383
|
|
|
384
|
+
def delete_header(headers, name)
|
|
385
|
+
existing = headers.keys.select { |key| key.to_s.casecmp?(name) }
|
|
386
|
+
existing.each { |key| headers.delete(key) }
|
|
387
|
+
end
|
|
388
|
+
|
|
371
389
|
# Only a length the application announced is corrected: a chunked or unsized answer
|
|
372
390
|
# stays without one.
|
|
373
391
|
def update_content_length(headers, body)
|
data/lib/profiler/version.rb
CHANGED