-
Notifications
You must be signed in to change notification settings - Fork 18k
http server can't handle multipart/form-data -- common for file uploads #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
I've attached an example of a multipart file upload. They're easy to generate with the poster python package. The Content-Type header contains the boundary value: Content-Length: 59329 Content-Type: multipart/form-data; boundary=a218790fa0c74d9fad6cccb7fafe97cc Attachments:
|
I would like to see a discussion of the change on golang-dev before seeing a patch. In particular I want to know what the interface is. Is the file data just going to be kept in memory? Is there a limit? Owner changed to [email protected]. Status changed to Accepted. |
again on the limit issue, I went ahead and did like I proposed above; I added that upload []byte member (because I only needed to upload one file, but of course it can be easily adapted for multiple files like in hoisie's web.go), and I allocate a limited amount (set with a const) of memory for that member before calling ParseForm(). Then in ParseForm() I return an error if the uploaded file is larger than the limit. |
I'd like to propose an interface like this one: http://github.com/bradfitz/golang-mime-multipart It takes the io.Reader from http.Request.Body and gives you an interator of MIME Parts, each with a Headers map[string]string and the part itself is an io.Reader to read the bytes of it. No buffering, no writing to disk. You can build that stuff on top of it. This one's purely an adapter that parses the input as it comes in. (from http or anywhere that uses MIME multipart...) |
Yes, ParseForm could also be implemented using this, perhaps with options for a threshold over which to spool to temp disk files. But at least in my case, I want to read (and sha1!) contents as they're streamed in to my HTTP server, without doing a second pass over the data, so I need this lower-level interface directly. |
Pending CL for this: http://golang.org/cl/1681049/show |
http://code.google.com/p/go/source/detail?r=4ab63d961945 Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: