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 { if err != nil {
break break
} }
host.Flow.Add(len(b), 0) l := len(b)
if _, err := tunnel.SendMsg(b, lk); err != nil { var start int
c.Close() 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 break
} }
<-lk.StatusCh if err != nil {
break
}
}
} }
end: end:
if isConn { if isConn {