browser(firefox): use base64 to deliver post data (#3063)
This commit is contained in:
parent
99658c2d32
commit
7f29275aa2
|
|
@ -1,2 +1,2 @@
|
|||
1135
|
||||
Changed: yurys@chromium.org Tue Jul 21 09:15:13 PDT 2020
|
||||
1136
|
||||
Changed: pavel.feldman@gmail.com Tue Jul 21 09:33:13 PDT 2020
|
||||
|
|
|
|||
|
|
@ -708,15 +708,16 @@ function readRequestPostData(httpChannel) {
|
|||
}
|
||||
|
||||
// Read data from the stream.
|
||||
let text = undefined;
|
||||
let result = undefined;
|
||||
try {
|
||||
text = NetUtil.readInputStreamToString(iStream, iStream.available());
|
||||
const converter = Cc['@mozilla.org/intl/scriptableunicodeconverter']
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = 'UTF-8';
|
||||
text = converter.ConvertToUnicode(text);
|
||||
const buffer = NetUtil.readInputStream(iStream, iStream.available());
|
||||
const bytes = new Uint8Array(buffer);
|
||||
let binary = '';
|
||||
for (let i = 0; i < bytes.byteLength; i++)
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
result = btoa(binary);
|
||||
} catch (err) {
|
||||
text = undefined;
|
||||
result = '';
|
||||
}
|
||||
|
||||
// Seek locks the file, so seek to the beginning only if necko hasn't
|
||||
|
|
@ -724,7 +725,7 @@ function readRequestPostData(httpChannel) {
|
|||
// not till 459384 is fixed).
|
||||
if (isSeekableStream && prevOffset == 0)
|
||||
iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
|
||||
return text;
|
||||
return result;
|
||||
}
|
||||
|
||||
function requestHeaders(httpChannel) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue