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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d599688759448c6bf0402ae0ffe376133f79caa
4
- data.tar.gz: 87a801805a909d115597fd8fb89c839f81db9c59
3
+ metadata.gz: 6fad2c597e9da6f1f0799f727b478bc7eb3fda9e
4
+ data.tar.gz: 51d9cd99ef1d7a077a81eb781fd3b0991d431375
5
5
  SHA512:
6
- metadata.gz: c77852c8b454f4e7b67c3c1de5701506d7196e6d9307a14808ba28e1c69b48032b37f03b6b9ef281821b5c35bf818214e7c5a25956e95d195c7f8ccda068c81a
7
- data.tar.gz: 472bdd0b12d9d79d43ac97070c9daee1c156adf7eadb38c9d634a52cc6e72314f62dcf32d73bef4b9f6abbee387ef9603e90fd799ad1e3015023b897fbaafbaf
6
+ metadata.gz: a64530e68a68736f3e5793badd51a1d2564dd2d5fae68b5b86707856232a933d40266a558bb4fe59ad46abfa6ba9d450a057a0f04192d647654d0163d68954b4
7
+ data.tar.gz: fb4421ce77d637fc99bb8321332dc5544cb050326aa634ba6d0ec4c1367954176001bd4d370ac3134016b0ba4738a9a0d32de8df5d41392595a0e2338284b941
@@ -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/
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v2.1.0
4
+ DEF_VER=v2.2.0
5
5
 
6
6
  LF='
7
7
  '
@@ -1,24 +1,23 @@
1
- ENV["VERSION"] or abort "VERSION= must be specified"
2
- manifest = File.readlines('.manifest').map! { |x| x.chomp! }
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["VERSION"].dup
10
- s.homepage = Olddoc.config['rdoc_url']
6
+ s.version = (ENV['VERSION'] || '2.1.0').dup
7
+ s.homepage = 'https://bogomips.org/clogger/'
11
8
  s.authors = ["cloggers"]
12
- s.description = readme_description
13
- s.email = %q{clogger@bogomips.org}
14
- s.extra_rdoc_files = extra_rdoc_files(manifest)
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
@@ -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
- rb_global_variable(&g_##var); \
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 self, VALUE method)
966
+ static VALUE respond_to(int argc, VALUE *argv, VALUE self)
965
967
  {
966
968
  struct clogger *c = clogger_get(self);
967
- ID id = rb_to_id(method);
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
- return rb_respond_to(c->body, id);
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
  }
@@ -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}"
@@ -77,8 +77,8 @@ class Clogger
77
77
  @logger.respond_to?(:fileno) ? @logger.fileno : nil
78
78
  end
79
79
 
80
- def respond_to?(m)
81
- :close == m.to_sym || @body.respond_to?(m)
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.1.0
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: 2016-07-28 00:00:00.000000000 Z
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.6
109
+ rubygems_version: 2.6.12
99
110
  signing_key:
100
111
  specification_version: 4
101
112
  summary: configurable request logging for Rack