• Matt Menke's avatar
    Rework Content-Type parsing code to more closely resemble spec. · aada226a
    Matt Menke authored
    This aligns behavior more closely FireFox, though less closely
    with Edge and Safari.  See RFC at https://mimesniff.spec.whatwg.org/
    (This behavior is also more consistent with
    https://tools.ietf.org/html/rfc7231#section-3.1.1.1)
    
    In particular, no longer split the string around semi-colons first,
    but instead parse character-by-character (Which only really affects
    weird things like charset=";"), and use backslash as an escape
    character in quoted string values.  This affects both charset and
    boundary parameters, so we should keep an eye out for bug reports
    about either of those breaking in corner cases.
    
    This also applies the quoted string parsing logic to Content-Type
    boundary parameters (It was just used for charsets before) - this is
    unlikely to break anything, since the one consumer of that field
    arbitrarily removes all leading/trailing spaces and quotes from
    boundary strings.
    
    Bug: 774429
    Change-Id: I28c9c035e1c1c28e181bd0e8005266cfd63af7e9
    Reviewed-on: https://chromium-review.googlesource.com/990995
    Commit-Queue: Matt Menke <mmenke@chromium.org>
    Reviewed-by: default avatarBence Béky <bnc@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#548008}
    aada226a
http_util.cc 38.8 KB