clogger 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.olddoc.yml +0 -1
- data/GIT-VERSION-GEN +1 -1
- data/clogger.gemspec +11 -12
- data/ext/clogger_ext/clogger.c +21 -5
- data/ext/clogger_ext/extconf.rb +1 -0
- data/lib/clogger/pure.rb +2 -2
- data/test/test_clogger_to_path.rb +9 -0
- metadata +18 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fad2c597e9da6f1f0799f727b478bc7eb3fda9e
|
4
|
+
data.tar.gz: 51d9cd99ef1d7a077a81eb781fd3b0991d431375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a64530e68a68736f3e5793badd51a1d2564dd2d5fae68b5b86707856232a933d40266a558bb4fe59ad46abfa6ba9d450a057a0f04192d647654d0163d68954b4
|
7
|
+
data.tar.gz: fb4421ce77d637fc99bb8321332dc5544cb050326aa634ba6d0ec4c1367954176001bd4d370ac3134016b0ba4738a9a0d32de8df5d41392595a0e2338284b941
|
data/.olddoc.yml
CHANGED
@@ -3,7 +3,6 @@ rdoc_url: https://bogomips.org/clogger/
|
|
3
3
|
cgit_url: https://bogomips.org/clogger.git
|
4
4
|
git_url: git://bogomips.org/clogger.git
|
5
5
|
public_email: clogger-public@bogomips.org
|
6
|
-
private_email: clogger@bogomips.org
|
7
6
|
ml_url:
|
8
7
|
- https://bogomips.org/clogger-public/
|
9
8
|
- http://ou63pmih66umazou.onion/clogger-public/
|
data/GIT-VERSION-GEN
CHANGED
data/clogger.gemspec
CHANGED
@@ -1,24 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'olddoc'
|
4
|
-
extend Olddoc::Gemspec
|
5
|
-
name, summary, title = readme_metadata
|
1
|
+
manifest = File.exist?('.manifest') ?
|
2
|
+
IO.readlines('.manifest').map!(&:chomp!) : `git ls-files`.split("\n")
|
6
3
|
|
7
4
|
Gem::Specification.new do |s|
|
8
5
|
s.name = %q{clogger}
|
9
|
-
s.version = ENV[
|
10
|
-
s.homepage =
|
6
|
+
s.version = (ENV['VERSION'] || '2.1.0').dup
|
7
|
+
s.homepage = 'https://bogomips.org/clogger/'
|
11
8
|
s.authors = ["cloggers"]
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.
|
9
|
+
s.summary = 'configurable request logging for Rack'
|
10
|
+
s.description = File.read('README').split("\n\n")[1]
|
11
|
+
s.email = %q{clogger-public@bogomips.org}
|
12
|
+
s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
|
13
|
+
File.exist?(f)
|
14
|
+
end
|
15
15
|
s.files = manifest
|
16
|
-
s.summary = summary
|
17
16
|
s.test_files = %w(test/test_clogger.rb test/test_clogger_to_path.rb)
|
18
17
|
|
19
18
|
# HeaderHash wasn't case-insensitive in old versions
|
20
19
|
s.add_dependency(%q<rack>, ['>= 1.0', '< 3.0'])
|
20
|
+
s.add_development_dependency('test-unit', '~> 3.0')
|
21
21
|
s.extensions = %w(ext/clogger_ext/extconf.rb)
|
22
|
-
|
23
22
|
s.licenses = %w(LGPL-2.1+)
|
24
23
|
end
|
data/ext/clogger_ext/clogger.c
CHANGED
@@ -29,6 +29,7 @@
|
|
29
29
|
* under.
|
30
30
|
*/
|
31
31
|
static clockid_t hopefully_CLOCK_MONOTONIC;
|
32
|
+
static VALUE mark_ary;
|
32
33
|
|
33
34
|
static void check_clock(void)
|
34
35
|
{
|
@@ -682,6 +683,7 @@ static VALUE cwrite(struct clogger *c)
|
|
682
683
|
|
683
684
|
if (c->fd >= 0) {
|
684
685
|
write_full(c->fd, RSTRING_PTR(dst), RSTRING_LEN(dst));
|
686
|
+
/* no need for RB_GC_GUARD(dst) here, marked as c->log_buf */
|
685
687
|
} else {
|
686
688
|
VALUE logger = c->logger;
|
687
689
|
|
@@ -948,7 +950,7 @@ static VALUE clogger_init_copy(VALUE clone, VALUE orig)
|
|
948
950
|
|
949
951
|
#define CONST_GLOBAL_STR2(var, val) do { \
|
950
952
|
g_##var = rb_obj_freeze(rb_str_new(val, sizeof(val) - 1)); \
|
951
|
-
|
953
|
+
rb_ary_push(mark_ary, g_##var); \
|
952
954
|
} while (0)
|
953
955
|
|
954
956
|
#define CONST_GLOBAL_STR(val) CONST_GLOBAL_STR2(val, #val)
|
@@ -961,14 +963,23 @@ static VALUE clogger_init_copy(VALUE clone, VALUE orig)
|
|
961
963
|
* used to delegate +:to_path+ checks for Rack webservers that optimize
|
962
964
|
* static file serving
|
963
965
|
*/
|
964
|
-
static VALUE respond_to(VALUE
|
966
|
+
static VALUE respond_to(int argc, VALUE *argv, VALUE self)
|
965
967
|
{
|
966
968
|
struct clogger *c = clogger_get(self);
|
967
|
-
|
969
|
+
VALUE method, include_all;
|
970
|
+
ID id;
|
968
971
|
|
972
|
+
rb_scan_args(argc, argv, "11", &method, &include_all);
|
973
|
+
id = rb_to_id(method);
|
969
974
|
if (close_id == id)
|
970
975
|
return Qtrue;
|
971
|
-
|
976
|
+
|
977
|
+
#ifdef HAVE_RB_OBJ_RESPOND_TO
|
978
|
+
return rb_obj_respond_to(c->body, id, RTEST(include_all));
|
979
|
+
#endif
|
980
|
+
if (argc == 1)
|
981
|
+
return rb_respond_to(c->body, id);
|
982
|
+
return rb_funcallv(c->body, respond_to_id, argc, argv);
|
972
983
|
}
|
973
984
|
|
974
985
|
/*
|
@@ -1014,6 +1025,9 @@ void Init_clogger_ext(void)
|
|
1014
1025
|
{
|
1015
1026
|
VALUE tmp;
|
1016
1027
|
|
1028
|
+
mark_ary = rb_ary_new();
|
1029
|
+
rb_global_variable(&mark_ary);
|
1030
|
+
|
1017
1031
|
check_clock();
|
1018
1032
|
|
1019
1033
|
write_id = rb_intern("write");
|
@@ -1039,7 +1053,7 @@ void Init_clogger_ext(void)
|
|
1039
1053
|
rb_define_method(cClogger, "wrap_body?", clogger_wrap_body, 0);
|
1040
1054
|
rb_define_method(cClogger, "reentrant?", clogger_reentrant, 0);
|
1041
1055
|
rb_define_method(cClogger, "to_path", to_path, 0);
|
1042
|
-
rb_define_method(cClogger, "respond_to?", respond_to, 1);
|
1056
|
+
rb_define_method(cClogger, "respond_to?", respond_to, -1);
|
1043
1057
|
rb_define_method(cClogger, "body", body, 0);
|
1044
1058
|
CONST_GLOBAL_STR(REMOTE_ADDR);
|
1045
1059
|
CONST_GLOBAL_STR(HTTP_X_FORWARDED_FOR);
|
@@ -1059,4 +1073,6 @@ void Init_clogger_ext(void)
|
|
1059
1073
|
tmp = rb_const_get(rb_cObject, rb_intern("Rack"));
|
1060
1074
|
tmp = rb_const_get(tmp, rb_intern("Utils"));
|
1061
1075
|
cHeaderHash = rb_const_get(tmp, rb_intern("HeaderHash"));
|
1076
|
+
|
1077
|
+
rb_obj_freeze(mark_ary);
|
1062
1078
|
}
|
data/ext/clogger_ext/extconf.rb
CHANGED
@@ -22,6 +22,7 @@ begin
|
|
22
22
|
have_func('rb_thread_call_without_gvl', 'ruby/thread.h')
|
23
23
|
have_func('rb_thread_blocking_region', 'ruby.h')
|
24
24
|
have_func('rb_thread_io_blocking_region', 'ruby.h')
|
25
|
+
have_func('rb_obj_respond_to', 'ruby/intern.h')
|
25
26
|
create_makefile('clogger_ext')
|
26
27
|
rescue Object => err
|
27
28
|
warn "E: #{err.inspect}"
|
data/lib/clogger/pure.rb
CHANGED
@@ -77,8 +77,8 @@ class Clogger
|
|
77
77
|
@logger.respond_to?(:fileno) ? @logger.fileno : nil
|
78
78
|
end
|
79
79
|
|
80
|
-
def respond_to?(
|
81
|
-
:close ==
|
80
|
+
def respond_to?(method, include_all=false)
|
81
|
+
:close == method.to_sym || @body.respond_to?(method, include_all)
|
82
82
|
end
|
83
83
|
|
84
84
|
def to_path
|
@@ -14,6 +14,10 @@ class MyBody < Struct.new(:to_path, :closed)
|
|
14
14
|
def close
|
15
15
|
self.closed = true
|
16
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def privtest
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
class TestCloggerToPath < Test::Unit::TestCase
|
@@ -59,6 +63,11 @@ class TestCloggerToPath < Test::Unit::TestCase
|
|
59
63
|
status, headers, body = app.call(@req)
|
60
64
|
assert_instance_of(Clogger, body)
|
61
65
|
check_body(body)
|
66
|
+
|
67
|
+
assert ! body.respond_to?(:privtest)
|
68
|
+
assert body.respond_to?(:privtest, true)
|
69
|
+
assert ! body.respond_to?(:privtest, false)
|
70
|
+
|
62
71
|
assert logger.string.empty?
|
63
72
|
assert_equal tmp.path, body.to_path
|
64
73
|
body.close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloggers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -30,19 +30,30 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: test-unit
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
33
47
|
description: |-
|
34
48
|
clogger is Rack middleware for logging HTTP requests. The log format
|
35
49
|
is customizable so you can specify exactly which fields to log.
|
36
|
-
email: clogger@bogomips.org
|
50
|
+
email: clogger-public@bogomips.org
|
37
51
|
executables: []
|
38
52
|
extensions:
|
39
53
|
- ext/clogger_ext/extconf.rb
|
40
54
|
extra_rdoc_files:
|
41
55
|
- README
|
42
56
|
- NEWS
|
43
|
-
- lib/clogger.rb
|
44
|
-
- lib/clogger/format.rb
|
45
|
-
- lib/clogger/pure.rb
|
46
57
|
- ext/clogger_ext/clogger.c
|
47
58
|
- LICENSE
|
48
59
|
files:
|
@@ -95,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
106
|
version: '0'
|
96
107
|
requirements: []
|
97
108
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.6.
|
109
|
+
rubygems_version: 2.6.12
|
99
110
|
signing_key:
|
100
111
|
specification_version: 4
|
101
112
|
summary: configurable request logging for Rack
|