If i want to transmit a encrypted file i am missing bytes. It
happens not to all Files. But it is reproduce able with the
attached file. Which is 4001 bytes long, but i get only 4000 in the
xhr.response.
There is some special border by 4000 bytes, but it happens to
larger files at "random" positions.
I use this code to retrive the file from thin.
function requestFile(filename) {
var xhr = new XMLHttpRequest();
xhr.open('POST', '/request', true);
xhr.responseType = 'arraybuffer';
xhr.onloadend = function(e) {
if (this.status == 200) {
console.log("OK, got ArrayBuffer");
decrypted.ciphertext = new DataView(xhr.response);
};
}
var formData = new FormData();
formData.append('filename', filename);
xhr.send(formData);
}
I attach the code for thin and my test file.
I all so have seen in wireshark that all 0x0d bytes are changed
to 0x0a but i dont know why. I have set the contentype to
octet-stream.
Please request if a am not clear enought or if more testfiles
needed, longer files tend to loose more bytes. A 1 MB test file
lose 12 bytes.