зеркало из https://github.com/mozilla/pjs.git
Correct parsing errors of some edge cases omitting optional parameters in data: URLs. Bug 161965 and bug 162019, r=bz, sr=darin
This commit is contained in:
Родитель
6dd5de6674
Коммит
c7d93f58a3
|
@ -140,7 +140,7 @@ nsDataChannel::ParseData() {
|
|||
*comma = '\0';
|
||||
|
||||
// determine if the data is base64 encoded.
|
||||
char *base64 = PL_strstr(buffer, "base64");
|
||||
char *base64 = PL_strstr(buffer, ";base64");
|
||||
if (base64) {
|
||||
lBase64 = PR_TRUE;
|
||||
*base64 = '\0';
|
||||
|
@ -156,8 +156,13 @@ nsDataChannel::ParseData() {
|
|||
if (semiColon)
|
||||
*semiColon = '\0';
|
||||
|
||||
if (semiColon == buffer || base64 == buffer) {
|
||||
// there is no content type, but there are other parameters
|
||||
mContentType = NS_LITERAL_CSTRING("text/plain");
|
||||
} else {
|
||||
mContentType = buffer;
|
||||
ToLowerCase(mContentType);
|
||||
}
|
||||
|
||||
if (semiColon) {
|
||||
char *charset = PL_strcasestr(semiColon + 1, "charset=");
|
||||
|
@ -202,7 +207,7 @@ nsDataChannel::ParseData() {
|
|||
}
|
||||
|
||||
if (lBase64) {
|
||||
*base64 = 'b';
|
||||
*base64 = ';';
|
||||
PRInt32 resultLen = 0;
|
||||
if (dataBuffer[dataLen-1] == '=') {
|
||||
if (dataBuffer[dataLen-2] == '=')
|
||||
|
|
Загрузка…
Ссылка в новой задаче