Skip to content

Commit

Permalink
Add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Sep 11, 2024
1 parent 27f7c6e commit 83eb87a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"net"
"net/http"
"net/http/httputil"
"net/textproto"
"net/url"
"strings"
Expand Down Expand Up @@ -540,6 +541,11 @@ func (c *CRProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
Name: info.Image,
}

if c.logger != nil {
req, err := httputil.DumpRequest(r, false)
c.logger.Println("REQUEST", string(req), err)
}

if c.blockFunc != nil && !c.isPrivileged(r, nil) && c.blockFunc(imageInfo) {
if c.blockMessage != "" {
errcode.ServeJSON(rw, errcode.ErrorCodeDenied.WithMessage(c.blockMessage))
Expand Down

0 comments on commit 83eb87a

Please sign in to comment.