protocol-http1 0.16.0 → 0.17.0

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: 8d4495522852a254da8e7864cc481d08b807df88e786eafe2e40b2a87ac512ae
4
+ data.tar.gz: 9f505c0853068baaf3eb4871c10f782b03e9221437254d61d3741b5430ed81ec
5
5
  SHA512:
6
- metadata.gz: 2db727958d638bb129d1062fa22ca1149994c41c5a3b23ca2b50409e0d761e2494f959aa21d407bd2cf9019754707d13a46a7e4c33a2001fac1dcee8f65cd211
7
- data.tar.gz: e4c2a03cf2c9d2e021a81c5e63a9366875e521d8c6847e101fc64d9955f5fe84da79e05aaa54e6c1aa388c46edb791367573240e50743d5a0e54565028c8e3c0
6
+ metadata.gz: 8d727d33628c7cb500738fd0bb090ca32d3b2cffad056d4c0d6032bc2b619e6c35f511ce383c9155bbc214e487cce6a5a34a372671c8173a344cd73315946f07
7
+ data.tar.gz: 4ab44f130d572da7dd2cacc96ea476aa07b4072fc4489ce5aeaaf0b226b99287d1af37c3e52f4a5ffcb12e5acd0bd1ede3fcb34cb199b0eb554909684a15787f
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.17.0"
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.17.0
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