Skip to content

html5-mode: connection errors are not reported #240

Open
gabor opened this Issue Mar 10, 2011 · 2 comments

3 participants

@gabor
gabor commented Mar 10, 2011

how to reproduce:

  • using the html5 module
  • create a simple file-upload webpage
  • load the webpage
  • turn off the webserver
  • try to upload a file

at this point, the error-event will not fire, but the file-upload-complete even will fire, saying the response is an empty-string. this is wrong. the error-event should fire and not this one.

for example, the flash-module does it that way (errorevent-fired).

it seems the problem is here in the source code:

https://github.com/moxiecode/plupload/blob/master/src/javascript/plupload.html5.js#L487

as you see, to decide whether we had an error or not, the code checks if the status is >=400.

when the above-mentioned connection error happens, the status=0.
(based on my test. the spec says the same: http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute)

a quick fix would be to handle the status=0 case as an error too, but i'm not sure what kind of error to report... should plupload.HTTP_ERROR reported with status-code 0? or maybe IO_ERROR?

also, based on what's written here:
http://www.w3.org/TR/XMLHttpRequest2/#event-xhr-readystatechange,

maybe it would be better to go for the 'error' xhr-event?

i will try to create a patch later, but i would need to know first which way should this be handled?

@MCF
MCF commented Mar 10, 2011

I asked about this same problem on the discussion forum a few months ago as well, so I can confirm the problems exists:

http://www.plupload.com/punbb/viewtopic.php?id=337

@dtmax
dtmax commented Aug 7, 2012

Same issue on latest Chrome + html5 runtime. I was surprised, when my custom UI started updating upload progress quickly, when I switch off internet cable.

@AugustusKling AugustusKling added a commit to AugustusKling/plupload that referenced this issue May 16, 2013
@AugustusKling AugustusKling Reporting error in case connection gets lost during upload with XHR u…
…ploader instead of assuming successful upload. See #240 and #499.
879c709
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.