right_support 2.8.38 → 2.8.39
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/right_support/rack/request_logger.rb +6 -4
- data/right_support.gemspec +5 -6
- data/spec/rack/request_logger_spec.rb +38 -7
- metadata +101 -80
- checksums.yaml +0 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.8.
|
1
|
+
2.8.39
|
@@ -41,10 +41,13 @@ module RightSupport::Rack
|
|
41
41
|
#
|
42
42
|
# @option options [Array] :only log for these path Regexps unless in debug mode
|
43
43
|
# @option options [Array] :except log except for these path Regexps unless in debug mode
|
44
|
+
# @option options [Array] :include_query_string log the contents of the query string
|
44
45
|
def initialize(app, options = {})
|
45
46
|
@app = app
|
46
47
|
@only = options[:only]
|
47
48
|
@except = options[:except]
|
49
|
+
# by default we don't log the query string contents because it may have sensitive data.
|
50
|
+
@include_query_string = options[:include_query_string] || false
|
48
51
|
end
|
49
52
|
|
50
53
|
# Add a logger to the Rack environment and call the next middleware.
|
@@ -67,7 +70,6 @@ module RightSupport::Rack
|
|
67
70
|
env["rack.logging.enabled"] = enabled = logging_enabled?(logger, env)
|
68
71
|
|
69
72
|
began_at = Time.now
|
70
|
-
|
71
73
|
log_request_begin(logger, env) if enabled
|
72
74
|
status, header, body = @app.call(env)
|
73
75
|
if env['sinatra.error'] && !env['sinatra.error.handled']
|
@@ -107,10 +109,10 @@ module RightSupport::Rack
|
|
107
109
|
remote_addr = env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-"
|
108
110
|
remote_addr = remote_addr.ljust(15)
|
109
111
|
|
110
|
-
#
|
111
|
-
#
|
112
|
+
# If we're not logging the contents of the query string we only log the fact that a query
|
113
|
+
# string was present.
|
112
114
|
if (query = env["QUERY_STRING"]) && !query.empty?
|
113
|
-
query_info = '?...'
|
115
|
+
query_info = @include_query_string ? "?#{CGI::escape(query)}" : '?...'
|
114
116
|
else
|
115
117
|
query_info = ''
|
116
118
|
end
|
data/right_support.gemspec
CHANGED
@@ -2,16 +2,14 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: right_support 2.8.38 ruby lib
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = "right_support"
|
9
|
-
s.version = "2.8.
|
8
|
+
s.version = "2.8.39"
|
10
9
|
|
11
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
11
|
s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
|
14
|
-
s.date = "
|
12
|
+
s.date = "2015-01-21"
|
15
13
|
s.description = "A toolkit of useful, reusable foundation code created by RightScale."
|
16
14
|
s.email = "support@rightscale.com"
|
17
15
|
s.extra_rdoc_files = [
|
@@ -148,11 +146,12 @@ Gem::Specification.new do |s|
|
|
148
146
|
]
|
149
147
|
s.homepage = "https://github.com/rightscale/right_support"
|
150
148
|
s.licenses = ["MIT"]
|
151
|
-
s.
|
149
|
+
s.require_paths = ["lib"]
|
150
|
+
s.rubygems_version = "1.8.15"
|
152
151
|
s.summary = "Reusable foundation code."
|
153
152
|
|
154
153
|
if s.respond_to? :specification_version then
|
155
|
-
s.specification_version =
|
154
|
+
s.specification_version = 3
|
156
155
|
|
157
156
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
158
157
|
s.add_development_dependency(%q<rake>, ["~> 10.0"])
|
@@ -14,7 +14,7 @@ describe RightSupport::Rack::RequestLogger do
|
|
14
14
|
context :initialize do
|
15
15
|
context 'without :logger option' do
|
16
16
|
it 'uses rack.logger' do
|
17
|
-
@logger.should_receive(:info)
|
17
|
+
@logger.should_receive(:info).at_least.once
|
18
18
|
@middleware.call(@env).should == [200, {}, 'body']
|
19
19
|
end
|
20
20
|
end
|
@@ -27,9 +27,9 @@ describe RightSupport::Rack::RequestLogger do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'logs the exception' do
|
30
|
-
@logger.should_receive(:error)
|
30
|
+
@logger.should_receive(:error).at_least.once
|
31
31
|
lambda {
|
32
|
-
@middleware.call(
|
32
|
+
@middleware.call(@env)
|
33
33
|
}.should raise_error
|
34
34
|
end
|
35
35
|
end
|
@@ -42,7 +42,7 @@ describe RightSupport::Rack::RequestLogger do
|
|
42
42
|
|
43
43
|
it 'logs the exception' do
|
44
44
|
@logger.should_receive(:info)
|
45
|
-
@logger.should_receive(:error)
|
45
|
+
@logger.should_receive(:error).at_least.once
|
46
46
|
@middleware.call(@env)
|
47
47
|
end
|
48
48
|
|
@@ -64,12 +64,12 @@ describe RightSupport::Rack::RequestLogger do
|
|
64
64
|
|
65
65
|
it 'does not limit if logger in debug mode' do
|
66
66
|
@logger.should_receive(:level).and_return(Logger::DEBUG)
|
67
|
-
@logger.should_receive(:info)
|
67
|
+
@logger.should_receive(:info).at_least.once
|
68
68
|
@middleware.call(@env)
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'does not limit if HTTP_X_DEBUG set' do
|
72
|
-
@logger.should_receive(:info)
|
72
|
+
@logger.should_receive(:info).at_least.once
|
73
73
|
@middleware.call(@env.merge('HTTP_X_DEBUG' => true))
|
74
74
|
end
|
75
75
|
|
@@ -86,13 +86,44 @@ describe RightSupport::Rack::RequestLogger do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'sets rack.logging.enabled in Rack environment' do
|
89
|
-
@logger.should_receive(:info)
|
89
|
+
@logger.should_receive(:info).at_least.once
|
90
90
|
@env.merge!('PATH_INFO' => '/my/app')
|
91
91
|
@middleware.call(@env)
|
92
92
|
@env['rack.logging.enabled'].should be_true
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
+
context 'when logging the query string' do
|
97
|
+
before(:each) do
|
98
|
+
@options = {}
|
99
|
+
@env.merge!('PATH_INFO' => '/my/app', 'QUERY_STRING' => 'foo=bar')
|
100
|
+
@middleware = RightSupport::Rack::RequestLogger.new(@app, @options)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'does not log the query string by default' do
|
104
|
+
@logger.should_receive(:info).with(FlexMock.on { |arg| arg.should =~ /\/my\/app\?\.{3}/ } )
|
105
|
+
@middleware.send(:log_request_begin, @logger, @env)
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'when the include_query_string option is true' do
|
109
|
+
it 'logs the query string' do
|
110
|
+
@options[:include_query_string] = true
|
111
|
+
@middleware = RightSupport::Rack::RequestLogger.new(@app, @options)
|
112
|
+
@logger.should_receive(:info).with(FlexMock.on { |arg| arg.should =~ /\/my\/app\?foo%3Dbar/ } )
|
113
|
+
@middleware.send(:log_request_begin, @logger, @env)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'when the include_query_string option is false' do
|
118
|
+
it 'does not log the query string' do
|
119
|
+
@options[:include_query_string] = false
|
120
|
+
@middleware = RightSupport::Rack::RequestLogger.new(@app, @options)
|
121
|
+
@logger.should_receive(:info).with(FlexMock.on { |arg| arg.should =~ /\/my\/app\?\.{3}/ } )
|
122
|
+
@middleware.send(:log_request_begin, @logger, @env)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
96
127
|
context 'Shard ID logging' do
|
97
128
|
before(:each) do
|
98
129
|
@logger = mock_logger
|
metadata
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_support
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 97
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 8
|
9
|
+
- 39
|
10
|
+
version: 2.8.39
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
12
|
+
authors:
|
7
13
|
- Tony Spataro
|
8
14
|
- Sergey Sergyenko
|
9
15
|
- Ryan Williamson
|
@@ -13,90 +19,95 @@ authors:
|
|
13
19
|
autorequire:
|
14
20
|
bindir: bin
|
15
21
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
22
|
+
|
23
|
+
date: 2015-01-21 00:00:00 Z
|
24
|
+
dependencies:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
prerelease: false
|
19
27
|
name: rake
|
20
|
-
requirement: !ruby/object:Gem::Requirement
|
21
|
-
requirements:
|
22
|
-
- - "~>"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '10.0'
|
25
28
|
type: :development
|
29
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
hash: 35
|
35
|
+
segments:
|
36
|
+
- 10
|
37
|
+
- 0
|
38
|
+
version: "10.0"
|
39
|
+
requirement: *id001
|
40
|
+
- !ruby/object:Gem::Dependency
|
26
41
|
prerelease: false
|
27
|
-
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
requirements:
|
29
|
-
- - "~>"
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: '10.0'
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
42
|
name: jeweler
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
35
|
-
requirements:
|
36
|
-
- - "~>"
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: '2.0'
|
39
43
|
type: :development
|
44
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 3
|
50
|
+
segments:
|
51
|
+
- 2
|
52
|
+
- 0
|
53
|
+
version: "2.0"
|
54
|
+
requirement: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
40
56
|
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
43
|
-
- - "~>"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '2.0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
57
|
name: ruby-debug
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '0'
|
53
58
|
type: :development
|
54
|
-
|
55
|
-
|
56
|
-
requirements:
|
59
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
57
62
|
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirement: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
prerelease: false
|
61
71
|
name: pry
|
62
|
-
requirement: !ruby/object:Gem::Requirement
|
63
|
-
requirements:
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '0'
|
67
72
|
type: :development
|
68
|
-
|
69
|
-
|
70
|
-
requirements:
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
71
76
|
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
requirement: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
prerelease: false
|
75
85
|
name: pry-byebug
|
76
|
-
requirement: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '0'
|
81
86
|
type: :development
|
82
|
-
|
83
|
-
|
84
|
-
requirements:
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
85
90
|
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirement: *id005
|
88
97
|
description: A toolkit of useful, reusable foundation code created by RightScale.
|
89
98
|
email: support@rightscale.com
|
90
99
|
executables: []
|
100
|
+
|
91
101
|
extensions: []
|
92
|
-
|
102
|
+
|
103
|
+
extra_rdoc_files:
|
93
104
|
- LICENSE
|
94
105
|
- README.md
|
95
|
-
files:
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
106
|
+
files:
|
107
|
+
- .coveralls.yml
|
108
|
+
- .rspec
|
109
|
+
- .simplecov
|
110
|
+
- .travis.yml
|
100
111
|
- CHANGELOG.rdoc
|
101
112
|
- Gemfile
|
102
113
|
- Gemfile.lock
|
@@ -220,27 +231,37 @@ files:
|
|
220
231
|
- spec/validation/openssl_spec.rb
|
221
232
|
- spec/validation/ssh_spec.rb
|
222
233
|
homepage: https://github.com/rightscale/right_support
|
223
|
-
licenses:
|
234
|
+
licenses:
|
224
235
|
- MIT
|
225
|
-
metadata: {}
|
226
236
|
post_install_message:
|
227
237
|
rdoc_options: []
|
228
|
-
|
238
|
+
|
239
|
+
require_paths:
|
229
240
|
- lib
|
230
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
231
|
-
|
241
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
242
|
+
none: false
|
243
|
+
requirements:
|
232
244
|
- - ">="
|
233
|
-
- !ruby/object:Gem::Version
|
234
|
-
|
235
|
-
|
236
|
-
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
hash: 3
|
247
|
+
segments:
|
248
|
+
- 0
|
249
|
+
version: "0"
|
250
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
+
none: false
|
252
|
+
requirements:
|
237
253
|
- - ">="
|
238
|
-
- !ruby/object:Gem::Version
|
239
|
-
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
hash: 3
|
256
|
+
segments:
|
257
|
+
- 0
|
258
|
+
version: "0"
|
240
259
|
requirements: []
|
260
|
+
|
241
261
|
rubyforge_project:
|
242
|
-
rubygems_version:
|
262
|
+
rubygems_version: 1.8.15
|
243
263
|
signing_key:
|
244
|
-
specification_version:
|
264
|
+
specification_version: 3
|
245
265
|
summary: Reusable foundation code.
|
246
266
|
test_files: []
|
267
|
+
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: e0cb72f5d96896f6a249867296e5a6ee14021caa
|
4
|
-
data.tar.gz: 930f29d6b579d374ddadf6636c3687aeb12f394e
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 9bc745e71199150c1c3097efe6ba4ec77549e6c5d34ae7fdd899710f5122adde38e77b01a56f4e826e8e49a297eed2534fc1be78cf72ffb924e79beb6335b064
|
7
|
-
data.tar.gz: e823929462c375b3bb12f51c91fd39780de10eec2194232d32c5ea649166709f523bc2cad31f4030d588a9f95eebd38ba84d969c6f4aa9a195f223d188fbac28
|