Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: third_party/WebKit/Source/platform/network/FormDataEncoder.h

Issue 1998563002: Fix URLSearchParams to use the right encoding algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/network/FormDataEncoder.h
diff --git a/third_party/WebKit/Source/platform/network/FormDataEncoder.h b/third_party/WebKit/Source/platform/network/FormDataEncoder.h
index b1cb17c9e51a29d8ad7eef9656bf5caa559abf12..d177fa24ab4054788535fe7a0b217b69f82cc073 100644
--- a/third_party/WebKit/Source/platform/network/FormDataEncoder.h
+++ b/third_party/WebKit/Source/platform/network/FormDataEncoder.h
@@ -34,6 +34,15 @@ namespace blink {
class PLATFORM_EXPORT FormDataEncoder {
STATIC_ONLY(FormDataEncoder);
public:
+ // Specifies how to handle CRs and LFs. When NormalizeCRLF is passed, the
+ // method replaces the following characters with a CRLF pair:
+ // - a CR not followed by an LF
+ // - an LF not preceded by a CR
+ enum Mode {
+ NormalizeCRLF,
+ DoNotNormalizeCRLF
+ };
+
static WTF::TextEncoding encodingFromAcceptCharset(const String& acceptCharset, const WTF::TextEncoding& fallbackEncoding);
// Helper functions used by HTMLFormElement for multi-part form data
@@ -44,9 +53,10 @@ public:
static void addContentTypeToMultiPartHeader(Vector<char>&, const CString& mimeType);
static void finishMultiPartHeader(Vector<char>&);
- // Helper functions used by HTMLFormElement for non multi-part form data
- static void addKeyValuePairAsFormData(Vector<char>&, const CString& key, const CString& value, EncodedFormData::EncodingType = EncodedFormData::FormURLEncoded);
- static void encodeStringAsFormData(Vector<char>&, const CString&);
+ // Helper functions used by HTMLFormElement for non multi-part form data. Mode
+ // argument is not used for TextPlain type.
+ static void addKeyValuePairAsFormData(Vector<char>&, const CString& key, const CString& value, EncodedFormData::EncodingType = EncodedFormData::FormURLEncoded, Mode = NormalizeCRLF);
+ static void encodeStringAsFormData(Vector<char>&, const CString&, Mode);
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698