diff --git a/util/net/http_multipart_builder.cc b/util/net/http_multipart_builder.cc index 640d540a..91105be9 100644 --- a/util/net/http_multipart_builder.cc +++ b/util/net/http_multipart_builder.cc @@ -40,8 +40,8 @@ std::string GenerateBoundaryString() { // characters from the set “'()+_,-./:=? ”, and not ending in a space. // However, some servers have been observed as dealing poorly with certain // nonalphanumeric characters. See - // blink/Source/platform/network/FormDataBuilder.cpp - // blink::FormDataBuilder::generateUniqueBoundaryString(). + // blink/Source/platform/network/FormDataEncoder.cpp + // blink::FormDataEncoder::GenerateUniqueBoundaryString(). // // This implementation produces a 56-character string with over 190 bits of // randomness (62^32 > 2^190). @@ -60,17 +60,12 @@ std::string GenerateBoundaryString() { // Escapes the specified name to be suitable for the name field of a // form-data part. std::string EncodeMIMEField(const std::string& name) { - // RFC 2388 §3 says to encode non-ASCII field names according to RFC 2047, but - // no browsers implement that behavior. Instead, they send field names in the - // page hosting the form’s encoding. However, some form of escaping is needed. // This URL-escapes the quote character and newline characters, per Blink. See - // blink/Source/platform/network/FormDataBuilder.cpp - // blink::appendQuotedString(). - // - // TODO(mark): This encoding is not necessarily correct, and the same code in - // Blink is marked with a FIXME. Blink does not escape the '%' character, - // that’s a local addition, but it seems appropriate to be able to decode the - // string properly. + // blink/Source/platform/network/FormDataEncoder.cpp + // blink::AppendQuotedString(). %-encoding is endorsed by RFC 7578 §2, with + // approval for otherwise unencoded UTF-8 given by RFC 7578 §5.1. Blink does + // not escape the '%' character, but it seems appropriate to do so in order to + // be able to decode the string properly. std::string encoded; for (char character : name) { switch (character) {