Skip to content

Commit d510d0a

Browse files
committed
forwarding content length header
1 parent 654c7be commit d510d0a

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

  • controllers/dependencyfirewall

controllers/dependencyfirewall/oci.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ func (d *OCIDependencyProxyController) ProxyOCIManifest(c shared.Context) error
491491
}
492492

493493
if method == http.MethodHead {
494+
if cl := headers.Get("Content-Length"); cl != "" {
495+
c.Response().Header().Set("Content-Length", cl)
496+
}
494497
return c.NoContent(http.StatusOK)
495498
}
496499
return ociEco.writeResponse(c, data, requestPath, false)
@@ -579,6 +582,13 @@ func (d *OCIDependencyProxyController) ProxyOCIBlob(c shared.Context) error {
579582
c.Response().Header().Set("Docker-Content-Digest", d)
580583
}
581584

585+
if method == http.MethodHead {
586+
if cl := headers.Get("Content-Length"); cl != "" {
587+
c.Response().Header().Set("Content-Length", cl)
588+
}
589+
return c.NoContent(http.StatusOK)
590+
}
591+
582592
if method == http.MethodGet && len(data) > 0 {
583593
// Verify the downloaded content matches the requested digest before caching.
584594
// digest is of the form "sha256:<hex>"; skip verification for other algorithms.
@@ -594,9 +604,6 @@ func (d *OCIDependencyProxyController) ProxyOCIBlob(c shared.Context) error {
594604
}
595605
}
596606

597-
if method == http.MethodHead {
598-
return c.NoContent(http.StatusOK)
599-
}
600607
return ociEco.writeResponse(c, data, requestPath, false)
601608
}
602609

0 commit comments

Comments
 (0)