protocol-http 0.51.0 → 0.51.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/lib/protocol/http/accept_encoding.rb +24 -7
- data/lib/protocol/http/body/stream.rb +1 -1
- data/lib/protocol/http/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -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: 7152574d762fbdc22baa9dcd2f9d22931a2da4a9b3e0727af9580b7bebe31a1e
|
4
|
+
data.tar.gz: 8a704017b5e0897741233497d779a40eba812357238105bef7910090c08cf7a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bd538f9a03da7137f2f58c77777859b5a2b6b14bef08f055104427d9c029d4bc75912dcd10f8e385680c127439c78e6980436ee9200656f0a41b8d2342de0e8
|
7
|
+
data.tar.gz: 8a00a43b390046bba90ce8c523aa99cf5aff1a2fd1b3c6b3f480538ef9a201c2c9a6ef5646558feb649625498c95a224ef9ec1c1bfa78caa29f2b1a6128a7e55
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -21,6 +21,7 @@ module Protocol
|
|
21
21
|
# The default wrappers to use for decoding content.
|
22
22
|
DEFAULT_WRAPPERS = {
|
23
23
|
"gzip" => Body::Inflate.method(:for),
|
24
|
+
"identity" => ->(body) { body }, # Identity means no encoding
|
24
25
|
|
25
26
|
# There is no point including this:
|
26
27
|
# 'identity' => ->(body){body},
|
@@ -46,15 +47,31 @@ module Protocol
|
|
46
47
|
|
47
48
|
response = super
|
48
49
|
|
49
|
-
if body = response.body and !body.empty?
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
if body = response.body and !body.empty?
|
51
|
+
if content_encoding = response.headers[CONTENT_ENCODING]
|
52
|
+
# Process encodings in reverse order and remove them when they are decoded:
|
53
|
+
while name = content_encoding.last
|
54
|
+
# Look up wrapper with case-insensitive matching:
|
55
|
+
wrapper = @wrappers[name.downcase]
|
56
|
+
|
57
|
+
if wrapper
|
58
|
+
body = wrapper.call(body)
|
59
|
+
# Remove the encoding we just processed:
|
60
|
+
content_encoding.pop
|
61
|
+
else
|
62
|
+
# Unknown encoding - stop processing here:
|
63
|
+
break
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Update the response body:
|
68
|
+
response.body = body
|
69
|
+
|
70
|
+
# Remove the content-encoding header if we decoded all encodings:
|
71
|
+
if content_encoding.empty?
|
72
|
+
response.headers.delete(CONTENT_ENCODING)
|
54
73
|
end
|
55
74
|
end
|
56
|
-
|
57
|
-
response.body = body
|
58
75
|
end
|
59
76
|
|
60
77
|
return response
|
@@ -47,7 +47,7 @@ module Protocol
|
|
47
47
|
#
|
48
48
|
# If buffer is given, then the read data will be placed into buffer instead of a newly created String object.
|
49
49
|
#
|
50
|
-
# @
|
50
|
+
# @parameter length [Integer] the amount of data to read
|
51
51
|
# @parameter buffer [String] the buffer which will receive the data
|
52
52
|
# @returns [String] a buffer containing the data
|
53
53
|
def read(length = nil, buffer = nil)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.51.
|
4
|
+
version: 0.51.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.6.
|
125
|
+
rubygems_version: 3.6.9
|
126
126
|
specification_version: 4
|
127
127
|
summary: Provides abstractions to handle HTTP protocols.
|
128
128
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|