Skip to content

Commit

Permalink
http post large file bug
Browse files Browse the repository at this point in the history
  • Loading branch information
刘河 committed Feb 27, 2019
1 parent 0492268 commit fbbd4ba
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions server/proxy/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fbbd4ba

Please sign in to comment.