async-http-cache 0.4.4 → 0.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc8d7b58e3ba4a009b05a55f06a7ffbc546b20aa9d916c3b4bbaf054a99a9f38
4
- data.tar.gz: d6b71693a4f9272862f9e710b295a56966047411fcb903ef4029b30c2605b5a9
3
+ metadata.gz: 5ef0cd31192b81f8fc4acfefdb378d2ae673ec004b572555e1c1298a0afa5ba6
4
+ data.tar.gz: 554b926efed070b44a672c2e422cf7be1aa243cd619ab4260210d468321ff044
5
5
  SHA512:
6
- metadata.gz: 19269b3b4e941221415d4b94f9aa022ac49df8ed3f3e6b96a08f3eb48e6e224f3e68b16c56892fd69c0f4956eb6b79882abc515547a031207ab92d1b2be79c09
7
- data.tar.gz: 20a5a417aff84525e438667966dda756e57db643fe4ab236461c934d6c7ae4d6b92d53e273f720bcb62a85b70562e24e1623c4c0dbcb97fd20b0ecf3f5d01dd3
6
+ metadata.gz: f8e688e64d6cf8e734f80ef3cf1422de4b5ae89055d926b047c80d39ef2c23c70a5e085082e86a70fa09d912767505fc2bcaed1d837c3c3c1ce50a45efd3cc7e
7
+ data.tar.gz: 3e702d6db9c8764fd0d2932ba9bc3a27aafc76b001380f2dee77fcc4ceae350044593d36cb3661b945bda78f47bb951db43fa6b99d7fab5e51732a50d3cc3e18
checksums.yaml.gz.sig CHANGED
Binary file
@@ -3,19 +3,19 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
- require 'protocol/http/body/rewindable'
7
- require 'protocol/http/body/completable'
8
- require 'protocol/http/body/digestable'
6
+ require "protocol/http/body/rewindable"
7
+ require "protocol/http/body/completable"
8
+ require "protocol/http/body/digestable"
9
9
 
10
- require 'console'
11
- require 'console/event/failure'
10
+ require "console"
11
+ require "console/event/failure"
12
12
 
13
13
  module Async
14
14
  module HTTP
15
15
  module Cache
16
16
  module Body
17
- TRAILER = 'trailer'
18
- ETAG = 'etag'
17
+ TRAILER = "trailer"
18
+ ETAG = "etag"
19
19
 
20
20
  def self.wrap(response, &block)
21
21
  if body = response.body
@@ -4,24 +4,24 @@
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
  # Copyright, 2022, by Colin Kelley.
6
6
 
7
- require 'set'
8
- require 'protocol/http/middleware'
7
+ require "set"
8
+ require "protocol/http/middleware"
9
9
 
10
- require_relative 'body'
11
- require_relative 'response'
12
- require_relative 'store'
10
+ require_relative "body"
11
+ require_relative "response"
12
+ require_relative "store"
13
13
 
14
14
  module Async
15
15
  module HTTP
16
16
  module Cache
17
17
  # Implements a general shared cache according to https://www.rfc-editor.org/rfc/rfc9111
18
18
  class General < ::Protocol::HTTP::Middleware
19
- CACHE_CONTROL = 'cache-control'
19
+ CACHE_CONTROL = "cache-control"
20
20
 
21
- CONTENT_TYPE = 'content-type'
22
- AUTHORIZATION = 'authorization'
23
- COOKIE = 'cookie'
24
- SET_COOKIE = 'set-cookie'
21
+ CONTENT_TYPE = "content-type"
22
+ AUTHORIZATION = "authorization"
23
+ COOKIE = "cookie"
24
+ SET_COOKIE = "set-cookie"
25
25
 
26
26
  # Status codes of responses that MAY be stored by a cache or used in reply
27
27
  # to a subsequent request.
@@ -72,7 +72,7 @@ module Async
72
72
  end
73
73
 
74
74
  # We only support caching GET and HEAD requests:
75
- unless request.method == 'GET' || request.method == 'HEAD'
75
+ unless request.method == "GET" || request.method == "HEAD"
76
76
  return false
77
77
  end
78
78
 
@@ -111,7 +111,7 @@ module Async
111
111
  Console.logger.debug(self, status: response.status) {"Cannot cache response with status code!"}
112
112
  return false
113
113
  end
114
-
114
+
115
115
  unless cacheable_response_headers?(response.headers)
