Sorry I was unclear, you are right, my intention was to identify where standard form size limiting is done for multipart/form-data POST requests.

There is also a limit placed on "application/x-www-form-urlencoded" for POST requests unless the request body is already limited by MaxBytesReader, as detailed here:
https://golang.org/pkg/net/http/#Request.ParseForm
https://golang.org/pkg/net/http/#MaxBytesReader

MaxBytesReader can be used in all cases to limit the total size of the form processed, so that may be an option.

If the OP does indeed want per file configurable upload limits then I don't think that's trivial and would likely require a custom mime/multipart reader.

On 30/08/2017 11:24, Lutz Horn wrote:
Limiting is done by the form parse: https://golang.org/pkg/net/http/#Request.ParseMultipartForm

No, this is not limiting:

The whole request body is parsed and up to a total of maxMemory bytes
of its file parts are stored in memory, with the remainder stored on
disk in temporary files. ParseMultipartForm calls ParseForm if
necessary.

This is just offloading to disk. The whole request including all complete body parts is still parsed and available.

Unless the OP tells us what kind of limiting he has in mind, it is hard to give advice.

Lutz


--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to