protocol-http1 0.35.1 → 0.35.2
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 +11 -3
- data/lib/protocol/http1/version.rb +1 -1
- data/readme.md +5 -4
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 4bf3ffc440b97d40277fdf64e1962d31edb93d808fc6a3059234af3b8be6e9c0
|
4
|
+
data.tar.gz: 9495d1bf263831872363193cbe2dab89775c57d503eacbb74bd83dffe7863f8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 549410520376936764b4c55653bcc2bc30fd770fa63c3befeb634d6e909be02ce94dd8a11c0823a46a9de106fb6d3fce03eeacc03066e0a100aa797328641f80
|
7
|
+
data.tar.gz: f0d72eb0d29c2e9d97fe725e53da409c5dbd0352df6575d44a27bab6a4d55fef929eb8a72adc0d484cb471479b383f425541881996c229f31ab2703b055ebb94
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -350,17 +350,25 @@ module Protocol
|
|
350
350
|
# Read a line from the connection.
|
351
351
|
#
|
352
352
|
# @returns [String | Nil] the line read, or nil if the connection is closed.
|
353
|
-
# @raises [EOFError] if the connection is closed.
|
354
353
|
# @raises [LineLengthError] if the line is too long.
|
354
|
+
# @raises [ProtocolError] if the line is not terminated properly.
|
355
355
|
def read_line?
|
356
356
|
if line = @stream.gets(CRLF, @maximum_line_length)
|
357
357
|
unless line.chomp!(CRLF)
|
358
|
-
|
359
|
-
|
358
|
+
if line.bytesize == @maximum_line_length
|
359
|
+
# This basically means that the request line, response line, header, or chunked length line is too long:
|
360
|
+
raise LineLengthError, "Line too long!"
|
361
|
+
else
|
362
|
+
# This means the line was not terminated properly, which is a protocol violation:
|
363
|
+
raise ProtocolError, "Line not terminated properly!"
|
364
|
+
end
|
360
365
|
end
|
361
366
|
end
|
362
367
|
|
363
368
|
return line
|
369
|
+
# If a connection is shut down abruptly, we treat it as EOF, but only specifically in `read_line?`.
|
370
|
+
rescue Errno::ECONNRESET
|
371
|
+
return nil
|
364
372
|
end
|
365
373
|
|
366
374
|
# Read a line from the connection.
|
data/readme.md
CHANGED
@@ -30,6 +30,11 @@ 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.35.2
|
34
|
+
|
35
|
+
- Tidy up implementation of `read_line?` to handle line length errors and protocol violations more clearly.
|
36
|
+
- Improve error handling for unexpected connection closures (`Errno::ECONNRESET`) in `read_line?`.
|
37
|
+
|
33
38
|
### v0.35.0
|
34
39
|
|
35
40
|
- Add traces provider for `Protocol::HTTP1::Connection`.
|
@@ -68,10 +73,6 @@ Please see the [project releases](https://socketry.github.io/protocol-http1/rele
|
|
68
73
|
|
69
74
|
- Fix handling of `nil` lines in HTTP parsing.
|
70
75
|
|
71
|
-
### v0.28.0
|
72
|
-
|
73
|
-
- Add configurable maximum line length to prevent denial of service attacks.
|
74
|
-
|
75
76
|
## Contributing
|
76
77
|
|
77
78
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Releases
|
2
2
|
|
3
|
+
## v0.35.2
|
4
|
+
|
5
|
+
- Tidy up implementation of `read_line?` to handle line length errors and protocol violations more clearly.
|
6
|
+
- Improve error handling for unexpected connection closures (`Errno::ECONNRESET`) in `read_line?`.
|
7
|
+
|
3
8
|
## v0.35.0
|
4
9
|
|
5
10
|
- Add traces provider for `Protocol::HTTP1::Connection`.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|