hermeneutics 1.19 → 1.20

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: e7351afc067372841e6fb5c69bb96adcac7da7fb096fc4dce59ac7717edec4ee
4
+ data.tar.gz: b6b44ac32989d86b8d43ac774e5bb54994fc36412ec9881e70670e4f7c17ade8
5
5
  SHA512:
6
- metadata.gz: c46402d7e8fcc79cf4ab5fa84605598e1484b58c18565951cd3262988186c893b106925ab00aa311f129b0f5ada19e6f1c38e0fdb778f8919988fcf09362f205
7
- data.tar.gz: efea58f7a00dbb5816b882a8dd656b6c6706bb384c73a8231ab4d3c34b5fe1ec5c82b211555383e3d6ff8ce9914e0a9a5e91ffc559ccc50ce22cd2fc1c4d5f17
6
+ metadata.gz: 2a25ca9a02a251f4f4bd48c0bf944aa9686d3ae7a71881fd934eefeb5b78a017f8e72e65418178532e46f9e3972e95c1cfd255a6bcc36e2aa32d8b778505a832
7
+ data.tar.gz: 9717ee81ba5eeca02aa8b9557e2cf7d83c1494b5ade0d3c65c2745df9b4aad6718cb7834c932e55191f1c28256a0cde30caaa3898af1d748100ee33cbdf9fb18
@@ -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.20".freeze
17
17
  SUMMARY = "CGI and mail handling"
18
18
 
19
19
  DESCRIPTION = <<~EOT
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.20'
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: 2023-12-25 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.4.20
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: CGI and mail handling