|
@@ -502,20 +502,9 @@ function ulTest(done) {
|
|
|
prevLoaded = event.loaded;
|
|
prevLoaded = event.loaded;
|
|
|
}.bind(this);
|
|
}.bind(this);
|
|
|
xhr[i].upload.onload = function() {
|
|
xhr[i].upload.onload = function() {
|
|
|
- // check HTTP status - non-2xx means server rejected the request (e.g. 413 body too large)
|
|
|
|
|
- if (xhr[i].status >= 200 && xhr[i].status < 300) {
|
|
|
|
|
- // this stream sent all the garbage data, start again
|
|
|
|
|
- tverb("ul stream finished " + i);
|
|
|
|
|
- testStream(i, 0);
|
|
|
|
|
- } else {
|
|
|
|
|
- tverb("ul stream failed with HTTP " + xhr[i].status + " " + i);
|
|
|
|
|
- if (settings.xhr_ignoreErrors === 0) failed = true; //abort
|
|
|
|
|
- try {
|
|
|
|
|
- xhr[i].abort();
|
|
|
|
|
- } catch (e) {}
|
|
|
|
|
- delete xhr[i];
|
|
|
|
|
- if (settings.xhr_ignoreErrors === 1) testStream(i, 0); //restart stream
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // this stream sent all the garbage data, start again
|
|
|
|
|
+ tverb("ul stream finished " + i);
|
|
|
|
|
+ testStream(i, 0);
|
|
|
}.bind(this);
|
|
}.bind(this);
|
|
|
xhr[i].upload.onerror = function() {
|
|
xhr[i].upload.onerror = function() {
|
|
|
tverb("ul stream failed " + i);
|
|
tverb("ul stream failed " + i);
|
|
@@ -526,6 +515,16 @@ function ulTest(done) {
|
|
|
delete xhr[i];
|
|
delete xhr[i];
|
|
|
if (settings.xhr_ignoreErrors === 1) testStream(i, 0); //restart stream
|
|
if (settings.xhr_ignoreErrors === 1) testStream(i, 0); //restart stream
|
|
|
}.bind(this);
|
|
}.bind(this);
|
|
|
|
|
+ xhr[i].onload = function() {
|
|
|
|
|
+ // check HTTP status after full response is available
|
|
|
|
|
+ if (xhr[i].status >= 200 && xhr[i].status < 300) return;
|
|
|
|
|
+ tverb("ul stream failed with HTTP " + xhr[i].status + " " + i);
|
|
|
|
|
+ if (settings.xhr_ignoreErrors === 0) failed = true; //abort
|
|
|
|
|
+ try {
|
|
|
|
|
+ xhr[i].abort();
|
|
|
|
|
+ } catch (e) {}
|
|
|
|
|
+ delete xhr[i];
|
|
|
|
|
+ }.bind(this);
|
|
|
// send xhr
|
|
// send xhr
|
|
|
xhr[i].open("POST", settings.url_ul + url_sep(settings.url_ul) + (settings.mpot ? "cors=true&" : "") + "r=" + Math.random(), true); // random string to prevent caching
|
|
xhr[i].open("POST", settings.url_ul + url_sep(settings.url_ul) + (settings.mpot ? "cors=true&" : "") + "r=" + Math.random(), true); // random string to prevent caching
|
|
|
try {
|
|
try {
|