From 56e73ea355c851fdfd574d6d2a9e2fcb75677945 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Sat, 1 Mar 2014 12:49:47 +0100 Subject: fix($http): don't covert 0 status codes to 404 for non-file protocols PR #5547 introduced conversion of all 0 status codes to 404 for cases where no response was recieved (previously this was done for the file:// protocol only). But this mechanism is too eager and masks legitimate cases where status 0 should be returned. This commits reverts to the previous mechanism of handling 0 status code for the file:// protocol (converting 0 to 404) while retaining the returned status code 0 for all the protocols other than file:// Fixes #6074 Fixes #6155 --- src/ng/httpBackend.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index ee2a37fe..28107966 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -144,9 +144,11 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc jsonpDone = xhr = null; // fix status code when it is 0 (0 status is undocumented). - // Occurs when accessing file resources. - // On Android 4.1 stock browser it occurs while retrieving files from application cache. - status = (status === 0) ? (response ? 200 : 404) : status; + // Occurs when accessing file resources or on Android 4.1 stock browser + // while retrieving files from application cache. + if (status === 0) { + status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0; + } // normalize IE bug (http://bugs.jquery.com/ticket/1450) status = status == 1223 ? 204 : status; -- cgit v1.2.3