Implement ETag, HEAD requests, and conditional requests
- Add ETag generation based on output content hash (first 16 chars) - Add ContentLength to ImageResponse from cache - Add LoadWithSize method to ContentStorage - Add GetOutputWithSize method to Cache - Handle HEAD requests returning headers only - Handle If-None-Match conditional requests returning 304 - Register HEAD route for image proxy endpoint
This commit is contained in:
@@ -168,6 +168,11 @@ func (c *Cache) GetOutput(outputHash string) (io.ReadCloser, error) {
|
||||
return c.dstContent.Load(outputHash)
|
||||
}
|
||||
|
||||
// GetOutputWithSize returns a reader and size for cached output content.
|
||||
func (c *Cache) GetOutputWithSize(outputHash string) (io.ReadCloser, int64, error) {
|
||||
return c.dstContent.LoadWithSize(outputHash)
|
||||
}
|
||||
|
||||
// StoreSource stores fetched source content and metadata.
|
||||
func (c *Cache) StoreSource(
|
||||
ctx context.Context,
|
||||
|
||||
Reference in New Issue
Block a user