hermeneutics 1.19 → 1.21

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
  SHA256:
3
- metadata.gz: 6b53149cdf7399298cdab861ffe457bda6072ed6373cc8be493afa978ac2e286
4
- data.tar.gz: d064ee9f8ba822ced298d07cae3ab06a574dce0817ad19f7a1ecc14a031486f4
3
+ metadata.gz: 26e095f585149d4c8a07af7a415cfcc003a3958cc45f4611490b3a018f19b94b
4
+ data.tar.gz: 20e963ec38f9c4dbace27a15c6c39097ab6bbf6a52528a2b5d4e40aaba15c193
5
5
  SHA512:
6
- metadata.gz: c46402d7e8fcc79cf4ab5fa84605598e1484b58c18565951cd3262988186c893b106925ab00aa311f129b0f5ada19e6f1c38e0fdb778f8919988fcf09362f205
7
- data.tar.gz: efea58f7a00dbb5816b882a8dd656b6c6706bb384c73a8231ab4d3c34b5fe1ec5c82b211555383e3d6ff8ce9914e0a9a5e91ffc559ccc50ce22cd2fc1c4d5f17
6
+ metadata.gz: 760bea637b51c7852ee0b6678af340f60e98fcab925f3376ff5e7ff147106a3d4532b1e7f8e3a3d0eada210826fa26467adb50c99a4c81978bdb08b795b819bf
7
+ data.tar.gz: 1e34626ab27cb6210a20d57f0e30bab31475b8d4040406fcab0636ca97f5a69c4edce39c8f3e9ceee5ddeb425b7e32816680c3c0f9fb6a2149a1a8181e5a0856
@@ -287,11 +287,13 @@ module Hermeneutics
287
287
  #
288
288
  def each_file new = nil
289
289
  p = File.join @mailbox, new ? NEW : CUR
290
- (Dir.new p).sort.each { |fn|
291
- next if fn.starts_with? "."
292
- path = File.join p, fn
293
- yield path
294
- }
290
+ Dir.open p do |d|
291
+ d.sort.each { |fn|
292
+ next if fn.starts_with? "."
293
+ path = File.join p, fn
294
+ yield path
295
+ }
296
+ end
295
297
  end
296
298
 
297
299
  # :call-seq:
@@ -151,7 +151,7 @@ module Hermeneutics
151
151
  when "GET", "HEAD" then
152
152
  Data::UrlEnc.new query_string
153
153
  when "POST" then
154
- data = $stdin.read
154
+ data = $stdin.binmode.read
155
155
  data.bytesize == content_length.to_i or
156
156
  warn "Content length #{content_length} is wrong (#{data.bytesize})."
157
157
  ct = ContentType.parse content_type
@@ -23,13 +23,12 @@ module Hermeneutics
23
23
  def parse input, **parameters
24
24
  b = parameters[ :boundary]
25
25
  b or raise ParseError, "Missing boundary parameter."
26
- input.encode! input.encoding, universal_newline: true
27
26
  list = input.split /^--#{Regexp.quote b}/
28
27
  prolog = list.shift
29
28
  epilog = list.pop
30
- epilog and epilog.slice! /\A--\n/ or raise "Missing last separator."
29
+ epilog and epilog.slice! /\A--\r?\n/ or raise "Missing last separator."
31
30
  list.each { |p|
32
- p.slice! /\A\n/ or raise "Malformed separator: #{b + p[/.*/]}."
31
+ p.slice! /\A\r?\n/ or raise "Malformed separator: #{b + p[/.*/]}."
33
32
  }
34
33
  list.map! { |t| Message.parse t }
35
34
  new b, prolog, list, epilog
@@ -483,14 +482,11 @@ module Hermeneutics
483
482
  private
484
483
 
485
484
  def parse_hb input
486
- hinput, input = input.split /^\n/, 2
485
+ hinput, b = input.split /^\r?\n/, 2
487
486
  h = parse_headers hinput
488
- c = h.content_type
489
- b = c.parse_mime input if c
490
- unless b then
491
- b = ""
492
- input.each_line { |l| b << l }
493
- b
487
+ b ||= b.to_s
488
+ if (c = h.content_type) and (bc = c.parse_mime b) then
489
+ b = bc
494
490
  end
495
491
  yield h, b
496
492
  end
@@ -590,8 +586,9 @@ module Hermeneutics
590
586
  else
591
587
  @body.chomp
592
588
  end
593
- c = @headers.content_type
594
- r.force_encoding c&&c[ :charset] || Encoding::ASCII_8BIT
589
+ if (c = @headers.content_type) and (cs = c[ :charset]) then
590
+ r.force_encoding cs
591
+ end
595
592
  r
596
593
  end
597
594
 
@@ -13,7 +13,7 @@
13
13
  module Hermeneutics
14
14
 
15
15
  NAME = "hermeneutics"
16
- VERSION = "1.19".freeze
16
+ VERSION = "1.21".freeze
17
17
  SUMMARY = "CGI and mail handling"
18
18
 
19
19
  DESCRIPTION = <<~EOT
@@ -21,7 +21,7 @@ module Hermeneutics
21
21
  and CSS. Further, it is a CGI library.
22
22
  EOT
23
23
 
24
- COPYRIGHT = "(C) 2013-2023 Bertram Scharpf"
24
+ COPYRIGHT = "(C) 2013-2024 Bertram Scharpf"
25
25
  LICENSE = "BSD-2-Clause"
26
26
  AUTHORS = [ "Bertram Scharpf"]
27
27
  MAIL = "<software@bertram-scharpf.de>"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hermeneutics
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.19'
4
+ version: '1.21'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-15 00:00:00.000000000 Z
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: supplement
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements:
99
99
  - Ruby, at least 3.0
100
- rubygems_version: 3.4.19
100
+ rubygems_version: 3.5.6
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: CGI and mail handling