Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Dec 10, 2024
1 parent 6285596 commit e6f72b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (c *CRProxy) directResponse(rw http.ResponseWriter, r *http.Request, info *

switch resp.StatusCode {
case http.StatusUnauthorized, http.StatusForbidden:
c.logger.Warn("origin direct response 40x, but hit caches", "host", info.Host, "image", info.Image, "error", err, "response", dumpResponse(resp))
c.logger.Warn("origin direct response 40x", "host", info.Host, "image", info.Image, "response", dumpResponse(resp))
errcode.ServeJSON(rw, errcode.ErrorCodeDenied)
return
}
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ func isDomainName(s string) bool {
}

func dumpResponse(resp *http.Response) string {
body, _ := io.ReadAll(io.LimitReader(resp.Body, 100))
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1024))
return fmt.Sprintf("%d %d %q", resp.StatusCode, resp.ContentLength, string(body))
}

0 comments on commit e6f72b5

Please sign in to comment.