Treat '+' as a safe MIME type character.

This addresses a review comment from
https://codereview.chromium.org/681303003/diff/120001/util/net/http_multipart_builder.cc#newcode107

R=mark@chromium.org

Review URL: https://codereview.chromium.org/694483002
This commit is contained in:
Robert Sesek 2014-10-30 09:22:39 -04:00
parent 9db5d6f773
commit 123e01f96d
2 changed files with 3 additions and 0 deletions

View File

@ -104,6 +104,7 @@ void AssertSafeMIMEType(const std::string& string) {
c == '/' || c == '/' ||
c == '.' || c == '.' ||
c == '_' || c == '_' ||
c == '+' ||
c == '-'); c == '-');
} }
} }

View File

@ -257,6 +257,8 @@ TEST(HTTPMultipartBuilder, AssertUnsafeMIMEType) {
ASSERT_DEATH(builder.SetFileAttachment("", "", base::FilePath(), "<>"), ""); ASSERT_DEATH(builder.SetFileAttachment("", "", base::FilePath(), "<>"), "");
// Invalid but safe: // Invalid but safe:
builder.SetFileAttachment("", "", base::FilePath(), "0/totally/-invalid.pdf"); builder.SetFileAttachment("", "", base::FilePath(), "0/totally/-invalid.pdf");
// Valid and safe:
builder.SetFileAttachment("", "", base::FilePath(), "application/xml+xhtml");
} }
} // namespace } // namespace