Problem with XHR POST large BLOBs (since version 67.0b3 - Firefox only)
Hi all,
I built a small web application that can extract a large zip file (around 275MB) and sends a specfic large file of the extracted contents (around 300MB) via POST request to my own web api. To do so I use the libary "zip.js". At first everything worked fine in all common browsers (Opera, Chrome, IE, Edge and Firefox) under different plattforms (linux and windows).
But since the release of version 67.0 of Firefox it didn't work anymore. I already watched the packages via wireshark. Firefox sends the header of the request but does not attach the file itself.
I already tested my web application with first available beta version of 67 (67.0b3) and latest nightly version (69.0a1) but they didn't work either. The latest runnable version was 66.0.5.
Javascript Code:
function uploadFile(fileAsBlob) {
console.log(fileAsBlob); const xhr = new XMLHttpRequest(); if (xhr.upload) { xhr.onreadystatechange = function() { if (xhr.readyState === 4) { if (xhr.status !== 200) { console.log("Error while uploading."); return; } console.log('Successful.'); } }; xhr.onerror = function() { console.log(xhr); }; xhr.ontimeout = function() { console.log(xhr); }; xhr.open("POST", 'myEndpoint123', true); xhr.setRequestHeader("X_FILENAME", "myFile.xxx"); xhr.send(fileAsBlob); }
}
The corresponding output in the developer console was not helpful for me:
Blob size: 299148800 type: "" <prototype>: BlobPrototype constructor: function () size: slice: function slice() type: <get size()>: function size() <get type()>: function type() <prototype>: Object { … } 169.254.153.110:325:17
Error while uploading. 169.254.153.110:332:33
XMLHttpRequest mozAnon: false mozSystem: false onabort: null onerror: function onerror() onload: null onloadend: null onloadstart: null onprogress: null onreadystatechange: function onreadystatechange() ontimeout: function ontimeout() readyState: 4 response: "" responseText: "" responseType: "" responseURL: "" responseXML: null status: 0 statusText: "" timeout: 0 upload: XMLHttpRequestUpload { onloadstart: null, onprogress: null, onabort: null, … } withCredentials: false <prototype>: XMLHttpRequestPrototype { open: open(), setRequestHeader: setRequestHeader(), send: send(), … }
169.254.153.110:339:25
When I run the same code with another browser (here Google Chrome), I got the following output:
Blob {size: 299148800, type: ""} size: 299148800 type: "" __proto__: Blob size: (...) slice: ƒ slice() type: (...) constructor: ƒ Blob() Symbol(Symbol.toStringTag): "Blob" get size: ƒ size() get type: ƒ type() __proto__: Object (index):325
Successful. (index):335
Has somebody an idea what could be the reason for this behavior? And maybe how it could be fixed?
Best regards
Marvin
由mhollmann于
所有回复 (1)
Try to ask advice at the Stack Overflow forum site.