Skip to content

Commit

Permalink
Merge pull request #19 from atelieryuxki/main
Browse files Browse the repository at this point in the history
Log error for reading ocsp request body block.
  • Loading branch information
yuxki committed Oct 16, 2023
2 parents 5b302c7 + 7050753 commit 5dc70b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cache_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ var ErrUnexpectedHTTPMethod = errors.New("unexpected HTTP method")
// This Handler add headers Headers introduced in RFC5019.
// (https://www.rfc-editor.org/rfc/rfc5019#section-5)
func (c CacheHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Set logger attributes same as access log
logger := c.logger.With().Str("ip", r.RemoteAddr).Str("user_agent", r.UserAgent()).Logger()

var body []byte
var err error

Expand All @@ -202,12 +205,10 @@ func (c CacheHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
err = ErrUnexpectedHTTPMethod
}
if err != nil {
logger.Error().Err(err).Msg("")
return
}

// Set logger attributes same as access log
logger := c.logger.With().Str("ip", r.RemoteAddr).Str("user_agent", r.UserAgent()).Logger()

// Handle as OCSP request
w.Header().Add("Content-Type", "application/ocsp-response")

Expand Down

0 comments on commit 5dc70b6

Please sign in to comment.