Use temporary file to avoid out-of-memory when receiving big chunks. (#3748)
Use temporary file to avoid out-of-memory when receiving big chunks. (#3748)

* Use temporary file to avoid out-of-memory when receiving big chunk.

Not perfect but I think it's a reasonable solution.
For small request bodies, I suppose performance wouldn't be an issue.
For large ones, this seems to be a necessary evil.

* Must close the open file to avoid fd leaks

dlob/gogs,ForxaCoLab/forxa,linquize/gogs,dancewing/gogs,cgars/gogs,psaavedra/gogs,ForxaCoLab/forxa,gogits/gogs,cgars/gogs,mukaiu/gogs,pikacloud/pikacode,chriswatt/gogs,dlob/gogs,liliexuan/gogs,pikacloud/pikacode,gogits/gogs,dlob/gogs,psaavedra/gogs,dancewing/gogs,mukaiu/gogs,xaionaro/gogs,ForxaCoLab/forxa,xaionaro/gogs,dancewing/gogs,psaavedra/gogs,Spice-King/gogs,wangjild/gogs,linquize/gogs,xaionaro/gogs,mukaiu/gogs,chriswatt/gogs,wangjild/gogs,chriswatt/gogs,Spice-King/gogs,linquize/gogs,gogits/gogs,liliexuan/gogs,pikacloud/pikacode,liliexuan/gogs,cgars/gogs,wangjild/gogs,dancewing/gogs,Spice-King/gogs