logjam_agent 0.17.1 → 0.18.0

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
  SHA1:
3
- metadata.gz: a6613b91165bdc35289c91ab2f90b40b60d2b807
4
- data.tar.gz: 6e8308155e9c85d0aa838c62b78bc670e28108aa
3
+ metadata.gz: 375304657bb752c670704f325f55054bf811d9c5
4
+ data.tar.gz: 09ab3cf2c0037d3c2f0986d9d926b342f543e7ac
5
5
  SHA512:
6
- metadata.gz: 84c0920e52a6ee1baa3cf044faa496e97f9e161cea3e6e3c92335d1b7b1c2a9d5ecc4f0b6e6c916326b24154a932c3fd572112a52c910f820b37ff2ade085372
7
- data.tar.gz: 735546bd20a054d83bad925974c20113b6a16c0d93289e0985b194430e714d52e44b2e1be0607e1008ba433f6605e43958ed51187bb01860aba7b41b747dcd30
6
+ metadata.gz: cc70919214e1d998562108257dbb824235c71fc8a0e90c914207968cac7559f07f250205fa081757201639a8192fd4a44041b940cade6b29b1d71c857de66db4
7
+ data.tar.gz: f952178602f923e69cd98a9963e9a95bd4e01ed1575b520a60e0bad92e68ba97e5b3418421e171f601c1844c9dca71fde22a6cd3955e5a9fad39c1329513ba06
@@ -15,6 +15,11 @@ module LogjamAgent
15
15
  ensure
16
16
  headers = result[1]
17
17
  headers["X-Logjam-Request-Id"] = request.id
18
+ # this cookie is intended for JS code, which can't read it from response headers.
19
+ # it's superior to returning it with the html body, because that makes caching hard.
20
+ if set_request_id_cookie?(request, env)
21
+ ::Rack::Utils.set_cookie_header!(headers, "X-Logjam-Request-Id", {:value => request.id, :path => "/"})
22
+ end
18
23
  unless (request_action = request.fields[:action]).blank?
19
24
  headers["X-Logjam-Request-Action"] = request_action
20
25
  end
@@ -37,5 +42,9 @@ module LogjamAgent
37
42
  def finish_request(env)
38
43
  LogjamAgent.finish_request(env["time_bandits.metrics"])
39
44
  end
45
+
46
+ def set_request_id_cookie?(request, env)
47
+ !(request.ignored? || env["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest")
48
+ end
40
49
  end
41
50
  end
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.17.1"
2
+ VERSION = "0.18.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake