mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-05 12:00:29 +08:00
caddyhttp: record num. bytes read when response writer is hijacked (#6173)
* record the number of bytes read when response writer is hijacked * record body size when not nil
This commit is contained in:
@ -326,6 +326,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Body != nil {
|
||||
bodyReader = &lengthReader{Source: r.Body}
|
||||
r.Body = bodyReader
|
||||
|
||||
// should always be true, private interface can only be referenced in the same package
|
||||
if setReadSizer, ok := wrec.(interface{ setReadSize(*int) }); ok {
|
||||
setReadSizer.setReadSize(&bodyReader.Length)
|
||||
}
|
||||
}
|
||||
|
||||
// capture the original version of the request
|
||||
|
Reference in New Issue
Block a user