protocol-http1 0.34.1 → 0.35.1
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/context/getting-started.md +117 -0
- data/context/index.yaml +12 -0
- data/lib/protocol/http1/body/chunked.rb +10 -1
- data/lib/protocol/http1/body/fixed.rb +9 -1
- data/lib/protocol/http1/body/remainder.rb +9 -1
- data/lib/protocol/http1/connection.rb +6 -2
- data/lib/protocol/http1/reason.rb +4 -4
- data/lib/protocol/http1/version.rb +1 -1
- data/lib/traces/provider/protocol/http1/connection.rb +71 -0
- data/lib/traces/provider/protocol/http1.rb +6 -0
- data/readme.md +48 -35
- data/releases.md +246 -0
- data.tar.gz.sig +0 -0
- metadata +7 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2726ec9583e06af47b9b37f5cefb493843bb1a5dff749a145bd117193048aa86
|
4
|
+
data.tar.gz: f1c9bd6f71750cf67d038c98926048e3927b69f4efc64a49f92374f9d01b0b31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2b40ff72b50573db8975890a1ddd2a3366725407315f16d336aa72153caddd9a7a2d547b05bd12418dafbcc7f8810dde442821e600e4ee13a36c9aae0b7858
|
7
|
+
data.tar.gz: ca70b6a65753b759d933495a8ca034b6fe3c431d869b6b08bd8ebb9a53488057be2c585c7c7b9d7c880a009d3edd341b973bbe8744ad05b5cd6e5df97e72035a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# Getting Started
|
2
|
+
|
3
|
+
This guide explains how to get started with `protocol-http1`, a low-level implementation of the HTTP/1 protocol for building HTTP clients and servers.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add the gem to your project:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ bundle add protocol-http1
|
11
|
+
```
|
12
|
+
|
13
|
+
## Core Concepts
|
14
|
+
|
15
|
+
`protocol-http1` provides a low-level implementation of the HTTP/1 protocol with several core concepts:
|
16
|
+
|
17
|
+
- A {ruby Protocol::HTTP1::Connection} which represents the main entry point for creating HTTP/1.1 clients and servers.
|
18
|
+
- Integration with the `Protocol::HTTP::Body` classes for handling request and response bodies.
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
`protocol-http1` can be used to build both HTTP clients and servers.
|
23
|
+
|
24
|
+
### HTTP Server
|
25
|
+
|
26
|
+
Here's a simple HTTP/1.1 server that responds to all requests with "Hello World":
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
#!/usr/bin/env ruby
|
30
|
+
|
31
|
+
require "socket"
|
32
|
+
require "protocol/http1/connection"
|
33
|
+
require "protocol/http/body/buffered"
|
34
|
+
|
35
|
+
# Test with: curl http://localhost:8080/
|
36
|
+
|
37
|
+
Addrinfo.tcp("0.0.0.0", 8080).listen do |server|
|
38
|
+
loop do
|
39
|
+
client, address = server.accept
|
40
|
+
connection = Protocol::HTTP1::Connection.new(client)
|
41
|
+
|
42
|
+
# Read request:
|
43
|
+
while request = connection.read_request
|
44
|
+
authority, method, path, version, headers, body = request
|
45
|
+
|
46
|
+
# Write response:
|
47
|
+
connection.write_response(version, 200, [["content-type", "text/plain"]])
|
48
|
+
connection.write_body(version, Protocol::HTTP::Body::Buffered.wrap(["Hello World"]))
|
49
|
+
|
50
|
+
break unless connection.persistent
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
The server:
|
57
|
+
|
58
|
+
1. Creates a new {ruby Protocol::HTTP1::Connection} for each client connection.
|
59
|
+
2. Reads incoming requests using `read_request`.
|
60
|
+
3. Sends responses using `write_response` and `write_body`.
|
61
|
+
4. Supports persistent connections by checking `connection.persistent`.
|
62
|
+
|
63
|
+
### HTTP Client
|
64
|
+
|
65
|
+
Here's a simple HTTP/1.1 client that makes multiple requests:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
#!/usr/bin/env ruby
|
69
|
+
|
70
|
+
require "async"
|
71
|
+
require "async/http/endpoint"
|
72
|
+
require "protocol/http1/connection"
|
73
|
+
|
74
|
+
Async do
|
75
|
+
endpoint = Async::HTTP::Endpoint.parse("http://localhost:8080")
|
76
|
+
|
77
|
+
peer = endpoint.connect
|
78
|
+
|
79
|
+
puts "Connected to #{peer} #{peer.remote_address.inspect}"
|
80
|
+
|
81
|
+
# IO Buffering...
|
82
|
+
client = Protocol::HTTP1::Connection.new(peer)
|
83
|
+
|
84
|
+
puts "Writing request..."
|
85
|
+
3.times do
|
86
|
+
client.write_request("localhost", "GET", "/", "HTTP/1.1", [["Accept", "*/*"]])
|
87
|
+
client.write_body("HTTP/1.1", nil)
|
88
|
+
|
89
|
+
puts "Reading response..."
|
90
|
+
response = client.read_response("GET")
|
91
|
+
version, status, reason, headers, body = response
|
92
|
+
|
93
|
+
puts "Got response: #{response.inspect}"
|
94
|
+
puts body&.read
|
95
|
+
end
|
96
|
+
|
97
|
+
puts "Closing client..."
|
98
|
+
client.close
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
The client:
|
103
|
+
|
104
|
+
1. Creates a connection to a server using `Async::HTTP::Endpoint`.
|
105
|
+
2. Creates a {ruby Protocol::HTTP1::Connection} wrapper around the socket.
|
106
|
+
3. Sends requests using `write_request` and `write_body`.
|
107
|
+
4. Reads responses using `read_response`.
|
108
|
+
5. Properly closes the connection when done.
|
109
|
+
|
110
|
+
### Connection Management
|
111
|
+
|
112
|
+
The {ruby Protocol::HTTP1::Connection} handles:
|
113
|
+
|
114
|
+
- **Request/Response Parsing**: Automatically parses HTTP/1.1 request and response formats.
|
115
|
+
- **Persistent Connections**: Supports HTTP/1.1 keep-alive for multiple requests over one connection.
|
116
|
+
- **Body Handling**: Integrates with `Protocol::HTTP::Body` classes for streaming and buffered content.
|
117
|
+
- **Header Management**: Properly handles HTTP headers as arrays of key-value pairs.
|
data/context/index.yaml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Automatically generated context index for Utopia::Project guides.
|
2
|
+
# Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
|
3
|
+
---
|
4
|
+
description: A low level implementation of the HTTP/1 protocol.
|
5
|
+
metadata:
|
6
|
+
documentation_uri: https://socketry.github.io/protocol-http1/
|
7
|
+
source_code_uri: https://github.com/socketry/protocol-http1.git
|
8
|
+
files:
|
9
|
+
- path: getting-started.md
|
10
|
+
title: Getting Started
|
11
|
+
description: This guide explains how to get started with `protocol-http1`, a low-level
|
12
|
+
implementation of the HTTP/1 protocol for building HTTP clients and servers.
|
@@ -116,7 +116,16 @@ module Protocol
|
|
116
116
|
|
117
117
|
# @returns [String] a human-readable representation of the body.
|
118
118
|
def inspect
|
119
|
-
"\#<#{self.class} #{@length} bytes read in #{@count} chunks>"
|
119
|
+
"\#<#{self.class} #{@length} bytes read in #{@count} chunks, #{@finished ? 'finished' : 'reading'}>"
|
120
|
+
end
|
121
|
+
|
122
|
+
# @returns [Hash] JSON representation for tracing and debugging.
|
123
|
+
def as_json(...)
|
124
|
+
super.merge(
|
125
|
+
count: @count,
|
126
|
+
finished: @finished,
|
127
|
+
state: @connection ? "open" : "closed"
|
128
|
+
)
|
120
129
|
end
|
121
130
|
|
122
131
|
private
|
@@ -74,7 +74,15 @@ module Protocol
|
|
74
74
|
|
75
75
|
# @returns [String] a human-readable representation of the body.
|
76
76
|
def inspect
|
77
|
-
"
|
77
|
+
"#<#{self.class} #{@length} bytes, #{@remaining} remaining, #{empty? ? 'finished' : 'reading'}>"
|
78
|
+
end
|
79
|
+
|
80
|
+
# @returns [Hash] JSON representation for tracing and debugging.
|
81
|
+
def as_json(...)
|
82
|
+
super.merge(
|
83
|
+
remaining: @remaining,
|
84
|
+
state: @connection ? "open" : "closed"
|
85
|
+
)
|
78
86
|
end
|
79
87
|
end
|
80
88
|
end
|
@@ -60,7 +60,15 @@ module Protocol
|
|
60
60
|
|
61
61
|
# @returns [String] a human-readable representation of the body.
|
62
62
|
def inspect
|
63
|
-
"
|
63
|
+
"#<#{self.class} #{@block_size} byte blocks, #{empty? ? 'finished' : 'reading'}>"
|
64
|
+
end
|
65
|
+
|
66
|
+
# @returns [Hash] JSON representation for tracing and debugging.
|
67
|
+
def as_json(...)
|
68
|
+
super.merge(
|
69
|
+
block_size: @block_size,
|
70
|
+
state: @connection ? "open" : "closed"
|
71
|
+
)
|
64
72
|
end
|
65
73
|
end
|
66
74
|
end
|
@@ -274,7 +274,9 @@ module Protocol
|
|
274
274
|
# @parameter status [Integer] the HTTP status code.
|
275
275
|
# @parameter headers [Hash] the HTTP headers.
|
276
276
|
# @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
|
277
|
-
def write_response(version, status, headers, reason =
|
277
|
+
def write_response(version, status, headers, reason = nil)
|
278
|
+
reason ||= Reason::DESCRIPTIONS[status]
|
279
|
+
|
278
280
|
unless @state == :open or @state == :half_closed_remote
|
279
281
|
raise ProtocolError, "Cannot write response in state: #{@state}!"
|
280
282
|
end
|
@@ -292,7 +294,9 @@ module Protocol
|
|
292
294
|
# @parameter headers [Hash] the HTTP headers.
|
293
295
|
# @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
|
294
296
|
# @raises [ProtocolError] if the connection is not in the open or half-closed remote state.
|
295
|
-
def write_interim_response(version, status, headers, reason =
|
297
|
+
def write_interim_response(version, status, headers, reason = nil)
|
298
|
+
reason ||= Reason::DESCRIPTIONS[status]
|
299
|
+
|
296
300
|
unless @state == :open or @state == :half_closed_remote
|
297
301
|
raise ProtocolError, "Cannot write interim response in state: #{@state}!"
|
298
302
|
end
|
@@ -15,7 +15,7 @@ module Protocol
|
|
15
15
|
101 => "Switching Protocols",
|
16
16
|
102 => "Processing",
|
17
17
|
103 => "Early Hints",
|
18
|
-
|
18
|
+
|
19
19
|
200 => "OK",
|
20
20
|
201 => "Created",
|
21
21
|
202 => "Accepted",
|
@@ -26,7 +26,7 @@ module Protocol
|
|
26
26
|
207 => "Multi-Status",
|
27
27
|
208 => "Already Reported",
|
28
28
|
226 => "IM Used",
|
29
|
-
|
29
|
+
|
30
30
|
300 => "Multiple Choices",
|
31
31
|
301 => "Moved Permanently",
|
32
32
|
302 => "Found",
|
@@ -38,7 +38,7 @@ module Protocol
|
|
38
38
|
306 => "Switch Proxy",
|
39
39
|
307 => "Temporary Redirect",
|
40
40
|
308 => "Permanent Redirect",
|
41
|
-
|
41
|
+
|
42
42
|
400 => "Bad Request",
|
43
43
|
401 => "Unauthorized",
|
44
44
|
402 => "Payment Required",
|
@@ -66,7 +66,7 @@ module Protocol
|
|
66
66
|
429 => "Too Many Requests",
|
67
67
|
431 => "Request Header Fields Too Large",
|
68
68
|
451 => "Unavailable for Legal Reasons",
|
69
|
-
|
69
|
+
|
70
70
|
500 => "Internal Server Error",
|
71
71
|
501 => "Not Implemented",
|
72
72
|
502 => "Bad Gateway",
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2025, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "../../../../protocol/http1/connection"
|
7
|
+
|
8
|
+
Traces::Provider(Protocol::HTTP1::Connection) do
|
9
|
+
def write_request(authority, method, target, version, headers)
|
10
|
+
attributes = {
|
11
|
+
authority: authority,
|
12
|
+
method: method,
|
13
|
+
target: target,
|
14
|
+
version: version,
|
15
|
+
headers: headers&.to_h,
|
16
|
+
}
|
17
|
+
|
18
|
+
Traces.trace("protocol.http1.connection.write_request", attributes: attributes) do
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_response(version, status, headers, reason = nil)
|
24
|
+
attributes = {
|
25
|
+
version: version,
|
26
|
+
status: status,
|
27
|
+
headers: headers&.to_h,
|
28
|
+
}
|
29
|
+
|
30
|
+
Traces.trace("protocol.http1.connection.write_response", attributes: attributes) do
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def write_interim_response(version, status, headers, reason = nil)
|
36
|
+
attributes = {
|
37
|
+
version: version,
|
38
|
+
status: status,
|
39
|
+
headers: headers&.to_h,
|
40
|
+
reason: reason,
|
41
|
+
}
|
42
|
+
|
43
|
+
Traces.trace("protocol.http1.connection.write_interim_response", attributes: attributes) do
|
44
|
+
super
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def write_body(version, body, head = false, trailer = nil)
|
49
|
+
attributes = {
|
50
|
+
version: version,
|
51
|
+
head: head,
|
52
|
+
trailer: trailer,
|
53
|
+
body: body&.as_json,
|
54
|
+
}
|
55
|
+
|
56
|
+
Traces.trace("protocol.http1.connection.write_body", attributes: attributes) do |span|
|
57
|
+
super
|
58
|
+
rescue => error
|
59
|
+
# Capture the body state at the time of the error for EPIPE debugging:
|
60
|
+
span["error.body"] = body&.as_json
|
61
|
+
span["error.connection"] = {
|
62
|
+
state: @state,
|
63
|
+
persistent: @persistent,
|
64
|
+
count: @count,
|
65
|
+
stream_closed: @stream.nil?
|
66
|
+
}
|
67
|
+
|
68
|
+
raise error
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/readme.md
CHANGED
@@ -22,42 +22,55 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Please see the [project documentation](https://socketry.github.io/protocol-http1/) for more details.
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
27
|
+
- [Getting Started](https://socketry.github.io/protocol-http1/guides/getting-started/index) - This guide explains how to get started with `protocol-http1`, a low-level implementation of the HTTP/1 protocol for building HTTP clients and servers.
|
28
|
+
|
29
|
+
## Releases
|
30
|
+
|
31
|
+
Please see the [project releases](https://socketry.github.io/protocol-http1/releases/index) for all releases.
|
32
|
+
|
33
|
+
### v0.35.0
|
34
|
+
|
35
|
+
- Add traces provider for `Protocol::HTTP1::Connection`.
|
36
|
+
|
37
|
+
### v0.34.1
|
38
|
+
|
39
|
+
- Fix connection state handling to allow idempotent response body closing.
|
40
|
+
- Add `kisaten` fuzzing integration for improved security testing.
|
41
|
+
|
42
|
+
### v0.34.0
|
43
|
+
|
44
|
+
- Support empty header values in HTTP parsing for better compatibility.
|
45
|
+
|
46
|
+
### v0.33.0
|
47
|
+
|
48
|
+
- Support high-byte characters in HTTP headers for improved international compatibility.
|
49
|
+
|
50
|
+
### v0.32.0
|
51
|
+
|
52
|
+
- Fix header parsing to handle tab characters between values correctly.
|
53
|
+
- Complete documentation coverage for all public APIs.
|
54
|
+
|
55
|
+
### v0.31.0
|
56
|
+
|
57
|
+
- Enforce one-way transition for persistent connections to prevent invalid state changes.
|
58
|
+
|
59
|
+
### v0.30.0
|
60
|
+
|
61
|
+
- Make `authority` header optional in HTTP requests for improved flexibility.
|
62
|
+
|
63
|
+
### v0.29.0
|
64
|
+
|
65
|
+
- Add block/yield interface to `read_request` and `read_response` methods.
|
66
|
+
|
67
|
+
### v0.28.1
|
68
|
+
|
69
|
+
- Fix handling of `nil` lines in HTTP parsing.
|
70
|
+
|
71
|
+
### v0.28.0
|
72
|
+
|
73
|
+
- Add configurable maximum line length to prevent denial of service attacks.
|
61
74
|
|
62
75
|
## Contributing
|
63
76
|
|
data/releases.md
ADDED
@@ -0,0 +1,246 @@
|
|
1
|
+
# Releases
|
2
|
+
|
3
|
+
## v0.35.0
|
4
|
+
|
5
|
+
- Add traces provider for `Protocol::HTTP1::Connection`.
|
6
|
+
|
7
|
+
## v0.34.1
|
8
|
+
|
9
|
+
- Fix connection state handling to allow idempotent response body closing.
|
10
|
+
- Add `kisaten` fuzzing integration for improved security testing.
|
11
|
+
|
12
|
+
## v0.34.0
|
13
|
+
|
14
|
+
- Support empty header values in HTTP parsing for better compatibility.
|
15
|
+
|
16
|
+
## v0.33.0
|
17
|
+
|
18
|
+
- Support high-byte characters in HTTP headers for improved international compatibility.
|
19
|
+
|
20
|
+
## v0.32.0
|
21
|
+
|
22
|
+
- Fix header parsing to handle tab characters between values correctly.
|
23
|
+
- Complete documentation coverage for all public APIs.
|
24
|
+
|
25
|
+
## v0.31.0
|
26
|
+
|
27
|
+
- Enforce one-way transition for persistent connections to prevent invalid state changes.
|
28
|
+
|
29
|
+
## v0.30.0
|
30
|
+
|
31
|
+
- Make `authority` header optional in HTTP requests for improved flexibility.
|
32
|
+
|
33
|
+
## v0.29.0
|
34
|
+
|
35
|
+
- Add block/yield interface to `read_request` and `read_response` methods.
|
36
|
+
|
37
|
+
## v0.28.1
|
38
|
+
|
39
|
+
- Fix handling of `nil` lines in HTTP parsing.
|
40
|
+
|
41
|
+
## v0.28.0
|
42
|
+
|
43
|
+
- Add configurable maximum line length to prevent denial of service attacks.
|
44
|
+
|
45
|
+
## v0.27.0
|
46
|
+
|
47
|
+
- Improve error message clarity and debugging information.
|
48
|
+
- Separate state machine logic from connection callbacks for better architecture.
|
49
|
+
|
50
|
+
## v0.26.0
|
51
|
+
|
52
|
+
- Improve error handling propagation through connection closure.
|
53
|
+
|
54
|
+
## v0.25.0
|
55
|
+
|
56
|
+
- Fix connection stream handling when closing response bodies.
|
57
|
+
- Improve connection state management for better reliability.
|
58
|
+
|
59
|
+
## v0.24.0
|
60
|
+
|
61
|
+
- Add connection state tracking for safer connection reuse.
|
62
|
+
|
63
|
+
## v0.23.0
|
64
|
+
|
65
|
+
- Add `Body#discard` method support for improved resource management.
|
66
|
+
|
67
|
+
## v0.22.0
|
68
|
+
|
69
|
+
- Improve handling of underlying stream objects for better stability.
|
70
|
+
|
71
|
+
## v0.21.0
|
72
|
+
|
73
|
+
- Fix connection persistence handling for `1xx` responses and remainder bodies.
|
74
|
+
- Improve debug output readability by using `.inspect` instead of `.dump`.
|
75
|
+
- Enhanced request upgrade body handling.
|
76
|
+
|
77
|
+
## v0.20.0
|
78
|
+
|
79
|
+
- Restructure error hierarchy for better error handling consistency.
|
80
|
+
|
81
|
+
## v0.19.1
|
82
|
+
|
83
|
+
- Fix stream flushing in `write_body_and_close` for proper connection cleanup.
|
84
|
+
|
85
|
+
## v0.19.0
|
86
|
+
|
87
|
+
- Add `#hijacked?` method to check connection hijack status.
|
88
|
+
|
89
|
+
## v0.18.0
|
90
|
+
|
91
|
+
- Add persistent connection handling examples.
|
92
|
+
- Improve performance by avoiding blocking operations on `eof?` checks.
|
93
|
+
|
94
|
+
## v0.17.0
|
95
|
+
|
96
|
+
- Add `HTTP/1` client and server example implementations.
|
97
|
+
|
98
|
+
## v0.16.1
|
99
|
+
|
100
|
+
- Allow external control of persistent connection settings.
|
101
|
+
- Separate request line and response status line parsing for better maintainability.
|
102
|
+
|
103
|
+
## v0.16.0
|
104
|
+
|
105
|
+
- Add support for HTTP interim (informational) responses like `103 Early Hints`.
|
106
|
+
- Improve error messages by including `content_length` in debugging output.
|
107
|
+
|
108
|
+
## v0.15.1
|
109
|
+
|
110
|
+
- Add strict validation for `content-length` and chunk length values.
|
111
|
+
|
112
|
+
## v0.15.0
|
113
|
+
|
114
|
+
- Migrate test suite to `Sus` testing framework with 100% coverage.
|
115
|
+
|
116
|
+
## v0.14.6
|
117
|
+
|
118
|
+
- Handle `IOError` for closed streams gracefully.
|
119
|
+
- Improve memory management by removing string ownership model.
|
120
|
+
- Add early hints server example.
|
121
|
+
|
122
|
+
## v0.14.4
|
123
|
+
|
124
|
+
- Improve trailer handling when content length is known in advance.
|
125
|
+
|
126
|
+
## v0.14.3
|
127
|
+
|
128
|
+
- Enhanced trailer support with comprehensive test coverage.
|
129
|
+
|
130
|
+
## v0.14.2
|
131
|
+
|
132
|
+
- Prefer chunked transfer encoding when possible for better streaming performance.
|
133
|
+
|
134
|
+
## v0.14.1
|
135
|
+
|
136
|
+
- Improve error handling when reading chunk length lines.
|
137
|
+
|
138
|
+
## v0.14.0
|
139
|
+
|
140
|
+
- Rename "trailers" to "trailer" for HTTP specification compliance.
|
141
|
+
|
142
|
+
## v0.13.2
|
143
|
+
|
144
|
+
- Enable `HTTP/1.1` connections to write fixed-length message bodies.
|
145
|
+
|
146
|
+
## v0.13.1
|
147
|
+
|
148
|
+
- Fix `HTTP/1` request parsing example in documentation.
|
149
|
+
|
150
|
+
## v0.13.0
|
151
|
+
|
152
|
+
- Implement pessimistic flushing strategy for better performance.
|
153
|
+
- Add fuzzing infrastructure for security testing.
|
154
|
+
|
155
|
+
## v0.12.0
|
156
|
+
|
157
|
+
- Update dependencies to latest compatible versions.
|
158
|
+
|
159
|
+
## v0.11.1
|
160
|
+
|
161
|
+
- Improve header and trailer processing logic.
|
162
|
+
- Update behavior to match new `write_body` semantics.
|
163
|
+
|
164
|
+
## v0.11.0
|
165
|
+
|
166
|
+
- Add comprehensive HTTP trailer support for chunked transfers.
|
167
|
+
- Simplify chunked encoding implementation.
|
168
|
+
|
169
|
+
## v0.10.3
|
170
|
+
|
171
|
+
- Improve handling of `HEAD` requests and responses.
|
172
|
+
- Better error handling for incomplete fixed-length message bodies.
|
173
|
+
|
174
|
+
## v0.10.2
|
175
|
+
|
176
|
+
- Add RFC-compliant header validation during read and write operations.
|
177
|
+
- Improve performance with `frozen_string_literals: true`.
|
178
|
+
|
179
|
+
## v0.10.1
|
180
|
+
|
181
|
+
- Drop support for Ruby 2.3 (end of life).
|
182
|
+
- Validate that response header values don't contain `CR` or `LF` characters.
|
183
|
+
|
184
|
+
## v0.10.0
|
185
|
+
|
186
|
+
- Parse HTTP `connection` header values as case-insensitive per RFC specification.
|
187
|
+
|
188
|
+
## v0.9.0
|
189
|
+
|
190
|
+
- Enhanced `Remainder` body implementation with comprehensive test coverage.
|
191
|
+
- Improve HTTP `CONNECT` method handling for both client and server.
|
192
|
+
- Improve performance by removing array allocation in method arguments.
|
193
|
+
|
194
|
+
## v0.8.3
|
195
|
+
|
196
|
+
- Restore Ruby 2.3 compatibility using monkey patches.
|
197
|
+
- Enhanced test suite with improved memory and file handling utilities.
|
198
|
+
|
199
|
+
## v0.8.2
|
200
|
+
|
201
|
+
- Simplify HTTP request line validation logic.
|
202
|
+
|
203
|
+
## v0.8.1
|
204
|
+
|
205
|
+
- Improve error handling and recovery for malformed HTTP requests.
|
206
|
+
|
207
|
+
## v0.8.0
|
208
|
+
|
209
|
+
- Add automatic HTTP reason phrase generation based on status codes.
|
210
|
+
|
211
|
+
## v0.7.0
|
212
|
+
|
213
|
+
- Enhanced connection hijacking support for pooled connections.
|
214
|
+
|
215
|
+
## v0.6.0
|
216
|
+
|
217
|
+
- Adopt `Protocol::HTTP` Body abstractions for better consistency.
|
218
|
+
- Require callers to handle hijacking for `HTTP/1` protocol upgrades.
|
219
|
+
- Add flexible request/response body and upgrade handling.
|
220
|
+
- Fix WebSocket compatibility issues with Safari browser.
|
221
|
+
|
222
|
+
## v0.5.0
|
223
|
+
|
224
|
+
- Return `nil` when unable to read HTTP request line (connection closed).
|
225
|
+
|
226
|
+
## v0.4.1
|
227
|
+
|
228
|
+
- Ensure output streams are properly closed within accept blocks.
|
229
|
+
|
230
|
+
## v0.4.0
|
231
|
+
|
232
|
+
- Improve handling of HTTP upgrade request and response message bodies.
|
233
|
+
|
234
|
+
## v0.3.0
|
235
|
+
|
236
|
+
- Enhanced support for partial connection hijacking and protocol upgrades.
|
237
|
+
|
238
|
+
## v0.2.0
|
239
|
+
|
240
|
+
- Improve error handling throughout the codebase.
|
241
|
+
|
242
|
+
## v0.1.0
|
243
|
+
|
244
|
+
- Initial public release of `Protocol::HTTP1`.
|
245
|
+
- Low-level `HTTP/1.0` and `HTTP/1.1` protocol implementation.
|
246
|
+
- Support for persistent connections, chunked transfer encoding, and connection upgrades.
|
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.35.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -61,6 +61,8 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- context/getting-started.md
|
65
|
+
- context/index.yaml
|
64
66
|
- lib/protocol/http1.rb
|
65
67
|
- lib/protocol/http1/body.rb
|
66
68
|
- lib/protocol/http1/body/chunked.rb
|
@@ -70,8 +72,11 @@ files:
|
|
70
72
|
- lib/protocol/http1/error.rb
|
71
73
|
- lib/protocol/http1/reason.rb
|
72
74
|
- lib/protocol/http1/version.rb
|
75
|
+
- lib/traces/provider/protocol/http1.rb
|
76
|
+
- lib/traces/provider/protocol/http1/connection.rb
|
73
77
|
- license.md
|
74
78
|
- readme.md
|
79
|
+
- releases.md
|
75
80
|
homepage: https://github.com/socketry/protocol-http1
|
76
81
|
licenses:
|
77
82
|
- MIT
|
@@ -92,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
97
|
- !ruby/object:Gem::Version
|
93
98
|
version: '0'
|
94
99
|
requirements: []
|
95
|
-
rubygems_version: 3.6.
|
100
|
+
rubygems_version: 3.6.9
|
96
101
|
specification_version: 4
|
97
102
|
summary: A low level implementation of the HTTP/1 protocol.
|
98
103
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|