OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |