Merge pull request #2474 from reasonerjt/comment-in-proxy

fix typo and refine message in content trust interceptor
This commit is contained in:
Daniel Jiang 2017-06-09 10:02:46 +08:00 committed by GitHub
commit e54be8862d
2 changed files with 4 additions and 2 deletions

View File

@ -60,6 +60,7 @@ func (ec envPolicyChecker) contentTrustEnabled(name string) bool {
return os.Getenv("PROJECT_CONTENT_TRUST") == "1"
}
func (ec envPolicyChecker) vulnerableEnabled(name string) bool {
// TODO: May need get more information in vulnerable policies.
return os.Getenv("PROJECT_VULNERABBLE") == "1"
}
@ -161,8 +162,8 @@ func (cth contentTrustHandler) ServeHTTP(rw http.ResponseWriter, req *http.Reque
log.Debugf("Passing the response to outter responseWriter")
copyResp(rec, rw)
} else {
log.Debugf("digest miamatch, failing the response.")
http.Error(rw, "Failure in content trust handler", http.StatusPreconditionFailed)
log.Debugf("digest mismatch, failing the response.")
http.Error(rw, "The image is not signed in Notary.", http.StatusPreconditionFailed)
}
}

View File

@ -41,6 +41,7 @@ func Init(urls ...string) error {
return err
}
Proxy = httputil.NewSingleHostReverseProxy(targetURL)
//TODO: add vulnerable interceptor.
handlers = handlerChain{head: urlHandler{next: contentTrustHandler{next: Proxy}}}
return nil
}