protocol-http1 0.16.0 → 0.16.1

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: bd649e1cfc933db22108e92849ddbe40f516b5f37c5c9b01db704764c445554c
4
- data.tar.gz: 3c38f467000c80e62831ca4d4ecf19e787ea7176871461d228e6d7817198580a
3
+ metadata.gz: f969e504112849ed6eccb047bd8e240fc79dc92efd2835f8676469064fe2656c
4
+ data.tar.gz: 25ffd9feeede23158051a130c5047f80a1f6f72b5c438e9adbc7fc1296add536
5
5
  SHA512:
6
- metadata.gz: 2db727958d638bb129d1062fa22ca1149994c41c5a3b23ca2b50409e0d761e2494f959aa21d407bd2cf9019754707d13a46a7e4c33a2001fac1dcee8f65cd211
7
- data.tar.gz: e4c2a03cf2c9d2e021a81c5e63a9366875e521d8c6847e101fc64d9955f5fe84da79e05aaa54e6c1aa388c46edb791367573240e50743d5a0e54565028c8e3c0
6
+ metadata.gz: 0b40ee03ea89a7daf74e3e93a441b2ff2f1933657bb95440682d9eacf85487523a38a7fe1ef5aed251a2d784f0fd8b5cb87d674561a579b1f928ef104b7ef5d7
7
+ data.tar.gz: 7063c346d1de2461b0ad5ee40aaa9b3992f0eb37f5930ba62869bc1b01df0d3c91b268e65a757bb98026b740036796a3e42a85add7bd7421a2e098bdd79a4fd0
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2023, by Samuel Williams.
5
+ # Copyright, 2023, by Thomas Morgan.
5
6
 
6
7
  require 'protocol/http/body/readable'
7
8
 
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2019-2023, by Samuel Williams.
5
5
  # Copyright, 2019, by Brian Morearty.
6
6
  # Copyright, 2020, by Bruno Sutic.
7
+ # Copyright, 2023, by Thomas Morgan.
7
8
 
8
9
  require 'protocol/http/headers'
9
10
 
@@ -59,7 +60,14 @@ module Protocol
59
60
  attr :stream
60
61
 
61
62
  # Whether the connection is persistent.
62
- attr :persistent
63
+ # This determines what connection headers are sent in the response and whether
64
+ # the connection can be reused after the response is sent.
65
+ # This setting is automatically managed according to the nature of the request
66
+ # and response.
67
+ # Changing to false is safe.
68
+ # Changing to true from outside this class should generally be avoided and,
69
+ # depending on the response semantics, may be reset to false anyway.
70
+ attr_accessor :persistent
63
71
 
64
72
  # The number of requests processed.
65
73
  attr :count
@@ -165,7 +173,7 @@ module Protocol
165
173
  read_line? or raise EOFError
166
174
  end
167
175
 
168
- def read_request
176
+ def read_request_line
169
177
  return unless line = read_line?
170
178
 
171
179
  if match = line.match(REQUEST_LINE)
@@ -174,6 +182,13 @@ module Protocol
174
182
  raise InvalidRequest, line.inspect
175
183
  end
176
184
 
185
+ return method, path, version
186
+ end
187
+
188
+ def read_request
189
+ method, path, version = read_request_line
190
+ return unless method
191
+
177
192
  headers = read_headers
178
193
 
179
194
  @persistent = persistent?(version, method, headers)
@@ -185,11 +200,17 @@ module Protocol
185
200
  return headers.delete(HOST), method, path, version, headers, body
186
201
  end
187
202
 
188
- def read_response(method)
203
+ def read_response_line
189
204
  version, status, reason = read_line.split(/\s+/, 3)
190
205
 
191
206
  status = Integer(status)
192
207
 
208
+ return version, status, reason
209
+ end
210
+
211
+ def read_response(method)
212
+ version, status, reason = read_response_line
213
+
193
214
  headers = read_headers
194
215
 
195
216
  @persistent = persistent?(version, method, headers)
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP1
8
- VERSION = "0.16.0"
8
+ VERSION = "0.16.1"
9
9
  end
10
10
  end
data/license.md CHANGED
@@ -4,6 +4,7 @@ Copyright, 2019-2023, by Samuel Williams.
4
4
  Copyright, 2019, by Brian Morearty.
5
5
  Copyright, 2020, by Olle Jonsson.
6
6
  Copyright, 2020, by Bruno Sutic.
7
+ Copyright, 2023, by Thomas Morgan.
7
8
 
8
9
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -75,4 +75,4 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
75
75
 
76
76
  ### Contributor Covenant
77
77
 
78
- This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
78
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Thomas Morgan
8
9
  - Brian Morearty
9
10
  - Bruno Sutic
10
11
  - Olle Jonsson
@@ -40,7 +41,7 @@ cert_chain:
40
41
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
41
42
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
42
43
  -----END CERTIFICATE-----
43
- date: 2023-10-24 00:00:00.000000000 Z
44
+ date: 2023-12-26 00:00:00.000000000 Z
44
45
  dependencies:
45
46
  - !ruby/object:Gem::Dependency
46
47
  name: protocol-http
@@ -84,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
85
  requirements:
85
86
  - - ">="
86
87
  - !ruby/object:Gem::Version
87
- version: 2.7.6b
88
+ version: '3.0'
88
89
  required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
91
  - - ">="
metadata.gz.sig CHANGED
Binary file