protocol-rack 0.2.4 → 0.2.5

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: 2b6a6be852ed5686a4a29416d5e7f308a0b8fecdac08945f7a94c654fe961295
4
- data.tar.gz: e0afd920038faa59a9739eb0780acc7d517d34fdd9bc336c80069c39b06892e4
3
+ metadata.gz: 01f7083e192f0a82ca6cf9cb8ff7b11aff04dae2cbe61d792fd7710b17947750
4
+ data.tar.gz: 1fcb416ae2acd121010c2d14969db1e0d7849a0dd21849a1cc17f2567ee6bddc
5
5
  SHA512:
6
- metadata.gz: 6d289be5ff94b209e23de3cb3569cfe76df31356daf072e2caf22ec34e22f3dce6e2e46cc027548b515c83ecd6186c1318f74a1bebaed388618ed7c221b704f4
7
- data.tar.gz: 36c188b1011e436f29fdbf2c317d0c81ed46ae1831a1439cad18248492a005f735d14f2babc5855fd455940018c5f26719978878a697794c17d2d35d1846216d
6
+ metadata.gz: bcd5be7a3aee2b0193055534283baf3b9b347775f61ea25cf412e92fe2d69b0c084c566af18ba38efda9a9b15e5573c6796901da9ef19e163917db76212e2219
7
+ data.tar.gz: 682fff0aee179137a373a390b335fd5e7a53b88a216e2fe8eddc95f991adebb568542b702e2644acbabb9ccf4a37bddbe775802d94e35e3a323738dbfd50bced
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  require 'console'
7
7
 
@@ -108,10 +108,12 @@ module Protocol
108
108
 
109
109
  if key.start_with?('rack.')
110
110
  meta[key] = value
111
- else
111
+ elsif value.is_a?(String)
112
112
  value.split("\n").each do |value|
113
113
  headers[key] = value
114
114
  end
115
+ else
116
+ headers[key] = value
115
117
  end
116
118
  end
117
119
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  require 'rack'
7
7
 
@@ -11,7 +11,7 @@ require_relative 'adapter/rack3'
11
11
  module Protocol
12
12
  module Rack
13
13
  module Adapter
14
- if ::Rack::RELEASE >= "3"
14
+ if ::Rack.release >= "3"
15
15
  IMPLEMENTATION = Rack3
16
16
  else
17
17
  IMPLEMENTATION = Rack2
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2022, by Samuel Williams.
5
+ # Copyright, 2023, by Genki Takiuchi.
5
6
 
6
7
  require 'async/io/buffer'
7
8
  require 'protocol/http/body/stream'
@@ -18,6 +19,7 @@ module Protocol
18
19
  # @parameter body [Protocol::HTTP::Body::Readable]
19
20
  def initialize(body)
20
21
  @body = body
22
+ @closed = false
21
23
 
22
24
  # Will hold remaining data in `#read`.
23
25
  @buffer = nil
@@ -46,6 +48,8 @@ module Protocol
46
48
 
47
49
  # Close the input and output bodies.
48
50
  def close(error = nil)
51
+ @closed = true
52
+
49
53
  if @body
50
54
  @body.close(error)
51
55
  @body = nil
@@ -74,7 +78,7 @@ module Protocol
74
78
 
75
79
  # Whether the stream has been closed.
76
80
  def closed?
77
- @body.nil?
81
+ @closed or @body.nil?
78
82
  end
79
83
 
80
84
  # Whether there are any input chunks remaining?
@@ -87,7 +91,7 @@ module Protocol
87
91
  def read_next
88
92
  if @body
89
93
  @body.read
90
- else
94
+ elsif @closed
91
95
  raise IOError, "Stream is not readable, input has been closed!"
92
96
  end
93
97
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  require 'protocol/http/request'
7
7
  require 'protocol/http/headers'
@@ -42,7 +42,7 @@ module Protocol
42
42
 
43
43
  def self.headers(env)
44
44
  headers = ::Protocol::HTTP::Headers.new
45
- env.each do |key, value|
45
+ env.each do |key, value|
46
46
  if key.start_with?('HTTP_')
47
47
  next if key == 'HTTP_HOST'
48
48
  headers[key[5..-1].gsub('_', '-').downcase] = value
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Rack
8
- VERSION = "0.2.4"
8
+ VERSION = "0.2.5"
9
9
  end
10
10
  end
data/license.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2022, by Samuel Williams.
3
+ Copyright, 2022-2023, by Samuel Williams.
4
+ Copyright, 2023, by Genki Takiuchi.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Genki Takiuchi
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain:
@@ -37,7 +38,7 @@ cert_chain:
37
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
40
  -----END CERTIFICATE-----
40
- date: 2022-09-06 00:00:00.000000000 Z
41
+ date: 2023-06-03 00:00:00.000000000 Z
41
42
  dependencies:
42
43
  - !ruby/object:Gem::Dependency
43
44
  name: protocol-http
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  - !ruby/object:Gem::Version
194
195
  version: '0'
195
196
  requirements: []
196
- rubygems_version: 3.3.7
197
+ rubygems_version: 3.4.7
197
198
  signing_key:
198
199
  specification_version: 4
199
200
  summary: An implementation of the Rack protocol/specification.
metadata.gz.sig CHANGED
Binary file