protocol-http1 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/http1/connection.rb +5 -5
- data/lib/protocol/http1/version.rb +1 -1
- data/readme.md +8 -9
- data/releases.md +8 -0
- data.tar.gz.sig +0 -0
- metadata +4 -5
- metadata.gz.sig +0 -0
- data/lib/protocol/http1/reason.rb +0 -84
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab25a92df4b7a3a47fedfb27a10b76ef768fa1472b4e8e2af5f954671212ee02
|
|
4
|
+
data.tar.gz: 7f2c88ff5cd039ecd982e9129ee7b10441c42c65eaabd9cd70e1379e268aee29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34d8dbeb53722ca4128e5c0ce9dc228aa231b59987feeb26bb5dde04db942e662406a2a751a637cd98629d7da46099a9b1d5731bb9d5eb19f41179ae696ae8c3
|
|
7
|
+
data.tar.gz: 0a809c874a1a6143588025865f14681d839b6394c441731092d50cafc86bdd9ed0064890d51271015adce8bb701a1836d2c306bb9cdae8900e66b3d00809c4e6
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
# Copyright, 2024, by Anton Zhuravsky.
|
|
9
9
|
|
|
10
10
|
require "protocol/http/headers"
|
|
11
|
+
require "protocol/http/status"
|
|
11
12
|
|
|
12
|
-
require_relative "reason"
|
|
13
13
|
require_relative "error"
|
|
14
14
|
require_relative "body"
|
|
15
15
|
|
|
@@ -258,7 +258,7 @@ module Protocol
|
|
|
258
258
|
# @parameter target [String] the request target.
|
|
259
259
|
# @parameter version [String] the HTTP version.
|
|
260
260
|
# @parameter headers [Hash] the HTTP headers.
|
|
261
|
-
# @raises [
|
|
261
|
+
# @raises [RefusedError] if the request was not processed.
|
|
262
262
|
def write_request(authority, method, target, version, headers)
|
|
263
263
|
open!
|
|
264
264
|
|
|
@@ -267,7 +267,7 @@ module Protocol
|
|
|
267
267
|
|
|
268
268
|
write_headers(headers)
|
|
269
269
|
rescue
|
|
270
|
-
raise ::Protocol::HTTP::
|
|
270
|
+
raise ::Protocol::HTTP::RefusedError
|
|
271
271
|
end
|
|
272
272
|
|
|
273
273
|
# Write a response to the connection. It is expected you will write the body after this method.
|
|
@@ -277,7 +277,7 @@ module Protocol
|
|
|
277
277
|
# @parameter headers [Hash] the HTTP headers.
|
|
278
278
|
# @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
|
|
279
279
|
def write_response(version, status, headers, reason = nil)
|
|
280
|
-
reason ||=
|
|
280
|
+
reason ||= Protocol::HTTP::Status.description(status)
|
|
281
281
|
|
|
282
282
|
unless @state == :open or @state == :half_closed_remote
|
|
283
283
|
raise ProtocolError, "Cannot write response in state: #{@state}!"
|
|
@@ -297,7 +297,7 @@ module Protocol
|
|
|
297
297
|
# @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
|
|
298
298
|
# @raises [ProtocolError] if the connection is not in the open or half-closed remote state.
|
|
299
299
|
def write_interim_response(version, status, headers, reason = nil)
|
|
300
|
-
reason ||=
|
|
300
|
+
reason ||= Protocol::HTTP::Status.description(status)
|
|
301
301
|
|
|
302
302
|
unless @state == :open or @state == :half_closed_remote
|
|
303
303
|
raise ProtocolError, "Cannot write interim response in state: #{@state}!"
|
data/readme.md
CHANGED
|
@@ -30,6 +30,14 @@ Please see the [project documentation](https://socketry.github.io/protocol-http1
|
|
|
30
30
|
|
|
31
31
|
Please see the [project releases](https://socketry.github.io/protocol-http1/releases/index) for all releases.
|
|
32
32
|
|
|
33
|
+
### v0.40.0
|
|
34
|
+
|
|
35
|
+
- Use `Protocol::HTTP::Status` for standard HTTP status descriptions and remove the duplicate `Protocol::HTTP1::Reason` table.
|
|
36
|
+
|
|
37
|
+
### v0.39.0
|
|
38
|
+
|
|
39
|
+
- Rename `RequestRefusedError` -\> `RefusedError`.
|
|
40
|
+
|
|
33
41
|
### v0.38.0
|
|
34
42
|
|
|
35
43
|
- `write_request` now raises `Protocol::HTTP::RequestRefusedError` if the request line or headers cannot be written, indicating the request was not processed and can be safely retried.
|
|
@@ -64,15 +72,6 @@ Please see the [project releases](https://socketry.github.io/protocol-http1/rele
|
|
|
64
72
|
|
|
65
73
|
- Support empty header values in HTTP parsing for better compatibility.
|
|
66
74
|
|
|
67
|
-
### v0.33.0
|
|
68
|
-
|
|
69
|
-
- Support high-byte characters in HTTP headers for improved international compatibility.
|
|
70
|
-
|
|
71
|
-
### v0.32.0
|
|
72
|
-
|
|
73
|
-
- Fix header parsing to handle tab characters between values correctly.
|
|
74
|
-
- Complete documentation coverage for all public APIs.
|
|
75
|
-
|
|
76
75
|
## Contributing
|
|
77
76
|
|
|
78
77
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.40.0
|
|
4
|
+
|
|
5
|
+
- Use `Protocol::HTTP::Status` for standard HTTP status descriptions and remove the duplicate `Protocol::HTTP1::Reason` table.
|
|
6
|
+
|
|
7
|
+
## v0.39.0
|
|
8
|
+
|
|
9
|
+
- Rename `RequestRefusedError` -\> `RefusedError`.
|
|
10
|
+
|
|
3
11
|
## v0.38.0
|
|
4
12
|
|
|
5
13
|
- `write_request` now raises `Protocol::HTTP::RequestRefusedError` if the request line or headers cannot be written, indicating the request was not processed and can be safely retried.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protocol-http1
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.40.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -49,14 +49,14 @@ dependencies:
|
|
|
49
49
|
requirements:
|
|
50
50
|
- - "~>"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '0.
|
|
52
|
+
version: '0.68'
|
|
53
53
|
type: :runtime
|
|
54
54
|
prerelease: false
|
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
57
|
- - "~>"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '0.
|
|
59
|
+
version: '0.68'
|
|
60
60
|
executables: []
|
|
61
61
|
extensions: []
|
|
62
62
|
extra_rdoc_files: []
|
|
@@ -70,7 +70,6 @@ files:
|
|
|
70
70
|
- lib/protocol/http1/body/remainder.rb
|
|
71
71
|
- lib/protocol/http1/connection.rb
|
|
72
72
|
- lib/protocol/http1/error.rb
|
|
73
|
-
- lib/protocol/http1/reason.rb
|
|
74
73
|
- lib/protocol/http1/version.rb
|
|
75
74
|
- lib/traces/provider/protocol/http1.rb
|
|
76
75
|
- lib/traces/provider/protocol/http1/connection.rb
|
|
@@ -97,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
96
|
- !ruby/object:Gem::Version
|
|
98
97
|
version: '0'
|
|
99
98
|
requirements: []
|
|
100
|
-
rubygems_version: 4.0.
|
|
99
|
+
rubygems_version: 4.0.10
|
|
101
100
|
specification_version: 4
|
|
102
101
|
summary: A low level implementation of the HTTP/1 protocol.
|
|
103
102
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2019-2025, by Samuel Williams.
|
|
5
|
-
|
|
6
|
-
require "protocol/http/error"
|
|
7
|
-
|
|
8
|
-
module Protocol
|
|
9
|
-
module HTTP1
|
|
10
|
-
# Reason phrases for HTTP status codes.
|
|
11
|
-
module Reason
|
|
12
|
-
# Get the reason phrase for the given status code.
|
|
13
|
-
DESCRIPTIONS = {
|
|
14
|
-
100 => "Continue",
|
|
15
|
-
101 => "Switching Protocols",
|
|
16
|
-
102 => "Processing",
|
|
17
|
-
103 => "Early Hints",
|
|
18
|
-
|
|
19
|
-
200 => "OK",
|
|
20
|
-
201 => "Created",
|
|
21
|
-
202 => "Accepted",
|
|
22
|
-
203 => "Non-Authoritative Information",
|
|
23
|
-
204 => "No Content",
|
|
24
|
-
205 => "Reset Content",
|
|
25
|
-
206 => "Partial Content",
|
|
26
|
-
207 => "Multi-Status",
|
|
27
|
-
208 => "Already Reported",
|
|
28
|
-
226 => "IM Used",
|
|
29
|
-
|
|
30
|
-
300 => "Multiple Choices",
|
|
31
|
-
301 => "Moved Permanently",
|
|
32
|
-
302 => "Found",
|
|
33
|
-
303 => "See Other",
|
|
34
|
-
304 => "Not Modified",
|
|
35
|
-
305 => "Use Proxy",
|
|
36
|
-
|
|
37
|
-
# no longer used, but included for completeness
|
|
38
|
-
306 => "Switch Proxy",
|
|
39
|
-
307 => "Temporary Redirect",
|
|
40
|
-
308 => "Permanent Redirect",
|
|
41
|
-
|
|
42
|
-
400 => "Bad Request",
|
|
43
|
-
401 => "Unauthorized",
|
|
44
|
-
402 => "Payment Required",
|
|
45
|
-
403 => "Forbidden",
|
|
46
|
-
404 => "Not Found",
|
|
47
|
-
405 => "Method Not Allowed",
|
|
48
|
-
406 => "Not Acceptable",
|
|
49
|
-
407 => "Proxy Authentication Required",
|
|
50
|
-
408 => "Request Timeout",
|
|
51
|
-
409 => "Conflict",
|
|
52
|
-
410 => "Gone",
|
|
53
|
-
411 => "Length Required",
|
|
54
|
-
412 => "Precondition Failed",
|
|
55
|
-
413 => "Payload Too Large",
|
|
56
|
-
414 => "URI Too Long",
|
|
57
|
-
415 => "Unsupported Media Type",
|
|
58
|
-
416 => "Range Not Satisfiable",
|
|
59
|
-
417 => "Expectation Failed",
|
|
60
|
-
421 => "Misdirected Request",
|
|
61
|
-
422 => "Unprocessable Entity",
|
|
62
|
-
423 => "Locked",
|
|
63
|
-
424 => "Failed Dependency",
|
|
64
|
-
426 => "Upgrade Required",
|
|
65
|
-
428 => "Precondition Required",
|
|
66
|
-
429 => "Too Many Requests",
|
|
67
|
-
431 => "Request Header Fields Too Large",
|
|
68
|
-
451 => "Unavailable for Legal Reasons",
|
|
69
|
-
|
|
70
|
-
500 => "Internal Server Error",
|
|
71
|
-
501 => "Not Implemented",
|
|
72
|
-
502 => "Bad Gateway",
|
|
73
|
-
503 => "Service Unavailable",
|
|
74
|
-
504 => "Gateway Timeout",
|
|
75
|
-
505 => "HTTP Version Not Supported",
|
|
76
|
-
506 => "Variant Also Negotiates",
|
|
77
|
-
507 => "Insufficient Storage",
|
|
78
|
-
508 => "Loop Detected",
|
|
79
|
-
510 => "Not Extended",
|
|
80
|
-
511 => "Network Authentication Required"
|
|
81
|
-
}.freeze
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|