Proposals Unofficial Go proposal tracker

Add explicit query parsing and parsing limits

#82173 · net/http, mime/multipart · medium impact · Likely accept ·

Calling req.FormValue("key") to read a URL query parameter can silently parse the request body as a form. This can use up to 42MB of memory and unlimited disk space for multipart file uploads. The proposal makes query access explicit and lets servers limit or disable form parsing.

Handlers get explicit ways to read only the URL query, without touching the body, or to parse only urlencoded bodies. Each kind of parsing can take its own limits, and servers can set default limits for all requests. Servers can also turn off implicit multipart parsing, so that FormValue and PostFormValue never read uploaded files.

srv := &http.Server{
    DisableImplicitMultipartForm: true,
    MultipartFormLimits: multipart.FormLimits{
        MaxMemory:   1 << 20,
        MaxFileDisk: -1, // never write files to disk
    },
}

func handler(w http.ResponseWriter, r *http.Request) {
    id := r.QueryValue("id") // URL query only; body is not read
    _ = id
}

Limits cover memory, disk usage for uploaded files, and the number of parts and headers. Zero values keep today's defaults.

Proposal
#82173 by neild
Status
Likely accept on Nov 18, 2026
Impact
medium
Area
net/http, mime/multipart