working commit
This commit is contained in:
+9
-8
@@ -15,21 +15,22 @@ import (
|
||||
|
||||
"mstore/app/operator"
|
||||
"mstore/app/router"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
func (hand *Handler) DumpHeaders(message string, rctx *router.Context) {
|
||||
headers := rctx.GetHeaders()
|
||||
yamlData, _ := yaml.Marshal(headers)
|
||||
hand.logg.Debugf("%s:\n%s\n", message, string(yamlData))
|
||||
}
|
||||
|
||||
// HEAD /v2/<name>/blobs/<digest> 200 404
|
||||
func (hand *Handler) BlobExists(rctx *router.Context) {
|
||||
name, _ := rctx.GetSubpath("name")
|
||||
digest, _ := rctx.GetSubpath("digest")
|
||||
|
||||
auth := rctx.GetHeader("Authorization")
|
||||
hand.DumpHeaders("BlobExists", rctx)
|
||||
|
||||
if auth == "" {
|
||||
rctx.SetHeader("WWW-Authenticate", `Basic realm="mstore"`)
|
||||
rctx.SetStatus(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
params := &operator.BlobExistsParams{
|
||||
Name: name,
|
||||
Digest: digest,
|
||||
|
||||
Reference in New Issue
Block a user