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

Side by Side Diff: third_party/WebKit/Source/platform/network/FormDataEncoder.cpp

Issue 1547593002: Introducing a net::GenerateMimeMultipartBoundary helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 11 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 unified diff | Download patch
« net/base/mime_util.cc ('K') | « net/base/mime_util_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (charset.isEmpty()) { 92 if (charset.isEmpty()) {
93 if (defaultCharset.isEmpty()) 93 if (defaultCharset.isEmpty())
94 return WTF::UTF8Encoding(); 94 return WTF::UTF8Encoding();
95 95
96 return defaultCharset; 96 return defaultCharset;
97 } 97 }
98 98
99 return charset; 99 return charset;
100 } 100 }
101 101
102 // TODO(lukasza): Reuse net::GenerateMimeMultipartBoundary instead.
Ryan Sleevi 2016/01/08 19:55:04 I would have objected to this TODO - The Blink cod
102 Vector<char> FormDataEncoder::generateUniqueBoundaryString() 103 Vector<char> FormDataEncoder::generateUniqueBoundaryString()
103 { 104 {
104 Vector<char> boundary; 105 Vector<char> boundary;
105 106
106 // The RFC 2046 spec says the alphanumeric characters plus the 107 // The RFC 2046 spec says the alphanumeric characters plus the
107 // following characters are legal for boundaries: '()+_,-./:=? 108 // following characters are legal for boundaries: '()+_,-./:=?
108 // However the following characters, though legal, cause some sites 109 // However the following characters, though legal, cause some sites
109 // to fail: (),./:=+ 110 // to fail: (),./:=+
110 // Note that our algorithm makes it twice as much likely for 'A' or 'B' 111 // Note that our algorithm makes it twice as much likely for 'A' or 'B'
111 // to appear in the boundary string, because 0x41 and 0x42 are present in 112 // to appear in the boundary string, because 0x41 and 0x42 are present in
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } else if (c == '\n' || (c == '\r' && (i + 1 >= length || string.data()[ i + 1] != '\n'))) { 217 } else if (c == '\n' || (c == '\r' && (i + 1 >= length || string.data()[ i + 1] != '\n'))) {
217 append(buffer, "%0D%0A"); 218 append(buffer, "%0D%0A");
218 } else if (c != '\r') { 219 } else if (c != '\r') {
219 append(buffer, '%'); 220 append(buffer, '%');
220 appendByteAsHex(c, buffer); 221 appendByteAsHex(c, buffer);
221 } 222 }
222 } 223 }
223 } 224 }
224 225
225 } 226 }
OLDNEW
« net/base/mime_util.cc ('K') | « net/base/mime_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698