[Regression fix] [Data URI parser] Accept data URI with invalid mediatype data
commit5469386eaa6bd55fcd5540c570fb535f4d6667e3
authortyoshino <tyoshino@chromium.org>
Wed, 1 Oct 2014 04:01:34 +0000 (30 21:01 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 1 Oct 2014 04:01:46 +0000 (1 04:01 +0000)
tree2ab160b2f4241dd575592e2b8f9c447f2925fd4f
parent46e7f9bc4f4bd3ae4d473876db35dc5c225e25a6
[Regression fix] [Data URI parser] Accept data URI with invalid mediatype data

r272022 introduced grammar check on the mediatype part in a data URI.
This broke applications that depend on the behavior that our
WebURLLoaderImpl and URLRequestDataJob accept data URIs with
incomplete mediatype such as "data:image;base64,xxx". Accept this kind
of data URI again for backward compatibility.

Instead, fallback to the default mediatype when
ParseMimeTypeWithoutParameter() returns false in DataURL::Parse() to
avoid generating Content-type header with invalid mediatype.

BUG=412479

Review URL: https://codereview.chromium.org/555383003

Cr-Commit-Position: refs/heads/master@{#297593}
net/base/data_url.cc
net/base/data_url.h
net/base/data_url_unittest.cc
net/url_request/url_request_data_job_unittest.cc