Skip to content

Commit

Permalink
s3: remove setContentLength on handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
dhij committed Aug 16, 2023
1 parent 3f8ce75 commit 3a8a2e7
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions registry/storage/driver/s3-aws/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,28 +683,6 @@ func (d *driver) logS3Operation(ctx context.Context) request.NamedHandler {
}
}

// setContentLengthHandlerHame is used to identify the handler used set the
// ContentLength field on request data output types that support it.
const setContentLengthHandlerName = "docker.storage-driver.s3.set-content-length"

// setContentLength is used to set the ContentLength field on request data
// output types that support it.
var setContentLength = request.NamedHandler{
Name: setContentLengthHandlerName,
Fn: func(r *request.Request) {
switch v := r.Data.(type) {
case *s3.HeadObjectOutput:
if r.HTTPResponse.ContentLength > 0 {
v.SetContentLength(r.HTTPResponse.ContentLength)
}
case *s3.GetObjectOutput:
if r.HTTPResponse.ContentLength > 0 {
v.SetContentLength(r.HTTPResponse.ContentLength)
}
}
},
}

func (d *driver) s3Client(ctx context.Context) *s3.S3 {
s := d.S3

Expand All @@ -713,7 +691,6 @@ func (d *driver) s3Client(ctx context.Context) *s3.S3 {
r := d.logS3Operation(ctx)
s.Client.Handlers.Complete.PushBackNamed(r)
}
s.Client.Handlers.Complete.PushBackNamed(setContentLength)

return s
}
Expand Down

0 comments on commit 3a8a2e7

Please sign in to comment.