http post large file bug

This commit is contained in:
刘河 2019-02-27 13:02:34 +08:00
parent 0492268190
commit fbbd4bace2
1 changed files with 16 additions and 5 deletions

View File

@ -174,12 +174,23 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
if err != nil {
break
}
host.Flow.Add(len(b), 0)
if _, err := tunnel.SendMsg(b, lk); err != nil {
c.Close()
break
l := len(b)
var start int
host.Flow.Add(l, 0)
for {
if l-start > 32*1024 {
_, err = tunnel.SendMsg(b[start:start+32*1024], lk)
start += 32 * 1024
<-lk.StatusCh
} else {
_, err = tunnel.SendMsg(b[start:l], lk)
<-lk.StatusCh
break
}
if err != nil {
break
}
}
<-lk.StatusCh
}
end:
if isConn {