Topic: non-HTTP 200 response codes - pass through to error callback?

Hey Spocke,

Would it be technically possible for the runtimes to pass HTTP response code and body to the error callbacks when a non-HTTP 200 response is received?

At present each runtime seems to throw a generic error -- i.e. Silverlight runtime raises an IO error on an HTTP 500 response, but the event handlers are not able to determine the HTTP response code or read the response body (if any).

Having access to this info would allow more graceful handling of a number of error conditions and allow more sensible server side behavior for indicating certain error conditions -- for example:

  • server-side error occurs, triggering HTTP 500 response (which could contain JSON data to parse and return a more helpful error message to the end user)

  • an authenticated user's session expires while the page is open but before upload is initiated -- i.e. the server responds with an HTTP 400-range response with instructions to re-authenticate, or even an HTTP 300-range response to redirect to an authentication page.  An error handler could catch this, prompt for authentication, and re-initiate the upload.

At present it seems most non-HTTP 200 responses result in errors being raised, but the status code and response body are not returned.  Is this a technical limitation (i.e. runtimes don't have access to this information)?

If you advise this is possible, I will open a feature request ticket on Github. 

Thanks!  Plupload is brilliant.  Separation of runtimes from the plupload core is a great way to go and the event model is rock solid.  Amazing job.

Marc

Re: non-HTTP 200 response codes - pass through to error callback?

Sounds like a good idea. File a feature request at GitHub so I remember to look into it. Or fork it and fix it your self. smile

Re: non-HTTP 200 response codes - pass through to error callback?

I would, but I'm still trying to get my head wrapped around using Git ... been using SVN for too long and need to get up to speed on Git... smile

I will add a feature request at GitHub.  Thanks.

Re: non-HTTP 200 response codes - pass through to error callback?

I've just committed a fix where it will report everything above 400 as errors. So the 30x statuses will now be accepted.