don't filter downloads on a PUT; fail permanently on http status 400-499, 501, 505

This commit is contained in:
Dan Mills 2008-12-19 15:24:37 -08:00
parent b043c0298e
commit a449c1f3e5

View File

@ -190,8 +190,6 @@ Resource.prototype = {
_request: function Res__request(action, data) {
let self = yield;
let iter = 0;
let cb = self.cb;
let channel = this._createRequest();
if ("undefined" != typeof(data))
@ -209,15 +207,12 @@ Resource.prototype = {
upload.setUploadStream(iStream, 'text/plain', this._data.length);
}
let listener = new ChannelListener(cb, this._onProgress, this._log);
let listener = new ChannelListener(self.cb, this._onProgress, this._log);
channel.requestMethod = action;
this._data = yield channel.asyncOpen(listener, null);
// FIXME: this should really check a variety of permanent errors,
// rather than just >= 400
if (channel.responseStatus >= 400) {
this._log.debug(action + " request failed (" +
channel.responseStatus + ")");
if (Utils.checkStatus(channel.responseStatus, null, [[400,499],501,505])) {
this._log.debug(action + " request failed (" + channel.responseStatus + ")");
if (this._data)
this._log.debug("Error response: \n" + this._data);
throw new RequestException(this, action, channel);
@ -233,7 +228,6 @@ Resource.prototype = {
}
break;
case "GET":
case "PUT":
case "POST":
this._log.trace(action + " Body:\n" + this._data);
yield this.filterDownload(self.cb);