browser(firefox): fast post body conversion to base64 (#12898)

This commit is contained in:
Yury Semikhatsky 2022-03-18 18:30:28 -07:00 committed by GitHub
parent 85b01056b6
commit 96b0a4b993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 20 deletions

View File

@ -1,2 +1,2 @@
1318 1319
Changed: lushnikov@chromium.org Mon 28 Feb 2022 06:54:27 PM PST Changed: yurys@chromium.org Fri 18 Mar 2022 05:39:20 PM PDT

View File

@ -754,16 +754,11 @@ function readRequestPostData(httpChannel) {
} }
// Read data from the stream. // Read data from the stream.
let result = undefined; let result = '';
try { try {
const buffer = NetUtil.readInputStream(iStream, iStream.available()); const buffer = NetUtil.readInputStreamToString(iStream, iStream.available());
const bytes = new Uint8Array(buffer); result = btoa(buffer);
let binary = '';
for (let i = 0; i < bytes.byteLength; i++)
binary += String.fromCharCode(bytes[i]);
result = btoa(binary);
} catch (err) { } catch (err) {
result = '';
} }
// Seek locks the file, so seek to the beginning only if necko hasn't // Seek locks the file, so seek to the beginning only if necko hasn't

View File

@ -1,2 +1,2 @@
1319 1320
Changed: lushnikov@chromium.org Mon Mar 7 16:04:44 PST 2022 Changed: yurys@chromium.org Fri 18 Mar 2022 05:34:13 PM PDT

View File

@ -754,16 +754,11 @@ function readRequestPostData(httpChannel) {
} }
// Read data from the stream. // Read data from the stream.
let result = undefined; let result = '';
try { try {
const buffer = NetUtil.readInputStream(iStream, iStream.available()); const buffer = NetUtil.readInputStreamToString(iStream, iStream.available());
const bytes = new Uint8Array(buffer); result = btoa(buffer);
let binary = '';
for (let i = 0; i < bytes.byteLength; i++)
binary += String.fromCharCode(bytes[i]);
result = btoa(binary);
} catch (err) { } catch (err) {
result = '';
} }
// Seek locks the file, so seek to the beginning only if necko hasn't // Seek locks the file, so seek to the beginning only if necko hasn't