Topic: Which runtimes handle redirects gracefully?

I'm currently trying to put together a working solution for uploading in which the runtime in question (App Engine) has to return a 302 redirect when sent a file. That is, it accepts the file, saves it, then sends a 302 to the final URL. Flash, unfortunately, seems to be incapable of handling this. Do you know what other supported runtimes do?

Also, is there any way ,when using the regular queue widget, to change the URL used for each file, so they are all uploaded to different URLs?

Re: Which runtimes handle redirects gracefully?

Most rumtimes will fail. Plupload will treat all non 200 ok HTTP statuses as errors. Seems odd to intercept a redirect call. Is this really required in App Engine?

Re: Which runtimes handle redirects gracefully?

It's not necessary to 'intercept' the redirect call - returning the status code and content of the page it redirects to would be perfectly satisfactory. Why does plupload treat 3xx statuses and other 2xx statuses as errors? They're clearly not.

And yes, returning a redirect from an upload to the blobstore API is the only option: Applications cannot return response bodies to upload requests.

Re: Which runtimes handle redirects gracefully?

To clarify, does plupload itself report failure on non-200 status codes, or is it the runtimes that do this? Could this be fixed to follow redirects?

Re: Which runtimes handle redirects gracefully?

I think it will be hard to get redirect functionality working across all runtimes. Since we would then need to make another request to grab the contents of the page that it redirected to in order to provide the functionally we currently have on the FileUploaded event. I guess we could simply add range checking for the status codes and ignore any redirects. This way it won't fail but it wouldn't do much either so it's not ideal.

It's also not possible in all runtimes to get the http headers. So we can't pass back the redirect url in the event args.

Re: Which runtimes handle redirects gracefully?

So, per this blog post: … API-part-2

I've tested all the runtimes except Silverlight. They all handle redirects automatically except the browserplus one, returning the result of the redirect target page. Even, to my surprise, the flash one, which I thought based on other tests couldn't handle redirects at all.

The browserplus plugin returns the 302 status code and doesn't automatically follow the redirect. It'd be nice to have that fixed to be consistent with the rest, of course.

Of the changes I made to my fork of the repo, most were to deal with a bug in the current implementation of the App Engine Blobstore API - it doesn't like query string parameters - though I think being able to control if extra arguments are added to the query string or to the POST body would be useful in general. The other change I made was to make the browserplus runtime treat any 2xx or 3xx status code as a success.

I intend to see what'd be required to support uploading of multiple files to different URLs next. smile