116
116
  Console.logger.debug(self) {"Cannot cache response with uncacheable headers!"}
117
117
  return false
@@ -137,7 +137,7 @@ module Async
137
137
  if request.head? and body = response.body
138
138
  unless body.empty?
139
139
  Console.logger.warn(self) {"HEAD request resulted in non-empty body!"}
140
-
140
+
141
141
  return response
142
142
  end
143
143
  end
@@ -161,7 +161,7 @@ module Async
161
161
  end
162
162
  end
163
163
  end
164
-
164
+
165
165
  def call(request)
166
166
  cache_control = request.headers[CACHE_CONTROL]
167
167
 
@@ -3,17 +3,17 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
- require 'protocol/http/response'
7
- require 'async/clock'
6
+ require "protocol/http/response"
7
+ require "async/clock"
8
8
 
9
9
  module Async
10
10
  module HTTP
11
11
  module Cache
12
12
  class Response < ::Protocol::HTTP::Response
13
- CACHE_CONTROL = 'cache-control'
14
- ETAG = 'etag'
13
+ CACHE_CONTROL = "cache-control"
14
+ ETAG = "etag"
15
15
 
16
- X_CACHE = 'x-cache'
16
+ X_CACHE = "x-cache"
17
17
 
18
18
  def initialize(response, body)
19
19
  @generated_at = Async::Clock.now
@@ -29,7 +29,7 @@ module Async
29
29
  @max_age = @headers[CACHE_CONTROL]&.max_age
30
30
  @etag = nil
31
31
 
32
- @headers.set(X_CACHE, 'hit')
32
+ @headers.set(X_CACHE, "hit")
33
33
  end
34
34
 
35
35
  attr :generated_at
@@ -48,7 +48,7 @@ module Async
48
48
 
49
49
  attr :index
50
50
 
51
- IF_NONE_MATCH = 'if-none-match'
51
+ IF_NONE_MATCH = "if-none-match"
52
52
  NOT_MODIFIED = ::Protocol::HTTP::Response[304]
53
53
 
54
54
  def lookup(key, request)
@@ -7,8 +7,8 @@ module Async
7
7
  module HTTP
8
8
  module Cache
9
9
  module Store
10
- VARY = 'vary'
11
- ACCEPT_ENCODING = 'accept-encoding'
10
+ VARY = "vary"
11
+ ACCEPT_ENCODING = "accept-encoding"
12
12
 
13
13
  class Vary
14
14
  def initialize(delegate, vary = {})
@@ -3,8 +3,8 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
- require_relative 'store/memory'
7
- require_relative 'store/vary'
6
+ require_relative "store/memory"
7
+ require_relative "store/vary"
8
8
 
9
9
  module Async
10
10
  module HTTP
@@ -6,7 +6,7 @@
6
6
  module Async
7
7
  module HTTP
8
8
  module Cache
9
- VERSION = "0.4.4"
9
+ VERSION = "0.4.5"
10
10
  end
11
11
  end
12
12
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Colin Kelley
9
9
  - Olle Jonsson
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain:
13
12
  - |
@@ -39,7 +38,7 @@ cert_chain:
39
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
40
  -----END CERTIFICATE-----
42
- date: 2024-07-18 00:00:00.000000000 Z
41
+ date: 2025-03-04 00:00:00.000000000 Z
43
42
  dependencies:
44
43
  - !ruby/object:Gem::Dependency
45
44
  name: async-http
@@ -55,8 +54,6 @@ dependencies:
55
54
  - - "~>"
56
55
  - !ruby/object:Gem::Version
57
56
  version: '0.56'
58
- description:
59
- email:
60
57
  executables: []
61
58
  extensions: []
62
59
  extra_rdoc_files: []
@@ -76,7 +73,6 @@ licenses:
76
73
  - MIT
77
74
  metadata:
78
75
  source_code_uri: https://github.com/socketry/async-http-cache.git
79
- post_install_message:
80
76
  rdoc_options: []
81
77
  require_paths:
82
78
  - lib
@@ -91,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
87
  - !ruby/object:Gem::Version
92
88
  version: '0'
93
89
  requirements: []
94
- rubygems_version: 3.5.11
95
- signing_key:
90
+ rubygems_version: 3.6.2
96
91
  specification_version: 4
97
92
  summary: Standard-compliant cache for async-http.
98
93
  test_files: []
metadata.gz.sig CHANGED
Binary file