protocol-http1 0.13.2 → 0.14.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.
Potentially problematic release.
This version of protocol-http1 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/protocol/http1/body/chunked.rb +3 -4
- data/lib/protocol/http1/connection.rb +7 -6
- data/lib/protocol/http1/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 972a37dfc7d2658f54c796f85054bec8bdb2827e595a42b874d276d320015aa7
|
4
|
+
data.tar.gz: d50ec1a04e61727cb104e7d1224e90bd8c4dc63f41e71854b2376463456ee8ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d19773f15978c311cfba29096fdf6026279c04ee458db6492811368f9251cd54cb697db12f06f748d3130308cf91341a0377933a8c57f07dfceb805380212da1
|
7
|
+
data.tar.gz: 2b804b15e98404899673468bc63f35adf3417d0e6a31e54e3cb77d262c65918242b062de9fa72e302c5b99403482ff1b8f5ec3ce43bf0bb43215d21d0dd91cac
|
@@ -26,7 +26,6 @@ module Protocol
|
|
26
26
|
module HTTP1
|
27
27
|
module Body
|
28
28
|
class Chunked < HTTP::Body::Readable
|
29
|
-
TRAILERS = 'trailers'
|
30
29
|
CRLF = "\r\n"
|
31
30
|
|
32
31
|
def initialize(stream, headers)
|
@@ -62,7 +61,7 @@ module Protocol
|
|
62
61
|
if length == 0
|
63
62
|
@finished = true
|
64
63
|
|
65
|
-
|
64
|
+
read_trailer
|
66
65
|
|
67
66
|
return nil
|
68
67
|
end
|
@@ -89,9 +88,9 @@ module Protocol
|
|
89
88
|
@stream.gets(CRLF, chomp: true)
|
90
89
|
end
|
91
90
|
|
92
|
-
def
|
91
|
+
def read_trailer
|
93
92
|
while line = read_line
|
94
|
-
# Empty line indicates end of
|
93
|
+
# Empty line indicates end of trailer:
|
95
94
|
break if line.empty?
|
96
95
|
|
97
96
|
if match = line.match(HEADER)
|
@@ -301,6 +301,7 @@ module Protocol
|
|
301
301
|
end
|
302
302
|
|
303
303
|
@stream.write(chunk)
|
304
|
+
@stream.flush unless body.ready?
|
304
305
|
end
|
305
306
|
|
306
307
|
@stream.flush
|
@@ -310,7 +311,7 @@ module Protocol
|
|
310
311
|
end
|
311
312
|
end
|
312
313
|
|
313
|
-
def write_chunked_body(body, head,
|
314
|
+
def write_chunked_body(body, head, trailer = nil)
|
314
315
|
@stream.write("transfer-encoding: chunked\r\n\r\n")
|
315
316
|
|
316
317
|
if head
|
@@ -333,9 +334,9 @@ module Protocol
|
|
333
334
|
@stream.flush unless body.ready?
|
334
335
|
end
|
335
336
|
|
336
|
-
if
|
337
|
+
if trailer
|
337
338
|
@stream.write("0\r\n")
|
338
|
-
write_headers(
|
339
|
+
write_headers(trailer)
|
339
340
|
@stream.write("\r\n")
|
340
341
|
else
|
341
342
|
@stream.write("0\r\n\r\n")
|
@@ -364,11 +365,11 @@ module Protocol
|
|
364
365
|
@stream.close_write
|
365
366
|
end
|
366
367
|
|
367
|
-
def write_body(version, body, head = false,
|
368
|
+
def write_body(version, body, head = false, trailer = nil)
|
368
369
|
if body.nil?
|
369
370
|
write_connection_header(version)
|
370
371
|
write_empty_body(body)
|
371
|
-
elsif length = body.length and
|
372
|
+
elsif length = body.length and trailer.nil?
|
372
373
|
write_connection_header(version)
|
373
374
|
write_fixed_length_body(body, length, head)
|
374
375
|
elsif body.empty?
|
@@ -378,7 +379,7 @@ module Protocol
|
|
378
379
|
elsif @persistent and version == HTTP11
|
379
380
|
write_connection_header(version)
|
380
381
|
# We specifically ensure that non-persistent connections do not use chunked response, so that hijacking works as expected.
|
381
|
-
write_chunked_body(body, head,
|
382
|
+
write_chunked_body(body, head, trailer)
|
382
383
|
else
|
383
384
|
@persistent = false
|
384
385
|
write_connection_header(version)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: protocol-http
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.22'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.22'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|