clogger 1.0.1 → 1.1.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.
- data/GIT-VERSION-GEN +1 -1
- data/README +1 -1
- data/clogger.gemspec +1 -1
- data/ext/clogger_ext/clogger.c +4 -3
- data/lib/clogger/pure.rb +4 -2
- data/test/test_clogger.rb +11 -2
- metadata +6 -6
data/GIT-VERSION-GEN
CHANGED
data/README
CHANGED
@@ -114,7 +114,7 @@ development. Patches should always be sent inline
|
|
114
114
|
All feedback (bug reports, user/development discussion, patches, pull
|
115
115
|
requests) go to the mailing list.
|
116
116
|
|
117
|
-
* mailto:clogger@librelist.
|
117
|
+
* mailto:clogger@librelist.org
|
118
118
|
|
119
119
|
Do not send HTML mail or attachments. Do not top post.
|
120
120
|
|
data/clogger.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.authors = ["cloggers"]
|
12
12
|
s.date = Time.now.utc.strftime('%Y-%m-%d')
|
13
13
|
s.description = readme_description
|
14
|
-
s.email = %q{clogger@librelist.
|
14
|
+
s.email = %q{clogger@librelist.org}
|
15
15
|
s.extra_rdoc_files = extra_rdoc_files(manifest)
|
16
16
|
s.files = manifest
|
17
17
|
s.rdoc_options = rdoc_options
|
data/ext/clogger_ext/clogger.c
CHANGED
@@ -161,7 +161,7 @@ static void init_buffers(struct clogger *c)
|
|
161
161
|
static inline int need_escape(unsigned c)
|
162
162
|
{
|
163
163
|
assert(c <= 0xff);
|
164
|
-
return !!(c == '\'' || c == '"' || c <= 0x1f);
|
164
|
+
return !!(c == '\'' || c == '"' || c <= 0x1f || c >= 0x7f);
|
165
165
|
}
|
166
166
|
|
167
167
|
/* we are encoding-agnostic, clients can send us all sorts of junk */
|
@@ -572,8 +572,7 @@ static void append_cookie(struct clogger *c, VALUE key)
|
|
572
572
|
cookie = g_dash;
|
573
573
|
} else {
|
574
574
|
cookie = rb_hash_aref(c->cookies, key);
|
575
|
-
|
576
|
-
cookie = g_dash;
|
575
|
+
cookie = NIL_P(cookie) ? g_dash : byte_xs(cookie);
|
577
576
|
}
|
578
577
|
rb_str_buf_append(c->log_buf, cookie);
|
579
578
|
}
|
@@ -890,10 +889,12 @@ static VALUE clogger_call(VALUE self, VALUE env)
|
|
890
889
|
env = rb_check_convert_type(env, T_HASH, "Hash", "to_hash");
|
891
890
|
|
892
891
|
if (c->wrap_body) {
|
892
|
+
/* XXX: we assume the existence of the GVL here: */
|
893
893
|
if (c->reentrant < 0) {
|
894
894
|
VALUE tmp = rb_hash_aref(env, g_rack_multithread);
|
895
895
|
c->reentrant = Qfalse == tmp ? 0 : 1;
|
896
896
|
}
|
897
|
+
|
897
898
|
if (c->reentrant) {
|
898
899
|
self = rb_obj_dup(self);
|
899
900
|
c = clogger_get(self);
|
data/lib/clogger/pure.rb
CHANGED
@@ -98,7 +98,9 @@ private
|
|
98
98
|
def byte_xs(s)
|
99
99
|
s = s.dup
|
100
100
|
s.force_encoding(Encoding::BINARY) if defined?(Encoding::BINARY)
|
101
|
-
s.gsub!(/(['"\x00-\x1f])/)
|
101
|
+
s.gsub!(/(['"\x00-\x1f\x7f-\xff])/) do |x|
|
102
|
+
"\\x#{$1.unpack('H2').first.upcase}"
|
103
|
+
end
|
102
104
|
s
|
103
105
|
end
|
104
106
|
|
@@ -175,7 +177,7 @@ private
|
|
175
177
|
t = Time.now
|
176
178
|
time_format(t.to_i, t.usec, op[1], op[2])
|
177
179
|
when OP_COOKIE
|
178
|
-
(env['rack.request.cookie_hash'][op[1]] rescue "-") || "-"
|
180
|
+
(byte_xs(env['rack.request.cookie_hash'][op[1]]) rescue "-") || "-"
|
179
181
|
else
|
180
182
|
raise "EDOOFUS #{op.inspect}"
|
181
183
|
end
|
data/test/test_clogger.rb
CHANGED
@@ -390,6 +390,15 @@ class TestClogger < Test::Unit::TestCase
|
|
390
390
|
assert_equal "a\\x0Ab\n", str.string
|
391
391
|
end
|
392
392
|
|
393
|
+
def test_escape_crazy_delete
|
394
|
+
str = StringIO.new
|
395
|
+
app = lambda { |env| [302, {}, [] ] }
|
396
|
+
cl = Clogger.new(app, :logger => str, :format => "$http_cookie")
|
397
|
+
@req["HTTP_COOKIE"] = "a\x7f\xff"
|
398
|
+
cl.call(@req)
|
399
|
+
assert_equal "a\\x7F\\xFF\n", str.string
|
400
|
+
end
|
401
|
+
|
393
402
|
def test_request_uri_fallback
|
394
403
|
str = StringIO.new
|
395
404
|
app = lambda { |env| [ 200, {}, [] ] }
|
@@ -415,9 +424,9 @@ class TestClogger < Test::Unit::TestCase
|
|
415
424
|
cl = Clogger.new(app,
|
416
425
|
:format => '$cookie_foo $cookie_quux',
|
417
426
|
:logger => str)
|
418
|
-
req = @req.merge('HTTP_COOKIE' => "foo=bar;quux=h&m")
|
427
|
+
req = @req.merge('HTTP_COOKIE' => "foo=bar;quux=h%7F&m")
|
419
428
|
status, headers, body = cl.call(req)
|
420
|
-
assert_equal "bar h&m\n", str.string
|
429
|
+
assert_equal "bar h\\x7F&m\n", str.string
|
421
430
|
end
|
422
431
|
|
423
432
|
def test_bogus_app_response
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- cloggers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06
|
18
|
+
date: 2011-12-06 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rack
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
description: |-
|
51
51
|
\Clogger is Rack middleware for logging HTTP requests. The log format
|
52
52
|
is customizable so you can specify exactly which fields to log.
|
53
|
-
email: clogger@librelist.
|
53
|
+
email: clogger@librelist.org
|
54
54
|
executables: []
|
55
55
|
|
56
56
|
extensions:
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements: []
|
127
127
|
|
128
128
|
rubyforge_project: clogger
|
129
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.11
|
130
130
|
signing_key:
|
131
131
|
specification_version: 3
|
132
132
|
summary: configurable request logging for Rack
|