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

Side by Side Diff: Source/core/platform/network/FormDataBuilder.cpp

Issue 25417007: Handle crash when submitting an injected form on an "image page". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 normalizedAcceptCharset.split(' ', charsets); 84 normalizedAcceptCharset.split(' ', charsets);
85 85
86 WTF::TextEncoding encoding; 86 WTF::TextEncoding encoding;
87 87
88 Vector<String>::const_iterator end = charsets.end(); 88 Vector<String>::const_iterator end = charsets.end();
89 for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it) { 89 for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it) {
90 if ((encoding = WTF::TextEncoding(*it)).isValid()) 90 if ((encoding = WTF::TextEncoding(*it)).isValid())
91 return encoding; 91 return encoding;
92 } 92 }
93 93
94 if (document->inputEncoding().isEmpty()) {
95 if (document->defaultCharset().isEmpty())
96 return WTF::UTF8Encoding();
97
98 return document->defaultCharset();
99 }
100
94 return document->inputEncoding(); 101 return document->inputEncoding();
95 } 102 }
96 103
97 Vector<char> FormDataBuilder::generateUniqueBoundaryString() 104 Vector<char> FormDataBuilder::generateUniqueBoundaryString()
98 { 105 {
99 Vector<char> boundary; 106 Vector<char> boundary;
100 107
101 // The RFC 2046 spec says the alphanumeric characters plus the 108 // The RFC 2046 spec says the alphanumeric characters plus the
102 // following characters are legal for boundaries: '()+_,-./:=? 109 // following characters are legal for boundaries: '()+_,-./:=?
103 // However the following characters, though legal, cause some sites 110 // However the following characters, though legal, cause some sites
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 else if (c == '\n' || (c == '\r' && (i + 1 >= length || string.data()[i + 1] != '\n'))) 218 else if (c == '\n' || (c == '\r' && (i + 1 >= length || string.data()[i + 1] != '\n')))
212 append(buffer, "%0D%0A"); 219 append(buffer, "%0D%0A");
213 else if (c != '\r') { 220 else if (c != '\r') {
214 append(buffer, '%'); 221 append(buffer, '%');
215 appendByteAsHex(c, buffer); 222 appendByteAsHex(c, buffer);
216 } 223 }
217 } 224 }
218 } 225 }
219 226
220 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698