• Brad Fitzpatrick's avatar
    [release-branch.go1] mime/multipart: fix handling of empty parts without CRLF before next part · bd0227bb
    Brad Fitzpatrick authored
    ««« backport 32a8b0e41031
    mime/multipart: fix handling of empty parts without CRLF before next part
    
    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
    
    »»»
    bd0227bb
multipart.go 8.86 KB