diff -Nur download/OpenLayers-2.10/lib/OpenLayers//Protocol/HTTP.js OpenLayers-2.10/lib/OpenLayers//Protocol/HTTP.js
--- download/OpenLayers-2.10/lib/OpenLayers//Protocol/HTTP.js 2010-09-02 23:43:25.000000000 +0200
+++ OpenLayers-2.10/lib/OpenLayers//Protocol/HTTP.js 2010-12-01 18:19:54.621164636 +0100
@@ -457,15 +457,34 @@
*/
handleResponse: function(resp, options) {
var request = resp.priv;
+ // As far as I remember, we do not have access to the
+ // request URL, so we cannot change behaviour depending
+ // on protocol
if(options.callback) {
- if(request.status >= 200 && request.status < 300) {
- // success
- if(resp.requestType != "delete") {
+ // TODO: we can also just key on request.status
+ try {
+ if (resp.requestType != "delete") {
resp.features = this.parseFeatures(request);
+ // if we can get some features, then everything must be OK.
+ if (resp.features) {
+ resp.code = OpenLayers.Protocol.Response.SUCCESS;
+ } else {
+ resp.code = OpenLayers.Protocol.Response.FAILURE;
+ }
+ } else {
+ // for delete, we apparently do not get a response
+ // that's worth parsing, so fall back to HTTP status code
+ // since we probably never delete request over anything
+ // other than http, we should be fine
+ if ((request.status >= 200 && request.status < 300)) {
+ resp.code = OpenLayers.Protocol.Response.SUCCESS;
+ } else {
+ resp.code = OpenLayers.Protocol.Response.FAILURE;
+ }
+
}
- resp.code = OpenLayers.Protocol.Response.SUCCESS;
- } else {
- // failure
+
+ } catch (e) {
resp.code = OpenLayers.Protocol.Response.FAILURE;
}
options.callback.call(options.scope, resp);