protocol-http 0.14.3 → 0.14.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86bcb17655f18236f837f878f14ac61127c7438a55c74d5a59faa9328d91de39
4
- data.tar.gz: 142aeadbe21f997d06dbcbb713dc05fa64bb08edf3243a3da286e5a4d25c186a
3
+ metadata.gz: 6a49c7a92140dc05ce537c23ddb54a8e5b9c9c610d560459b92fb1d5f69aaef4
4
+ data.tar.gz: 249972b584e5c4bd0e13d54e88acbbb65a2b361d92dcd06427ed127ec192f2e8
5
5
  SHA512:
6
- metadata.gz: e6a7e0a1440e402f4283af52d1df3c451e0a8e9b38ed85f317bb7f419e6590d4d05f5877c540f38629e7dce53506d8017c59cd6fec59dfd48ae90741dd72aefa
7
- data.tar.gz: a7f7e12ba0220591f688582334fd03dac02416611112915af639ab983c289aef2c5100841c502c4eb1a783330e0cc98adef0f524c88bcc03b810ae679a9c8d68
6
+ metadata.gz: 62e4a29eba1014db803d8fbdb944551050540515aa35a9635f3fcbf6bbe40b935c44e6f516c0ef85275d1084f504639060a5c7ca3ac3753fb59a57d733dba027
7
+ data.tar.gz: 0da73f93d930607d4468327c581ff7bedcc60699603334aed92354fe46b5dee48dd9a20c08973c2de3fde127bcfe2a13efe4f11a89f01a404c42c91f556b2ce8
@@ -52,8 +52,12 @@ module Protocol
52
52
  # https://lists.w3.org/Archives/Public/ietf-http-wg/2014JanMar/1179.html
53
53
  return response if response.partial?
54
54
 
55
+ # Ensure that caches are aware we are varying the response based on the accept-encoding request header:
56
+ response.headers.add('vary', 'accept-encoding')
57
+
55
58
  # TODO use http-accept and sort by priority
56
59
  if !response.body.empty? and accept_encoding = request.headers['accept-encoding']
60
+
57
61
  if content_type = response.headers['content-type'] and @content_types =~ content_type
58
62
  body = response.body
59
63
 
@@ -105,10 +105,22 @@ module Protocol
105
105
  # This is deprecated.
106
106
  alias slice! extract
107
107
 
108
+ # Add the specified header key value pair.
109
+ # @param key [String] the header key.
110
+ # @param value [String] the header value to assign.
108
111
  def add(key, value)
109
112
  self[key] = value
110
113
  end
111
114
 
115
+ # Set the specified header key to the specified value, replacing any existing header keys with the same name.
116
+ # @param key [String] the header key to replace.
117
+ # @param value [String] the header value to assign.
118
+ def set(key, value)
119
+ # TODO This could be a bit more efficient:
120
+ self.delete(key)
121
+ self.add(key, value)
122
+ end
123
+
112
124
  def merge!(headers)
113
125
  headers.each do |key, value|
114
126
  self[key] = value
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Protocol
24
24
  module HTTP
25
- VERSION = "0.14.3"
25
+ VERSION = "0.14.4"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-08 00:00:00.000000000 Z
11
+ date: 2020-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: covered
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.0.6
134
+ rubygems_version: 3.1.2
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Provides abstractions to handle HTTP protocols.