server: http log sent bytes

This commit is contained in:
mmatczuk 2016-09-27 09:10:55 +02:00
parent 1bbcb98198
commit 7849170e92
2 changed files with 14 additions and 1 deletions

View file

@ -252,8 +252,10 @@ func (s *Server) proxy(host string, w io.Writer, r interface{}, msg *proto.Contr
localToRemote := func() {
if hr, ok := r.(*http.Request); ok {
hr.Write(pw)
cw := &countWriter{pw, 0}
hr.Write(cw)
pw.Close()
s.log.Debug("Coppied %d bytes from %s", cw.count, "local to remote")
} else {
transfer("local to remote", pw, r.(io.ReadCloser), s.log)
}