up2k: gotta go faster

This commit is contained in:
ed 2021-04-19 21:29:43 +02:00
parent 746a8208aa
commit 2b2415a7d8

View file

@ -1223,6 +1223,8 @@ function up2k_init(have_crypto) {
var npart = upt.npart;
var t = st.files[upt.nfile];
if (!t.t3)
t.t3 = new Date().getTime();
pvis.seth(t.n, 1, "🚀 send");
@ -1232,13 +1234,6 @@ function up2k_init(have_crypto) {
if (cdr >= t.size)
cdr = t.size;
var reader = new FileReader();
reader.onerror = function () {
alert('y o u b r o k e i t\nerror: ' + reader.error);
};
reader.onload = function (e) {
var xhr = new XMLHttpRequest();
xhr.upload.onprogress = function (xev) {
pvis.prog(t, npart, xev.loaded);
@ -1265,7 +1260,6 @@ function up2k_init(have_crypto) {
"no further information"));
};
xhr.open('POST', t.purl + 'chunkpit.php', true);
//xhr.setRequestHeader("X-Up2k-Hash", t.hash[npart].substr(1) + "x");
xhr.setRequestHeader("X-Up2k-Hash", t.hash[npart]);
xhr.setRequestHeader("X-Up2k-Wark", t.wark);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
@ -1273,13 +1267,7 @@ function up2k_init(have_crypto) {
xhr.overrideMimeType('Content-Type', 'application/octet-stream');
xhr.responseType = 'text';
xhr.send(e.target.result);
if (!t.t3)
t.t3 = new Date().getTime();
};
reader.readAsArrayBuffer(bobslice.call(t.fobj, car, cdr));
xhr.send(bobslice.call(t.fobj, car, cdr));
}
/////