hermeneutics 1.18 → 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: 30ef238a8ac3f58a8778b80c224173b463bd58e00bbb970753378afa1988a45e
4
- data.tar.gz: 01c77b42b3c4d83458a18855dfef6213c298fa846a190819d270cd1a60731019
3
+ metadata.gz: e7351afc067372841e6fb5c69bb96adcac7da7fb096fc4dce59ac7717edec4ee
4
+ data.tar.gz: b6b44ac32989d86b8d43ac774e5bb54994fc36412ec9881e70670e4f7c17ade8
5
5
  SHA512:
6
- metadata.gz: 1c016e6745ccc87f68a8fbe138620d4dfa4e1984a5f43fb6ae3834a7c87ddf147d868aaf6c6b8f7dcbb0e8d8cc9800e541e7289a7b07c43066f9a2e97fdfefae
7
- data.tar.gz: c9e42192eef0f77921aa11789ad298014da46440a28a215712ca956950f60e2af086d83d84646ea7603b0544692fc4558534d4820029dc4fa684ebaa8739a689
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
@@ -588,10 +584,11 @@ module Hermeneutics
588
584
  when "base64" then
589
585
  (@body.unpack "m").join
590
586
  else
591
- @body
587
+ @body.chomp
588
+ end
589
+ if (c = @headers.content_type) and (cs = c[ :charset]) then
590
+ r.force_encoding cs
592
591
  end
593
- c = @headers.content_type
594
- r.force_encoding c&&c[ :charset] || Encoding::ASCII_8BIT
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.18".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.18'
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-08-03 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.18
100
+ rubygems_version: 3.4.20
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: CGI and mail handling