fix(storage): format date-time headers with RFC2822 (#3672)
This commit is contained in:
@@ -206,8 +206,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
@@ -248,8 +247,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
@@ -391,8 +389,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Accept-Ranges:
|
||||
description: "Always set to bytes. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges"
|
||||
schema:
|
||||
@@ -675,8 +672,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
@@ -717,8 +713,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
|
||||
2
go.mod
2
go.mod
@@ -154,7 +154,7 @@ require (
|
||||
github.com/prometheus/common v0.63.0 // indirect
|
||||
github.com/prometheus/procfs v0.16.1 // indirect
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.54.0 // indirect
|
||||
github.com/quic-go/quic-go v0.54.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rs/cors v1.11.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -381,8 +381,8 @@ github.com/protocolbuffers/txtpbfmt v0.0.0-20241112170944-20d2c9ebc01d h1:HWfigq
|
||||
github.com/protocolbuffers/txtpbfmt v0.0.0-20241112170944-20d2c9ebc01d/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c=
|
||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||
github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg=
|
||||
github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
|
||||
github.com/quic-go/quic-go v0.54.1 h1:4ZAWm0AhCb6+hE+l5Q1NAL0iRn/ZrMwqHRGQiFwj2eg=
|
||||
github.com/quic-go/quic-go v0.54.1/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
const format = time.RFC1123
|
||||
|
||||
type Time time.Time
|
||||
type Time time.Time //nolint:recvcheck
|
||||
|
||||
func (dt *Time) UnmarshalText(text []byte) error {
|
||||
if len(text) == 0 || string(text) == `""` {
|
||||
@@ -24,6 +24,14 @@ func (dt *Time) UnmarshalText(text []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dt Time) String() string {
|
||||
if time.Time(dt).IsZero() {
|
||||
return ""
|
||||
}
|
||||
|
||||
return time.Time(dt).Format(format)
|
||||
}
|
||||
|
||||
func Date(year int, month time.Month, day, hour, minute, sec, nsec int, loc *time.Location) Time {
|
||||
return Time(time.Date(year, month, day, hour, minute, sec, nsec, loc))
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -998,7 +997,7 @@ type GetFile200ResponseHeaders struct {
|
||||
ContentDisposition string
|
||||
ContentType string
|
||||
Etag string
|
||||
LastModified time.Time
|
||||
LastModified RFC2822Date
|
||||
SurrogateControl string
|
||||
SurrogateKey string
|
||||
}
|
||||
@@ -1037,7 +1036,7 @@ type GetFile206ResponseHeaders struct {
|
||||
ContentRange string
|
||||
ContentType string
|
||||
Etag string
|
||||
LastModified time.Time
|
||||
LastModified RFC2822Date
|
||||
SurrogateControl string
|
||||
SurrogateKey string
|
||||
}
|
||||
@@ -1138,7 +1137,7 @@ type GetFileMetadataHeaders200ResponseHeaders struct {
|
||||
ContentLength int
|
||||
ContentType string
|
||||
Etag string
|
||||
LastModified time.Time
|
||||
LastModified RFC2822Date
|
||||
SurrogateControl string
|
||||
SurrogateKey string
|
||||
}
|
||||
@@ -1287,7 +1286,7 @@ type GetFileWithPresignedURL200ResponseHeaders struct {
|
||||
ContentDisposition string
|
||||
ContentType string
|
||||
Etag string
|
||||
LastModified time.Time
|
||||
LastModified RFC2822Date
|
||||
SurrogateControl string
|
||||
SurrogateKey string
|
||||
}
|
||||
@@ -1326,7 +1325,7 @@ type GetFileWithPresignedURL206ResponseHeaders struct {
|
||||
ContentRange string
|
||||
ContentType string
|
||||
Etag string
|
||||
LastModified time.Time
|
||||
LastModified RFC2822Date
|
||||
SurrogateControl string
|
||||
SurrogateKey string
|
||||
}
|
||||
@@ -2117,33 +2116,33 @@ var swaggerSpec = []string{
|
||||
"LBifrwmiSgmVfIhbXlfQcyu1CTQjsNCs1RPf7KYLulREgdEEtkCBlDmVGOaQoq/Qz8RHlqbUpFaAhydH",
|
||||
"g1hEavAOJoNfjo8PB7/YCQft2a60UMFzGiUQPrc5IM9Bkjm7Y+hWl0VAJqcBUUI5U9m1w1smhS+YyoVi",
|
||||
"/sO9fR4j60FVBtuxViWiSGMyARIzlad0CTFhPGU2m0MxWCVUaxolJkt9M1JuUe9yzYh7d6mbumbMV1Tp",
|
||||
"8MDZxDUHe2iqzGFot8aktKatWW5STHLZC44KKcUMm6yFg0FLlTGM2+BQZf8SJtcstZ7vX7BcN1eZyb3d",
|
||||
"4Dj8aOvpp+zxQ+eyT2+717+9HWVV+Pgak1FVBzPrSpYKebNtN9u2sW231yY1TNBWxhkmWiihbePzRjqf",
|
||||
"cbI/reQRHpnGQuKHrzF2OzCxX7lpv+T2/Rzg+7IIwBmfDEeeZJ2EWhZTylJXOeFJoJSsJ49QTCiMHsrm",
|
||||
"pI4Gjch6bYE93kjq1pJqZPyuysy1OftbuFfe0vB1clcRygsZ19Bw2+xemZtbm99DQq9I8BnNWh3blEBb",
|
||||
"MJ2IQlfpsWat5g2TfkaBu+yQqvDUKARYm9QrjxZ+qRTOp+X4ogSiD5sE3ybBt0nwbRJ8mwTfJsF3+wTf",
|
||||
"moyYx+1uVrqV1nST8/p7ReivgM90cov7Ub5xG9txE5VvovJNVP6NRuWbMPwbCMOfY4hZ2oS6at4Xj+eF",
|
||||
"t94mT2kEnWsztkyPw6IyeNaxzCWUtcqVIt5/0SfHSaNcm0xFmoqFwiYKiNKQq/Ep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R2iaigXiJ0qZoUoLUnBkmDbKPQFC55Sl9kcrXL7O3nPIRAyp/8ESN/tRDlFwq2DlLCxX2GH9+jPv",
|
||||
"tWt9AOfD9jCtQsHPoGvRWLUerVbMlI9rlp93saAG9umecCLFB+Bhs6jA/9zdT6Zhq+7EsAli9JCy1hu3",
|
||||
"CVXNGpkfiZYFmBITc2iJfbmoakGbdS4miWhuvGj39BKz7pd5grEuzzHTuLythavnrcZ1jy/ZpRw0KxU+",
|
||||
"4Uh3/Uu9N34frHyA/gY/Z+I5f/U8yEQmbWn9NTDmzWNh36nwmmc417zKtLqmGu/1o5tdgAuZJ5Rf8Y7j",
|
||||
"G9OgeuuN1u84Isbwn6ZijOtOTVaBSJ+j++V9+uuz4bekuH6p8d7gW715WWH3micP74xQ0WL71wBQtbqm",
|
||||
"awCaMqW/Mf37iin9FWtfnKD46tQvCk3dVvsacHOhw6LxKyB+ZB8jlpjqXQdiU1v7uVBpdOlroRu/G/MV",
|
||||
"4TKB6ENl4bjQX+6J0C+AzIa1RnPMv3dnsEUtyuuh+lW5CciXv7WTUCnSr8lLsGi9uY8wr9/yv7JuUdkn",
|
||||
"+01EfbvfECAnCqZFat92F5xpIcvX3WOYFLMZ4zNvdF6+8v8Zq2E9v6vgEc6/PetdKfR2hxMPM5IvX9f3",
|
||||
"yK2Z1VkqDRnCwkBPzv11pt0H/I9M285b+ueqmMQio4xf9suHjs8lzJjgl337AwGy4IP5MEAEOyrOPb/C",
|
||||
"sJpocGfY7Y891Shcg+Q0bfxaAnE5itgen+fFJGURjq/qYes0RndIeymGcjqzlxYau6kuAXA6pLOSdT/h",
|
||||
"UHdtfNbtX3K8sRr7ikejlrkxVpmj8wxk5LwCgrKXxcDl+8v/BAAA///wREgRYHkAAA==",
|
||||
}
|
||||
|
||||
// GetSwagger returns the content of the embedded swagger specification file
|
||||
|
||||
@@ -272,7 +272,7 @@ func (ctrl *Controller) getFileResponse( //nolint: ireturn,dupl
|
||||
),
|
||||
ContentType: file.mimeType,
|
||||
Etag: file.fileMetadata.Etag,
|
||||
LastModified: file.fileMetadata.UpdatedAt,
|
||||
LastModified: api.RFC2822Date(file.fileMetadata.UpdatedAt),
|
||||
SurrogateControl: file.cacheControl,
|
||||
SurrogateKey: file.fileMetadata.Id,
|
||||
},
|
||||
@@ -290,7 +290,7 @@ func (ctrl *Controller) getFileResponse( //nolint: ireturn,dupl
|
||||
ContentRange: file.extraHeaders.Get("Content-Range"),
|
||||
ContentType: file.mimeType,
|
||||
Etag: file.fileMetadata.Etag,
|
||||
LastModified: file.fileMetadata.UpdatedAt,
|
||||
LastModified: api.RFC2822Date(file.fileMetadata.UpdatedAt),
|
||||
SurrogateControl: file.cacheControl,
|
||||
SurrogateKey: file.fileMetadata.Id,
|
||||
},
|
||||
|
||||
@@ -115,7 +115,7 @@ func (ctrl *Controller) getFileMetadataHeadersResponseObject( //nolint:ireturn
|
||||
CacheControl: bucketMetadata.CacheControl,
|
||||
ContentType: fileMetadata.MimeType,
|
||||
Etag: fileMetadata.Etag,
|
||||
LastModified: fileMetadata.UpdatedAt,
|
||||
LastModified: api.RFC2822Date(fileMetadata.UpdatedAt),
|
||||
SurrogateControl: bucketMetadata.CacheControl,
|
||||
SurrogateKey: fileMetadata.Id,
|
||||
ContentDisposition: fmt.Sprintf(
|
||||
|
||||
@@ -35,7 +35,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
ContentLength: 64,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -57,7 +57,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
ContentLength: 64,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -111,7 +111,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
ContentLength: 64,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -133,7 +133,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
ContentLength: 64,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -171,7 +171,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
ContentLength: 64,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestGetFile(t *testing.T) { //nolint:maintidx
|
||||
ContentDisposition: `inline; filename="my-file.txt"`,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -62,7 +62,7 @@ func TestGetFile(t *testing.T) { //nolint:maintidx
|
||||
ContentDisposition: `inline; filename="my-file.txt"`,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -116,7 +116,7 @@ func TestGetFile(t *testing.T) { //nolint:maintidx
|
||||
ContentDisposition: `inline; filename="my-file.txt"`,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -138,7 +138,7 @@ func TestGetFile(t *testing.T) { //nolint:maintidx
|
||||
ContentDisposition: `inline; filename="my-file.txt"`,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
@@ -176,7 +176,7 @@ func TestGetFile(t *testing.T) { //nolint:maintidx
|
||||
ContentDisposition: `inline; filename="my-file.txt"`,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Etag: `"55af1e60-0f28-454e-885e-ea6aab2bb288"`,
|
||||
LastModified: time.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
LastModified: api.Date(2021, 12, 27, 9, 58, 11, 0, time.UTC),
|
||||
SurrogateControl: "max-age=3600",
|
||||
SurrogateKey: "55af1e60-0f28-454e-885e-ea6aab2bb288",
|
||||
},
|
||||
|
||||
@@ -99,7 +99,7 @@ func (ctrl *Controller) getFileWithPresignedURLResponseObject( //nolint: ireturn
|
||||
),
|
||||
ContentType: file.mimeType,
|
||||
Etag: file.fileMetadata.Etag,
|
||||
LastModified: file.fileMetadata.UpdatedAt,
|
||||
LastModified: api.RFC2822Date(file.fileMetadata.UpdatedAt),
|
||||
SurrogateControl: file.cacheControl,
|
||||
SurrogateKey: file.fileMetadata.Id,
|
||||
},
|
||||
@@ -117,7 +117,7 @@ func (ctrl *Controller) getFileWithPresignedURLResponseObject( //nolint: ireturn
|
||||
ContentRange: file.extraHeaders.Get("Content-Range"),
|
||||
ContentType: file.mimeType,
|
||||
Etag: file.fileMetadata.Etag,
|
||||
LastModified: file.fileMetadata.UpdatedAt,
|
||||
LastModified: api.RFC2822Date(file.fileMetadata.UpdatedAt),
|
||||
SurrogateControl: file.cacheControl,
|
||||
SurrogateKey: file.fileMetadata.Id,
|
||||
},
|
||||
|
||||
@@ -64,6 +64,10 @@ func FileMetadataMatcher(v api.FileMetadata) gomock.Matcher {
|
||||
func assert(t *testing.T, got, wanted interface{}, opts ...cmp.Option) {
|
||||
t.Helper()
|
||||
|
||||
opts = append(opts, cmpopts.IgnoreUnexported(
|
||||
api.Time{},
|
||||
))
|
||||
|
||||
if !cmp.Equal(got, wanted, opts...) {
|
||||
t.Error(cmp.Diff(got, wanted, opts...))
|
||||
}
|
||||
|
||||
@@ -206,8 +206,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
@@ -248,8 +247,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
@@ -391,8 +389,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Accept-Ranges:
|
||||
description: "Always set to bytes. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges"
|
||||
schema:
|
||||
@@ -675,8 +672,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
@@ -717,8 +713,7 @@ paths:
|
||||
Last-Modified:
|
||||
description: "Date and time the file was last modified"
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
$ref: '#/components/schemas/RFC2822Date'
|
||||
Surrogate-Key:
|
||||
description: "Cache key for surrogate caching"
|
||||
schema:
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
URL=http://localhost:8000/v1/files
|
||||
AUTH="Authorization: Bearer $(make dev-jwt)"
|
||||
|
||||
# token can be generated using build/dev/jwt-gen
|
||||
AUTH="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIwNzc3NzY0NjYsImh0dHBzOi8vaGFzdXJhLmlvL2p3dC9jbGFpbXMiOnsieC1oYXN1cmEtYWxsb3dlZC1yb2xlcyI6WyJhZG1pbiJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJhZG1pbiIsIngtaGFzdXJhLXVzZXItaWQiOiJhYjViYTU4ZS05MzJhLTQwZGMtODdlOC03MzM5OTg3OTRlYzIiLCJ4LWhhc3VyYS11c2VyLWlzQW5vbnltb3VzIjoiZmFsc2UifSwiaWF0IjoxNzYyNDE2NDY2LCJpc3MiOiJoYXN1cmEtYXV0aCIsInN1YiI6ImFiNWJhNThlLTkzMmEtNDBkYy04N2U4LTczMzk5ODc5NGVjMiJ9.msexXYDRzox0giNGRHqPrefYH_uWXMtdCbEZ_Vg-IV8"
|
||||
BUCKET=default
|
||||
|
||||
FILE_ID=55af1e60-0f28-454e-885e-ea6aab2bb288
|
||||
@@ -11,14 +13,12 @@ ETAG=\"588be441fe7a59460850b0aa3e1c5a65\"
|
||||
# lead to a JWTIssuedAtFuture error
|
||||
sleep 1
|
||||
|
||||
output=`curl $URL/ \
|
||||
output=`curl $URL \
|
||||
-v \
|
||||
-H "$AUTH" \
|
||||
-F "bucket-id=$BUCKET" \
|
||||
-F "metadata[]={};type=application/json" \
|
||||
-F "file[]=@go.mod" \
|
||||
-F "metadata[]={\"id\":\"7982873d-8e89-4321-ab86-00f80a168c5a\", \"name\":\"config.yaml\",\"metadata\":{\"num\":123,\"list\":[1,2,3]}};type=application/json" \
|
||||
-F "file[]=@storage.yaml" \
|
||||
-F "file[]=@vacuum.yaml" \
|
||||
-F "metadata[]={\"id\":\"faa80d51-07c7-4268-942d-8f092c98c71a\", \"name\":\"docs.md\"};type=application/json" \
|
||||
-F "file[]=@README.md" \
|
||||
-F "metadata[]={\"id\":\"$FILE_ID\", \"name\":\"logo.jpg\"};type=application/json" \
|
||||
|
||||
3
vendor/github.com/quic-go/quic-go/connection.go
generated
vendored
3
vendor/github.com/quic-go/quic-go/connection.go
generated
vendored
@@ -845,6 +845,9 @@ func (c *Conn) handleHandshakeComplete(now time.Time) error {
|
||||
}
|
||||
|
||||
func (c *Conn) handleHandshakeConfirmed(now time.Time) error {
|
||||
if err := c.dropEncryptionLevel(protocol.EncryptionInitial, now); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := c.dropEncryptionLevel(protocol.EncryptionHandshake, now); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -811,7 +811,7 @@ github.com/prometheus/procfs/internal/util
|
||||
# github.com/quic-go/qpack v0.5.1
|
||||
## explicit; go 1.22
|
||||
github.com/quic-go/qpack
|
||||
# github.com/quic-go/quic-go v0.54.0
|
||||
# github.com/quic-go/quic-go v0.54.1
|
||||
## explicit; go 1.23
|
||||
github.com/quic-go/quic-go
|
||||
github.com/quic-go/quic-go/http3
|
||||
|
||||
Reference in New Issue
Block a user