• Brad Fitzpatrick's avatar
    mime/multipart: fix handling of empty parts without CRLF before next part · e393a829
    Brad Fitzpatrick authored
    Empty parts can be either of the form:
    
    a) "--separator\r\n", header (w/ trailing 2xCRLF), \r\n "--separator"...
    or
    b) "--separator\r\n", header (w/ trailing 2xCRLF), "--separator"...
    
    We never handled case b).  In fact the RFC seems kinda vague about
    it, but browsers seem to do a), and App Engine's synthetic POST
    bodies after blob uploads is of form b).
    
    So handle them both, and add a bunch of tests.
    
    (I can't promise these are the last fixes to multipart, especially
    considering its history, but I'm growing increasingly confident at
    least, and I've never submitted a multipart CL with known bugs
    outstanding, including this time.)
    
    R=golang-dev, adg
    CC=golang-dev
    https://golang.org/cl/6212046
    e393a829
multipart_test.go 17.5 KB